Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtual environments created via relative paths on Windows creates bad console executables #1552

Closed
gaborbernat opened this issue Feb 10, 2020 · 7 comments · Fixed by #1550
Closed

Comments

@gaborbernat
Copy link
Contributor

Seems https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve does not generate the absolute path on Windows, but does everywhere else.

@gaborbernat
Copy link
Contributor Author

An example of this can be seen in our own CIs zipapp/readme tox environments.

@pradyunsg
Copy link
Member

There is an undocumented Path.absolute method, which might be what you want here.

I suggest passing the Path object through a os.path.realpath(os.path.abspath(path)) though -- it's documented and works exactly like we want it to. (maybe the abspath call here is unnecessary?)

@gaborbernat
Copy link
Contributor Author

In my experience resolve is much more reliable in resolving symlinks, so I prefer that; I'm just also invoking absolute which I'm fine, already submitted via #1550

@pfmoore
Copy link
Member

pfmoore commented Feb 10, 2020

The only case I know of where resolve doesn't give an absolute path is if the file doesn't exist. But that doesn't seem like it would be the case here...?

Can you give an example of the issue? It feels like we might be over-complicating the solution, or missing the actual problem, here 🙁

@gaborbernat
Copy link
Contributor Author

gaborbernat commented Feb 10, 2020

@pfmoore that is the case here 👍; if you pass in a relative path that does not exist the world breaks on Windows; it's actually very subtle because things work while you start console scripts from the same folder as one yoy created from.. but breaks with other cwd.

@pfmoore
Copy link
Member

pfmoore commented Feb 10, 2020

Ah, OK. Thanks for the clarification. Apologies that I couldn't find that information for myself.

@gaborbernat
Copy link
Contributor Author

Oh and I'm happy to switch back to Path.absolute() if upstream decided to actually document and support it, but that's still a WIP as I read from those threads

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants