PHP + TinyButStrong Python replacement

Terry Reedy tjreedy at udel.edu
Wed May 7 15:10:26 EDT 2008


"pistacchio" <pistacchio at gmail.com> wrote in message 
news:fvsdlh$8l3$1 at aioe.org...

| well, it doesn't matter if it's a single file or a package, but it
| _does_ matter if you have to put them under the path where python is
| installed because, in a typical shared web hosting environment (such the
| one that i use) you don't have access to system directories.

When you do an import, the *first* place the interpreter looks is the 
*current* directory, which usually is the directory containing the main 
file.  That is because the first entry in sys.path is ''.  So put 
'template.py' in the same directory as my_web_code.py.  If necessary, one 
can add an entry to the beginning of sys.path.

No need to touch the site-packages directory.  The only reason to put 
something there is to make modules available to any code in any directory 
without putting a copy in each directory containing python files.

tjr







More information about the Python-list mailing list