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

[1.7.0] Regression: play idealize dies with UnboundLocalError: local variable 'playHome' referenced before assignment #1399

Closed
xabolcs opened this issue Apr 4, 2022 · 8 comments · Fixed by #1400
Labels
Milestone

Comments

@xabolcs
Copy link
Contributor

xabolcs commented Apr 4, 2022

Play Version (1.5.x / etc)

Play 1.7.0

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Ubuntu 20.04

Expected Behavior

$ ../play/play-1.7.0/play idealize issue-1326/
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.7.0, https://www.playframework.com
~
~ OK, the application is ready for Intellij Idea
~ Use File, Open Project... to open "issue-1326.ipr"
~

Actual Behavior

$ ../play/play-1.7.0/play idealize issue-1326/
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.7.0, https://www.playframework.com
~
Traceback (most recent call last):
  File "../play/play-1.7.0/play", line 168, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
  File "/play/play-1.7.0/framework/pym/play/commands/intellij.py", line 28, in execute
    playHomeAlternative = app.toRelative(playHome).replace('\\', '/')
UnboundLocalError: local variable 'playHome' referenced before assignment

Possible fix

Pull request #1382 removed a line, which caused the issue.

Just add playHome = play_env["basedir"].replace('\\', '/') before the error, as it was before

@xabolcs xabolcs changed the title [1.7.0. [1.7.0] play idealize crashes with "" Apr 4, 2022
@xabolcs xabolcs changed the title [1.7.0] play idealize crashes with "" [1.7.0] play idealize dies with UnboundLocalError: local variable 'playHome' referenced before assignment Apr 4, 2022
@xabolcs xabolcs changed the title [1.7.0] play idealize dies with UnboundLocalError: local variable 'playHome' referenced before assignment [1.7.0] Regression: play idealize dies with UnboundLocalError: local variable 'playHome' referenced before assignment Apr 4, 2022
@xabolcs
Copy link
Contributor Author

xabolcs commented Apr 4, 2022

Cc @jacol84

jacol84 added a commit to jacol84/play that referenced this issue Apr 4, 2022
no initialization playHome
@jacol84
Copy link
Contributor

jacol84 commented Apr 4, 2022

@xabolcs
thank you, for your vigilance

I have sent another pull request with a correction this bug.

thank you,

@tomparle
Copy link
Contributor

tomparle commented Apr 4, 2022

Nice catch+fix in such a short time !

@jacol84
Copy link
Contributor

jacol84 commented Apr 4, 2022

now it is working on WSL artefact

but when i run on win is not working

I have a problem with python and the win32pdh library

G:\tmp\playy>G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\play.bat run aaa
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.7.x-1.7.0-2-gd0c45c9d, https://www.playframework.com
~
No module named 'win32pdh'
Traceback (most recent call last):
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\cmdloader.py", line 26, in load_core
    mod = load_python_module(name, self.path)
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\cmdloader.py", line 62, in load_python_module
    return imp.load_module(name, mod_desc[0], mod_desc[1], mod_desc[2])
  File "C:\Python36\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Python36\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\commands\daemon.py", line 14, in <module>
    import win32pdh, win32pdhutil
ModuleNotFoundError: No module named 'win32pdh'
Traceback (most recent call last):
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\cmdloader.py", line 26, in load_core
    mod = load_python_module(name, self.path)
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\cmdloader.py", line 62, in load_python_module
    return imp.load_module(name, mod_desc[0], mod_desc[1], mod_desc[2])
  File "C:\Python36\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Python36\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "G:\tmp\playy\play-1.7.x-1.7.0-2-gd0c45c9d\framework\pym\play\commands\daemon.py", line 14, in <module>
    import win32pdh, win32pdhutil_

on wsl

@xabolcs
Copy link
Contributor Author

xabolcs commented Apr 4, 2022

ModuleNotFoundError: No module named 'win32pdh'

Yup, @tomparle already found it in the last Python3 PR (#1394) five days ago:

In the latest windows build, it also seems that the missing lib is "win32pdh" : if you do not have time to add it, I will try that tomorrow.

See: #1394 (comment)

@tomparle
Copy link
Contributor

tomparle commented Apr 4, 2022

Yes, try to add it on your system with 'pip install' to see if it does the trick

@jacol84
Copy link
Contributor

jacol84 commented Apr 7, 2022

thanks for the tips and tricks

python -m pip install pywin32

image

now it is working
thank you @tomparle

this is how it works, but rather this library should be included in the project

xael-fry added a commit that referenced this issue Apr 12, 2022
fixed #1399 "UnboundLocalError: local variable 'playHome' referenced before assignment
@xabolcs
Copy link
Contributor Author

xabolcs commented Apr 12, 2022

... but rather this library should be included in the project

Exactly!

The Python3 upgrade (#1394 and friends) seems to be incomplete! Lot of work was done but a few bits are missing.

@xael-fry xael-fry added this to the 1.7.1 milestone Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants