playframework / play1

Play framework
https://www.playframework.com/documentation/1.4.x/home
Other
1.58k stars 683 forks source link

Play build-module fails #1456

Closed Axxoul closed 4 months ago

Axxoul commented 9 months ago

Are you looking for help?

no

Play Version (1.5.x / etc)

1.7.1

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

Windows 11

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

11.0.18

Library Dependencies

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. play new-module modulename
  2. play build-module modulename
  3. modulename is built and modulename.zip is found in dist folder

Actual Behavior

I am using python 3.11.4

  1. play new-module modulename
  2. play build-module modulename

Traceback (most recent call last): File "C:\play7\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 "C:\play7\framework\pym\play\commands\modulesrepo.py", line 65, in execute build(app, args, env) File "C:\play7\framework\pym\play\commands\modulesrepo.py", line 323, in build deps = yaml.load(f.read()) ^^^^^^^^^^^^^^^^^^^ TypeError: load() missing 1 required positional argument: 'Loader'

It seems that the load() function requires parameter loader=Loader. Replacing yaml.load with yaml.safe_load in modulesrepo.py seems works for me, but since I am way over my head thought I would create an issue instead of a PR.

davidcostanzo commented 5 months ago

I had the same problem on Ubuntu 18, Java 17, Python 3.7.11. Interestingly, on a newer version of Ubuntu with a newer Python, I only get a warning, so I suspect it depends on what version of yaml is installed in the system's python3. I never figured out why Play provides its own yaml module nor why it prefers the system yaml.

I independently arrived at same fix Axxoul recommended, which also recommended by https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation

I'm also over my head in both Python and GitHub, but I'll try to submit a PR.