alexdlaird / pyngrok

A Python wrapper for ngrok
https://pyngrok.readthedocs.io
MIT License
421 stars 59 forks source link

TypeError exception on downloading ngrok binary #57

Closed albinpopote closed 4 years ago

albinpopote commented 4 years ago

Describe the Bug

A TypeError exception is trigger when a download of binary is launched.

Steps to Reproduce

from pyngrok import ngrok
from pyngrok.conf import PyngrokConfig

port = 8000

ngrokConfig = PyngrokConfig( region='eu', ngrok_path='/usr/local/bin/ngrok')
notifyUrl = ngrok.connect( port=port, pyngrok_config=ngrokConfig)

Expected Behavior

Traceback (most recent call last):
  File "./test.py", line 14, in <module>
    notifyUrl = ngrok.connect( port=port, pyngrok_config=ngrokConfig)
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/ngrok.py", line 179, in connect
    api_url = get_ngrok_process(pyngrok_config).api_url
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/ngrok.py", line 130, in get_ngrok_process
    return process.get_process(pyngrok_config)
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/process.py", line 274, in get_process
    return _start_process(pyngrok_config)
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/process.py", line 399, in _start_process
    ngrok_process._log_startup_line(line)
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/process.py", line 86, in _log_startup_line
    log = self._log_line(line)
  File "/usr/local/lib/python3.7/dist-packages/pyngrok/process.py", line 119, in _log_line
    logger.log(getattr(logging, log.lvl), line)
TypeError: getattr(): attribute name must be string

It seems to be the result of download progress from intaller which print output on stdout and don't respect the log format of NgrokLog Class (log.lvl = None)

Environment

alexdlaird commented 4 years ago

Thanks for raising this. I will make a check where we output this logline to ensure the value is not None, but are you able to consistently reproduce this? If so, I wonder if you could try to output what the log line is, because it may give us some insight in to another underlying issue with why you're not able to download the binary.

alexdlaird commented 4 years ago

This has been fixed in 4.1.7, which should be available on PyPI shortly.