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

@gaborbernat gaborbernat commented Feb 10, 2020

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

This comment has been minimized.

Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 10, 2020

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

@pradyunsg

This comment has been minimized.

Copy link
Member

@pradyunsg pradyunsg commented Feb 10, 2020

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

This comment has been minimized.

Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 10, 2020

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

This comment has been minimized.

Copy link
Member

@pfmoore 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

This comment has been minimized.

Copy link
Contributor Author

@gaborbernat 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

This comment has been minimized.

Copy link
Member

@pfmoore pfmoore commented Feb 10, 2020

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

@gaborbernat

This comment has been minimized.

Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.