[Tutor] A simple question

Thomi Richards thomi@thomi.imail.net.nz
Tue, 13 Aug 2002 19:15:33 +1200


this is the way i do it:

-----<SNIP>------
#!/usr/bin/python 

#above line needed in unix like environs only!

import sys

sys.path[0] = '/home/thomi/custom_python_modules/'

#set the above path to the dir where all my custom modules are

import thomimodule1

------<SNIP>-----

this does work, ive tried it myself before... sys.path[0] is free, and
can be used safely, otherwise you'd have to go:

sys.path.append('/home/thomi/custom_python_modules')

hope that helps..

On Tue, 13 Aug 2002 16:23:38 +0930 Thus said "BELSEY, Dylan"
<dylan.belsey@baesystems.com>:

> The O'Reilly reference: Learning Python
> 
> 
> 
> -----Original Message-----
> From: BELSEY, Dylan [mailto:dylan.belsey@baesystems.com]
> Sent: Tuesday, 13 August 2002 15:30
> To: 'Marc French'; tutor@python.org
> Subject: RE: [Tutor] A simple question
> 
> 
> Hi Marc,
> 	I have been experimenting with this recently and although I
> 	don't
> have the definitive answer, I believe that you can set the PYTHONPATH
> system variable to the directory where these modules live or place
> these new modules into the lib directory (not sure if this last one
> works...may want to verify).  These may not be the cleanest ways, so
> I'm open to criticism from the gurus :)
> 	Contrary to previous postings, and this is a personal
> 	preference, I
> found Ivan Van Laningham's SAMS Teach Yourself Python in 24 Hours, to
> be very helpful.  This was actually a topic of discussion today and an
> O'Reilly book was mentioned (???) if memory serves me correctly. 
> Unfortunately I have deleted the e-mail so you may want to search the
> archives of this list for today and yesterday.  The archive is at:
> 		http://mail.python.org/pipermail/tutor/2002-August/date.html
> 	I found this relevant e-mail in the archive:
> 	
> http://mail.python.org/pipermail/tutor/2002-August/016309.html
> 	
> 	I'm sure someone else on the list will be able to give you the
> complete reference.
> 
> 		Dylan
> 
> -----Original Message-----
> From: Marc French [mailto:mcfrench69@hotmail.com]
> Sent: Tuesday, 13 August 2002 04:26
> To: tutor@python.org
> Subject: [Tutor] A simple question
> 
> 
> Hello,
> I am having problems importing modules from other parties, ie Scipy
> and Gnuplot.py. Is there a directory that python is looking in when
> you import a
> 
> module? The modules are in C:\Python22\Lib\site-packages & a folder
> for their respective .py files.
> I am running python 2.2 with Pythonwin on Windows 2000.
> I am a Visual Basic programmer. Do you recommend any good python books
> for someone not use to the command line coming from a visual language?
> Thanks for your help ahead of time.
> Marc
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor


-- 
 "Avoid the Gates of Hell.  Use Linux"

Thomi Richards,
thomi@imail.net.nz