Performance when working directory is slow network drive

Mark Hadfield m.hadfield at
Thu Mar 1 22:01:28 CET 2001

"Sean Reifschneider" <jafo at> wrote in message
news:mailman.983425921.14373.python-list at
> On Thu, Mar 01, 2001 at 02:45:25PM +1300, Mark Hadfield wrote:
> >If the working directory is on one of my hard drives the elapsed times is
> >approx 0.1 seconds; if I then cd to a slow network drive (a Samba share
to a
> >Unix machine that mounts another machine's disks via NFS!) it takes 2
> >seconds.
> Have you tried removing the current directory from sys.path?  That'd be
> the one that's empty.

Yes, that's it! Thank you.

Now only two things puzzle me:

1. Why having the current directory in the search path affects the import
time for the os module much more than it does for other modules I tested
(like string). Is this because os is a package?

2. Why the number of empty-string entries at the head of sys.path varies
between 0 and 2 on my system depending on how the interpreter is invoked and
what I ate for breakfast (or something).

Mark Hadfield
m.hadfield at
National Institute for Water and Atmospheric Research

More information about the Python-list mailing list