Python implementation of "include"

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Dec 13 20:44:32 EST 2007


En Thu, 13 Dec 2007 19:53:49 -0300, <lloyd at paisite.com> escribió:

> As I understand it, import myFile and include "myFile.py" are not quite  
> the same.
>
> --
> for import to work myFile.py must be in the same directory as the code
> that calls it accessible through PYTHONPATH, whereas include
> "../somedirectory/myFile.py" works in Karrigell, even though it is not
> accessible through PYTHONPATH.
>
> -- if imported, the print
> statement myFile.py would only run the first time through unless
> reload(myFile) is executed in the proper place.

execfile("../somedirectory/myFile.py") does not have those problems.

-- 
Gabriel Genellina




More information about the Python-list mailing list