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

Fix flake errors after moving to python 3 #2695

Merged
2 changes: 1 addition & 1 deletion luigi/contrib/docker_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def run(self):
self.__logger.error("Container " + container_name +
" exited with non zero code: " + message)
raise
except ImageNotFound as e:
except ImageNotFound:
self.__logger.error("Image " + self._image + " not found")
raise
except APIError as e:
Expand Down
4 changes: 2 additions & 2 deletions luigi/contrib/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def _rm_recursive(self, ftp, path):

try:
names = ftp.nlst()
except ftplib.all_errors as e:
except ftplib.all_errors:
# some FTP servers complain when you try and list non-existent paths
return

Expand All @@ -226,7 +226,7 @@ def _rm_recursive(self, ftp, path):
ftp.cwd(wd) # don't try a nuke a folder we're in
ftp.cwd(path) # then go back to where we were
self._rm_recursive(ftp, name)
except ftplib.all_errors as e:
except ftplib.all_errors:
ftp.delete(name)

try:
Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/mssqldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

try:
import _mssql
except ImportError as e:
except ImportError:
logger.warning("Loading MSSQL module without the python package pymssql. \
This will crash at runtime if SQL Server functionality is used.")

Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/mysqldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
try:
import mysql.connector
from mysql.connector import errorcode, Error
except ImportError as e:
except ImportError:
logger.warning("Loading MySQL module without the python package mysql-connector-python. \
This will crash at runtime if MySQL functionality is used.")

Expand Down
2 changes: 1 addition & 1 deletion luigi/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _read_pids_file(pid_file):
# First setup a python 2 vs 3 compatibility
# http://stackoverflow.com/a/21368622/621449
try:
FileNotFoundError
FileNotFoundError # noqa: F823
except NameError:
# Should only happen on python 2
FileNotFoundError = IOError
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ commands =
# By putting it here, local flake8 runs will also pick it up.
[flake8]
max-line-length=160
builtins = unicode

[testenv:flake8]
deps =
Expand Down