This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thierry.parmentelat
Recipients thierry.parmentelat
Date 2018-11-13.20:55:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542142502.59.0.788709270274.issue35237@psf.upfronthosting.co.za>
In-reply-to
Content
Hi; this is my first entry in this repo

I ran today into a rather frustrating experience, that I'd to avoid it for others as far as possible

In a nutshell I had a sphinx stub that read:

import sys
sys.path.append("..")
<snip>
import mymodule


and because I was switching from os.path to pathlib.Path, I rather stupidly changed it into this

import sys
sys.path.append(Path("..").resolve())
<snip>
import mymodule


---
When trying to run this new code, the message I got was ModuleNotFoundError
So I tried to troubleshoot the situation, and inserted something like

for x in sys.path:
    print(x)

and so the proper path showed up, and that's the point where I started banging my head against the screen
Granted, I was doing too many changes at the same time, and it's entirely my fault if it took me ages really to figure it out eventually.

---
Still, my proposal would be to

*) either accept Path instances in sys.path, or
*) somehow send a warning message stating that the Path instance is totally ignored; at least, I haven't found the corresponding piece of code yet, but as far as I am concerned it's truly as if this Path instance had been completely ignored when executing the import statement
*) or at the very least add a mention about this possible issue in the import documentation


I understand it was a stupid mistake, but with Path becoming THE right way to deal with paths, I think it is safe to predict that I won't be the only one making it.

As I said I am a complete newbie with cpython's codebase and devel practices, so I'll warmly welcome all inputs on this one.

thanks
History
Date User Action Args
2018-11-13 20:55:02thierry.parmentelatsetrecipients: + thierry.parmentelat
2018-11-13 20:55:02thierry.parmentelatsetmessageid: <1542142502.59.0.788709270274.issue35237@psf.upfronthosting.co.za>
2018-11-13 20:55:02thierry.parmentelatlinkissue35237 messages
2018-11-13 20:55:02thierry.parmentelatcreate