Re: How to import Python files in the other directories?
If the documentation is not clear to you as it was not to me, the following adds the search path, /Volumes/iDisk/match/python/matchmod, to the list of places python looks for modules, I have this included as an import statement at the beginning of a program. from sys import path path.append(/Volumes/iDisk/match/python/matchmod) Thanks Vincent Davis 720-301-3003 On Fri, Mar 6, 2009 at 12:10 AM, Christian Heimes li...@cheimes.de wrote: Muddy Coder schrieb: Hi Folks, If I have a python file foo.py in the current directory, I can simply import it in the way below: import foo when a project keeps grow, more and more Python files are created, and they are also needed to put into different directories. Then, a problem comes: how to import the Python files residing in the other directories? Somebody helps me out? Thanks! Use packages: http://docs.python.org/tutorial/modules.html#packages Christian -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
How to import Python files in the other directories?
Hi Folks, If I have a python file foo.py in the current directory, I can simply import it in the way below: import foo when a project keeps grow, more and more Python files are created, and they are also needed to put into different directories. Then, a problem comes: how to import the Python files residing in the other directories? Somebody helps me out? Thanks! Muddy Coder -- http://mail.python.org/mailman/listinfo/python-list
Re: How to import Python files in the other directories?
Muddy Coder cosmo_gene...@yahoo.com writes: If I have a python file foo.py in the current directory, I can simply import it in the way below: import foo Because the current directory, '.', is in the import search path. when a project keeps grow, more and more Python files are created, and they are also needed to put into different directories. Then, a problem comes: how to import the Python files residing in the other directories? Somebody helps me out? Thanks! Modify the import search path, which is a list named ‘sys.path’ URL:http://docs.python.org/library/sys.html#sys.path, to have an entry for each path you want to be searched when importing a module. -- \ “The right to use [strong cryptography] is the right to speak | `\ Navajo.” —Eben Moglen | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: How to import Python files in the other directories?
Muddy Coder schrieb: Hi Folks, If I have a python file foo.py in the current directory, I can simply import it in the way below: import foo when a project keeps grow, more and more Python files are created, and they are also needed to put into different directories. Then, a problem comes: how to import the Python files residing in the other directories? Somebody helps me out? Thanks! Use packages: http://docs.python.org/tutorial/modules.html#packages Christian -- http://mail.python.org/mailman/listinfo/python-list