*.pyc files without using absolute path

Alexander Hoffmann alexander.hoffmann at netgenius.de
Wed Sep 8 04:01:27 EDT 2004


Hello,

I have a project with a number of python modules, which means there are 
several *.py files all in the same folder /usr/local/myproject/*.py .
I ran the program to test it and of course as a result the *.pyc files were 
created. Since everything was running fine I gave the *.pyc files (not the 
source) to a friend of mine. He put it in his home dir and executed the 
program. Then there was an error because some of the modules tried to import 
the others with absolute path "/usr/local/myproject/*.pyc) which did not 
exists on my friend's machine. 
To get more clarification I searched for the absolute path in my local *.pyc 
files (grep -a "/usr/local/myproject" *.pyc) and indeed there were a lot of 
matching lines. 
How can I make Python create *.pyc files without absolute path when all the 
modules (besides built-in like "string", "os" etc. ) are in the same dir ?

Thanks to you !
Alex



More information about the Python-list mailing list