andrea.crotti.0 at gmail.com
Wed Feb 1 12:47:22 EST 2012
On 02/01/2012 05:13 PM, Eric Snow wrote:
> On Wed, Feb 1, 2012 at 9:15 AM, Andrea Crotti<andrea.crotti.0 at gmail.com> wrote:
>> So suppose I want to modify the sys.path on the fly before running some code
>> which imports from one of the modules added.
>> at run time I do
>> but it still doesn't work and I get an import error.
> Make sure you are adding to sys.path the directories that your
> packages/modules are in, and not the actual package directories.
> During import Python looks for modules/packages _in_ each of the
> directories on sys.path, but not _at_ those directories.
Yes sure I do this..
>> If I take these paths and add them to site-packages/my_paths.pth
>> everything works, but at run-time the paths which I actually see before
>> importing are exactly the same.
> You mean sys.path looks exactly the same in the two cases?
Yes they are exactly the same, because in that file I just write exactly
the same list,
but when modifying it at run-time it doesn't work, while if at the
there is this file everything works correctly...
That's what really puzzles me.. What could that be then?
More information about the Python-list