Python import search path!

SMALLp pofuk at email.t-com.hr
Fri Dec 14 17:20:42 EST 2007


kyosohma at gmail.com wrote:
> On Dec 14, 3:44 pm, SMALLp <po... at email.t-com.hr> wrote:
>> Hy!
>> I'm new in Linux, and i feel little less newer in python.
>>
>> I need advice and help. I'm making an application witch purpose is
>> irrelevant. It has a lot of code for now and I've only made interface.
>> So I've tried to split code into separate files and in windows as I
>> remember worked file when i wrote  eg. import myFile but now in Ubuntu
>> it says Module not found. (I'm using Ubuntu and I've installed python
>> 2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor).
>> The question is how to make this work (files are in the same folder)
>>
> 
> Not sure what is going on here from this description. You may need to
> use the sys module and add the path to your module temporarily.
> 
> import sys
> sys.path.append("//path/to/myFile")
> 
> 


I managed to make simple thing complicated. So what i was trying to do 
is to write part of my program in a separate file and than use "import 
myFile as my" to use classes written in that file.

		Thanks for the answer Mike!



More information about the Python-list mailing list