wakatime / sublime-wakatime

Sublime Text 2 & 3 plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/sublime-text
BSD 3-Clause "New" or "Revised" License
526 stars 45 forks source link

'NoneType' object has no attribute 'format_exc' when operation timed out #108

Closed skys215 closed 2 years ago

skys215 commented 2 years ago

Hi,

While I'm using Wakatime under MacOS 12.0.1, with Sublime Text 4126, I've got AttributeError: 'NoneType' object has no attribute 'format_exc' error. I'm using proxy to avoid blockage from Internet operator. I will check about why it cannot connect to the proxy. However, I think this error is preventing from logging usefull information for debug. I assume that this behaviour is not expected.

Let me know if you guys need more information to fixed the bug.

Here's the log:

[WakaTime] [INFO] Initializing WakaTime plugin v11.0.2
[WakaTime] [INFO] Downloading wakatime-cli...
reloading settings Packages/User/phpfmt.sublime-settings
[WakaTime] [DEBUG] GitHub API Response 304
[WakaTime] [DEBUG] Downloading wakatime-cli from https://github.com/wakatime/wakatime-cli/releases/download/undefined/wakatime-cli-darwin-amd64.zip
Package Control: Installing 1 upgrades
ignored packages updated to: ["JavaScriptNext - ES6 Syntax", "SublimeCodeIntel", "Vintage", "WakaTime"]
unloading python 3.3 plugin WakaTime.WakaTime
reloading settings Packages/WakaTime/WakaTime.sublime-settings
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
Package Control: Upgraded WakaTime to 11.0.3
ignored packages updated to: ["JavaScriptNext - ES6 Syntax", "SublimeCodeIntel", "Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/WakaTime/WakaTime.sublime-settings
reloading python 3.3 plugin WakaTime.WakaTime
[WakaTime] [INFO] Initializing WakaTime plugin v11.0.3
[WakaTime] [INFO] Downloading wakatime-cli...
[WakaTime] [DEBUG] GitHub API Response 304
[WakaTime] [DEBUG] Downloading wakatime-cli from https://github.com/wakatime/wakatime-cli/releases/download/undefined/wakatime-cli-darwin-amd64.zip
reloading settings Packages/User/Preferences.sublime-settings
[WakaTime] [DEBUG] Traceback (most recent call last):
  File "/Users/username/Library/Application Support/Sublime Text 3/Packages/WakaTime/WakaTime.py", line 633, in run
    download(url, zip_file)
  File "/Users/username/Library/Application Support/Sublime Text 3/Packages/WakaTime/WakaTime.py", line 892, in download
    urlretrieve(url, filePath)
  File "./python3.3/urllib/request.py", line 181, in urlretrieve
  File "./python3.3/urllib/request.py", line 156, in urlopen
  File "./python3.3/urllib/request.py", line 475, in open
  File "./python3.3/urllib/request.py", line 587, in http_response
  File "./python3.3/urllib/request.py", line 513, in error
  File "./python3.3/urllib/request.py", line 447, in _call_chain
  File "./python3.3/urllib/request.py", line 595, in http_error_default
urllib.error.HTTPError: HTTP Error 404: Not Found

[WakaTime] [INFO] Finished extracting wakatime-cli.
Exception in thread Thread-8:
Traceback (most recent call last):
  File "./python3.3/urllib/request.py", line 1248, in do_open
  File "./python3.3/http/client.py", line 1065, in request
  File "./python3.3/http/client.py", line 1103, in _send_request
  File "./python3.3/http/client.py", line 1061, in endheaders
  File "./python3.3/http/client.py", line 906, in _send_output
  File "./python3.3/http/client.py", line 844, in send
  File "./python3.3/http/client.py", line 1198, in connect
  File "./python3.3/socket.py", line 435, in create_connection
  File "./python3.3/socket.py", line 426, in create_connection
TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/username/Library/Application Support/Sublime Text 3/Packages/WakaTime/WakaTime.py", line 639, in run
    log(DEBUG, traceback.format_exc())
  File "/Users/username/Library/Application Support/Sublime Text 3/Packages/WakaTime/WakaTime.py", line 892, in download
    urlretrieve(url, filePath)
  File "./python3.3/urllib/request.py", line 181, in urlretrieve
  File "./python3.3/urllib/request.py", line 156, in urlopen
  File "./python3.3/urllib/request.py", line 469, in open
  File "./python3.3/urllib/request.py", line 487, in _open
  File "./python3.3/urllib/request.py", line 447, in _call_chain
  File "./python3.3/urllib/request.py", line 1289, in https_open
  File "./python3.3/urllib/request.py", line 1251, in do_open
urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "/Users/username/Library/Application Support/Sublime Text 3/Packages/WakaTime/WakaTime.py", line 653, in run
    log(DEBUG, traceback.format_exc())
AttributeError: 'NoneType' object has no attribute 'format_exc'

Code Time: Response Error for /hashed_values: [Errno 60] Operation timed out
ERROR FETCHING HASHED VALUES
'NoneType' object has no attribute 'read'

Thanks in advance.

skys215 commented 2 years ago

https://github.com/wakatime/wakatime-cli/releases/download/undefined/wakatime-cli-darwin-amd64.zip There's undefined in the url, maybe that's the problem?

UPDATED:

When trying to get the latest version from github, it returned 304 (GitHub API Response 304)

UPDATED2:

The undefined comes from here: .wakatime-internal.cfg

[internal]
cli_version = undefined
cli_version_last_modified = Tue, 04 Jan 2022 03:29:43 GMT
backoff_at =
backoff_retries = 0

UPDATED3: Manually set cli_version_last_modified to one year before to get 200 http status code. Now the version number is correct but got Operation timed out. I'll try to fix my proxy.

skys215 commented 2 years ago

Fixed the problem with proxy and WakaTime was working like before.