Skip to content

Commit 800c6fe

Browse files
committed
Fix catching of module not found error
1 parent caf962a commit 800c6fe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

synapseclient/table.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,15 @@ def _get_view_type_mask_for_deprecated_type(type):
375375
def test_import_pandas():
376376
try:
377377
import pandas as pd # noqa F401
378-
# used to catch ImportError, but other errors can happen (see SYNPY-177)
379-
except: # noqa
380-
sys.stderr.write("""\n\nThe pandas package is required for this function!\n
378+
# used to catch when pandas isn't installed
379+
except ModuleNotFoundError:
380+
raise ModuleNotFoundError("""\n\nThe pandas package is required for this function!\n
381381
Most functions in the synapseclient package don't require the
382382
installation of pandas, but some do. Please refer to the installation
383383
instructions at: http://pandas.pydata.org/.
384384
\n\n\n""")
385+
# catch other errors (see SYNPY-177)
386+
except: # noqa
385387
raise
386388

387389

0 commit comments

Comments
 (0)