[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd delays when cwd is on a network mount

On 11Oct2019 11:06, Tobiah <toby at> wrote:
>On 10/11/19 10:56 AM, Tobiah wrote:
>>I have a directory mounted with sshfs over a 5mb connection.
>>It's quite usable under most circumstances.
>>When I run python from a directory under that mount, imports from 
>>directories are quite slow:
>>$ python2.7
>>>>>import my_module  ##  takes 25 seconds to complete
>Another way:
>$ cd ~
>$ python2.7
>>>>import os
>>>>import my_module	## 25 seconds again
>Without the os.chdir() the import is instantaneous.

Python's default sys.path includes the current working directory.  
(Worse: at the front!)

So it is loooking for my_module in the sshfs directory before your 
standard places. Thus the slowness.

Personally I consider this a misfeature.

Cameron Simpson <cs at>