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

Bare Except Statement in jbt.py #17

Open
mfixstsci opened this issue Feb 15, 2021 · 0 comments
Open

Bare Except Statement in jbt.py #17

mfixstsci opened this issue Feb 15, 2021 · 0 comments

Comments

@mfixstsci
Copy link
Collaborator

mfixstsci commented Feb 15, 2021

pep8speaks caught a bare except. I have seen this issue with urllib appear in the past and one way around it is to remove and use the python 3 import only since python 2 won't be/isn't supported anymore. If that solution isn't the most robust, we just add ImportError after the except statement:

  try:
      # Python 3
      # Read the background cache version
      version_file = urllib.request.urlopen(self.cache_url + 'VERSION')
      sbet_file = urllib.request.urlopen(self.cache_url + cache_file)
  except ImportError:
      # Python 2
      # Read the background cache version
      version_file = urllib.urlopen(self.cache_url + 'VERSION')
      sbet_file = urllib.urlopen(self.cache_url + cache_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant