jeanralphaviles/prometheus_speedtest

TypeError: main() missing 1 required positional argument: 'argv'

stephen-hill opened this issue · 2 comments

Hi

I'm getting the following error when trying to run this on Alpine Linux v3.10or 3.11 (Python 3.7.5 or 3.8.1).

Traceback (most recent call last):
  File "/usr/bin/prometheus_speedtest", line 11, in <module>
    load_entry_point('prometheus-speedtest==0.9.1', 'console_scripts', 'prometheus_speedtest')()
TypeError: main() missing 1 required positional argument: 'argv'

I have tried installing via pip and easy_install, no change.

Cheers
Stephen

Steps to reproduce:

$ docker run --rm -it alpine:3.10
# apk add python3
# pip3 install prometheus_speedtest
# prometheus_speedtest
Traceback (most recent call last):
  File "/usr/bin/prometheus_speedtest", line 11, in <module>
    load_entry_point('prometheus-speedtest==0.9.1', 'console_scripts', 'prometheus_speedtest')()
TypeError: main() missing 1 required positional argument: 'argv'

The issue stems from the fact that absl-py requires app.run(main) to run under the if __name__ == '__main__': section. This section is not run when the package is installed. Setup.py configures the package to call prometheus_speedtest.prometheus_speedtest:main directly, bypassing app.run(main).

The only way I can think of fixing this is to add a second, intermediary, main function which calls app.run(main) when run either as a shell script or as a package.

@jeanralphaviles Thanks for taking a look.

I have very little python knowledge, but while searching for a solution myself I found this. https://github.com/LazoCoder/Pokemon-Terminal/pull/128/files

I tried it but couldn't get it work.