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

UnboundLocalError using -p option on Windows #750

Closed
NiklasRosenstein opened this issue May 2, 2015 · 4 comments
Closed

UnboundLocalError using -p option on Windows #750

NiklasRosenstein opened this issue May 2, 2015 · 4 comments

Comments

@NiklasRosenstein
Copy link

When I use the -p option, I get UnboundLocalError: local variable 'original_python' referenced before assignment

C:\Users\niklas\Desktop\stack>virtualenv env -p "C:\maxon\Cinema 4D R15 Dev\resource\modules\python\res\Python.win64.framework\python.exe" --no-site-packages
Running virtualenv with interpreter C:\maxon\Cinema 4D R15 Dev\resource\modules\python\res\Python.win64.framework\python.exe
Overwriting env\lib\site.py with new content
New python executable in env\Scripts\python.exe
Traceback (most recent call last):
  File "F:\Python27\lib\site-packages\virtualenv.py", line 2352, in <module>
    main()
  File "F:\Python27\lib\site-packages\virtualenv.py", line 825, in main
    symlink=options.symlink)
  File "F:\Python27\lib\site-packages\virtualenv.py", line 985, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "F:\Python27\lib\site-packages\virtualenv.py", line 1363, in install_python
    shutil.copy(original_python, py_executable)
UnboundLocalError: local variable 'original_python' referenced before assignment

The referenced Python version is 2.6.4, using virtualenv 12.1.1

@NiklasRosenstein
Copy link
Author

I just tried installing virtualenv to the Python installation that I passed via -p, but I get the same error. It seems to be a problem with Python 2.6?

@NiklasRosenstein
Copy link
Author

No the problem is the .framework in the path. See L1351-L1364.

@NiklasRosenstein
Copy link
Author

Please take a look at my fix at https://github.com/NiklasRosenstein/virtualenv/commit/b3c5b58cf7c95bb093a6d70070e2ad2d7fed8237. I simply initialized original_python with None, and if it is still None after the 'EDP' and 'Python.framework' things are checked, the code below is not executed.

@stale
Copy link

stale bot commented Jan 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 14, 2019
@stale stale bot closed this as completed Jan 22, 2019
@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

No branches or pull requests

1 participant