playframework / play1

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

Python AttributeError: module 'time' has no attribute 'clock' #1466

Closed osmanirosado closed 7 months ago

osmanirosado commented 7 months ago

An error occurs when running play install using python 3.9

Enviroment

Docker image

$ docker images mcr.microsoft.com/openjdk/jdk:17-mariner 
REPOSITORY                      TAG          IMAGE ID       CREATED      SIZE
mcr.microsoft.com/openjdk/jdk   17-mariner   a8bc110cdedf   9 days ago   430MB

Python version

root [ / ]# python3 --version
Python 3.9.14

Play version

#18 [stage-1  8/10] RUN play version
#18 0.820 ~        _            _ 
#18 0.820 ~  _ __ | | __ _ _  _| |
#18 0.820 ~ | '_ \| |/ _' | || |_|
#18 0.820 ~ |  __/|_|\____|\__ (_)
#18 0.820 ~ |_|            |__/   
#18 0.820 ~
#18 0.820 ~ play! 1.7.x-f832ef82, https://www.playframework.com
#18 0.820 ~
#18 0.820 1.7.x-f832ef82
#18 DONE 2.1s

Java version

root [ / ]# java --version
openjdk 17.0.10 2024-01-16 LTS
OpenJDK Runtime Environment Microsoft-8902769 (build 17.0.10+7-LTS)
OpenJDK 64-Bit Server VM Microsoft-8902769 (build 17.0.10+7-LTS, mixed mode, sharing)

Error

Building process ...

#18 [stage-1 8/9] RUN play install deadbolt <<< 'y'
#18 1.489 ~        _            _
#18 1.489 ~  _ __ | | __ _ _  _| |
#18 1.489 ~ | '_ \| |/ _' | || |_|
#18 1.489 ~ |  __/|_|\____|\__ (_)
#18 1.489 ~ |_|            |__/
#18 1.489 ~
#18 1.489 ~ play! 1.7.x-f832ef82, https://www.playframework.com
#18 1.489 ~
#18 1.489 ~ Will install deadbolt-1.5.4
#18 1.489 ~ This module is compatible with: *
#18 1.489 ~ Do you want to install this version (y/n)? ~ Installing module deadbolt-1.5.4...
#18 1.489 ~
#18 1.489 ~ Fetching https://www.playframework.com/modules/deadbolt-1.5.4.zip
#18 1.490 Traceback (most recent call last):
#18 1.490   File "/home/play/play1/play", line 168, in <module>
#18 1.490     status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
#18 1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 67, in execute
#18 1.490     install(app, args, env)
#18 1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 476, in install
#18 1.490     Downloader().retrieve(fetch, archive)
#18 1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 96, in retrieve
#18 1.490     time.clock()
#18 1.491 AttributeError: module 'time' has no attribute 'clock'
#18 ERROR: process "/bin/sh -c play install deadbolt <<< 'y'" did not complete successfully: exit code: 1
------
 > [stage-1 8/9] RUN play install deadbolt <<< 'y':
1.490 Traceback (most recent call last):
1.490   File "/home/play/play1/play", line 168, in <module>
1.490     status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 67, in execute
1.490     install(app, args, env)
1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 476, in install
1.490     Downloader().retrieve(fetch, archive)
1.490   File "/home/play/play1/framework/pym/play/commands/modulesrepo.py", line 96, in retrieve
1.490     time.clock()
1.491 AttributeError: module 'time' has no attribute 'clock'
------
Dockerfile:36
--------------------
  34 |
  35 |     # Install Application Play dependencies
  36 | >>> RUN play install deadbolt <<< 'y'
  37 |     RUN play install betterlogs <<< 'y'
  38 |
--------------------
ERROR: failed to solve: process "/bin/sh -c play install deadbolt <<< 'y'" did not complete successfully: exit code: 1

Reason

From the Python 3.8 doc:

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior.

xael-fry commented 7 months ago

PR #1467 merge