Imports

kyosohma at gmail.com kyosohma at gmail.com
Tue Mar 20 14:51:12 EDT 2007


On Mar 20, 1:31 pm, "gtb" <goodTweetieB... at hotmail.com> wrote:
> I am working with a tool called maxQ that generates jython scripts.
> The tool runs in
>
> C:\maxq\bin.
>
> Rather than clutter up bin I want to put the scripts and other .py
> scripts in
>
> c:\maxq\bin\testScripts.
>
> When doing so the scripts need to import from
>
> c:\maxq\jython, but can't find the modules.
>
> I tried adding c:\maxq\jython to the environment variable pythonpath
> but to no avail. Perhaps I missed it in Rossum's tutorial but is there
> a std prgrammatic way to specify a module directory?
>
> Could you, would you, recommend a text or another webpage for learning
> more (much more) about python?
>
> Thanx,
>
> gtb

I typically just import sys and then do a
sys.path.append(directoryPath). This basically makes whatever modules
in that path available at run time. If you need a beginners reference
book, I recommend "Beginning Python" by Hetland. "Python Programming
for the Absolute Beginner" by Dawson was a lot of fun, but he doesn't
get into the internals of the language like Hetland does. Once you're
a snake charmer too, you can "graduate" to the "Programming Python"
book by Lutz.

Mike




More information about the Python-list mailing list