"import" not working?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Feb 21 03:37:22 EST 2009


En Fri, 20 Feb 2009 22:40:03 -0200, Lionel <lionel.keene at gmail.com>  
escribió:

> Okay, moving the wx example into the same directory containing the
> first example that was working fixed it. This directory only contains
> these two modules and nothing else. The old directory which contained
> the example that wasn't working did not contain a module with the same
> name as the one I was trying to import, so i don't know why this "fix"
> worked.

Just play safe:

- Don't use "from xxx import *", least from two places at the same time.  
The wx package has a short name on purpose - use "import wx" and then  
wx.Frame, etc.

- Don't play with sys.path if you don't have to; you can put your own  
modules in a place already listed (like Lib\site-packages). Or, use a .pth  
file if you want to add a copmletely separate directory like  
c:\DataFileTypes

-- 
Gabriel Genellina




More information about the Python-list mailing list