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

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

Closed
osmanirosado opened this issue Feb 23, 2024 · 1 comment
Closed

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

osmanirosado opened this issue Feb 23, 2024 · 1 comment
Milestone

Comments

@osmanirosado
Copy link
Contributor

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 added a commit that referenced this issue Mar 1, 2024
#1466 The clock function was removed from time module in Python 3.8
@xael-fry xael-fry added this to the 1.8.0 milestone Mar 1, 2024
@xael-fry xael-fry removed the feature label Mar 1, 2024
@xael-fry
Copy link
Member

xael-fry commented Mar 1, 2024

PR #1467 merge

@xael-fry xael-fry closed this as completed Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants