Skip to content

ERR: include original error message for missing required dependencies #26685

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

Merged
merged 14 commits into from
Jun 11, 2019
Merged

ERR: include original error message for missing required dependencies #26685

merged 14 commits into from
Jun 11, 2019

Conversation

DanielFEvans
Copy link
Contributor

@DanielFEvans DanielFEvans commented Jun 6, 2019

closes #23868

Resubmit of PR #26665, which was merged in a bit too eagerly!

Change to test hopefully avoids recursion, although like others, it doesn't reproduce locally for me.

@codecov
Copy link

codecov bot commented Jun 6, 2019

Codecov Report

Merging #26685 into master will decrease coverage by 50.11%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #26685       +/-   ##
===========================================
- Coverage   91.87%   41.76%   -50.12%     
===========================================
  Files         174      174               
  Lines       50661    50661               
===========================================
- Hits        46547    21157    -25390     
- Misses       4114    29504    +25390
Flag Coverage Δ
#multiple ?
#single 41.76% <ø> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.37%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.16%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.1%) ⬇️
pandas/core/sparse/scipy_sparse.py 10.14% <0%> (-89.86%) ⬇️
pandas/core/tools/numeric.py 10.14% <0%> (-89.86%) ⬇️
... and 128 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 891a419...9556fca. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 6, 2019

Codecov Report

Merging #26685 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26685      +/-   ##
==========================================
- Coverage   91.72%   91.71%   -0.01%     
==========================================
  Files         178      178              
  Lines       50779    50779              
==========================================
- Hits        46578    46574       -4     
- Misses       4201     4205       +4
Flag Coverage Δ
#multiple 90.31% <ø> (ø) ⬆️
#single 41.19% <ø> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.88% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 157a4e3...014275a. Read the comment docs.

@datapythonista
Copy link
Member

Some errors in the CI, can you have a look? Let us know if you have questions.

@datapythonista datapythonista added the Error Reporting Incorrect or improved errors from pandas label Jun 6, 2019
@pep8speaks
Copy link

pep8speaks commented Jun 6, 2019

Hello @DanielFEvans! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 16:80: E501 line too long (100 > 79 characters)

Comment last updated at 2019-06-11 07:37:36 UTC

@jorisvandenbossche jorisvandenbossche changed the title Issue 23868 import errors ERR: include original error message for missing required dependencies Jun 7, 2019
@jreback jreback added this to the 0.25.0 milestone Jun 8, 2019
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments, ping on green.


if missing_dependencies:
raise ImportError(
"Missing required dependencies {0}".format(missing_dependencies))
raise ImportError("Unable to import required dependencies:\n" + "\n".join(missing_dependencies))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do this like

raise ImportError("Unable to import required dependencies:\n" 
                              "\n".join(missing_dependencies))

since inside the parens you don't need the +

Copy link
Contributor Author

@DanielFEvans DanielFEvans Jun 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That gives a different output - the current one joins the dependencies with \n:

Unable to import required dependencies:
a
b
c

Whereas without the "+" it joins them with the entire error message and two newlines:

aUnable to import required dependencies:

bUnable to import required dependencies:

c

@DanielFEvans
Copy link
Contributor Author

@jreback - All green and good to go.

@jreback
Copy link
Contributor

jreback commented Jun 10, 2019

looks good, can you merge master and ping on green.

@jorisvandenbossche
Copy link
Member

Second try ;)

Thanks @DanielFEvans !

@jorisvandenbossche jorisvandenbossche merged commit ea06f8d into pandas-dev:master Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shouldn't the try: __import__ in __init__ re-raise original exception?
7 participants