On Wed, Jun 10, 2009 at 03:42:52AM -0000, Shawn Moffit wrote:
> I know I'm not getting how the relative directory structure from
> python works... If I'm using python at c:\python26 and my module
> files are at c:\python26\pydocs
> what is the correct syntax for importing them from within the
> interpreter?
In general, if you type "import foo" then either there should be a
"foo.py" installed in one of the "system locations" (on linux this
might be /usr/lib/python2.6/site-packages/foo.py) or there should be a
foo.py in the current working directory (and you'd use the "cd" command
to move yourself into the right directory).
On Linux, you can use "PYTHONPATH=/some/crazy/folder python" to have
python also search for modules in /some/crazy/folder. I don't know if
this works on Windows.
> what if I wanted to import a file from c:\user\shawn\documents\pydocs
The easiest thing would be to run "cd c:\user\shawn\documents\pydocs"
and then run "python" and then enter "import ch03.py" or whatever.
Good luck,
-- Erik