Skip to content

Replace str::replace hack for getting module name from ImportError in __init__.py #43013

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 2 commits into from
Aug 18, 2021

Conversation

a2435191
Copy link
Contributor

No description provided.

@simonjayhawkins simonjayhawkins added the Refactor Internal refactoring of code label Aug 16, 2021
@jreback jreback added this to the 1.4 milestone Aug 16, 2021
@jreback jreback added the Build Library building on various platforms label Aug 16, 2021
@jreback
Copy link
Contributor

jreback commented Aug 16, 2021

this looks fine, i doubt we actually test this line, can you confirm that this prints a nice message

@a2435191
Copy link
Contributor Author

Like this?

Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...     import mymoduleisntloaded
... except ImportError as e:
...     module = e.name
...     raise ImportError(
...             f"C extension: {module} not built. If you want to import "
...             "pandas from the source directory, you may need to run "
...             "'python setup.py build_ext --force' to build the C extensions first."
...     ) from e
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ModuleNotFoundError: No module named 'mymoduleisntloaded'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ImportError: C extension: mymoduleisntloaded not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.

@jreback
Copy link
Contributor

jreback commented Aug 17, 2021

can you merge master just to make this this didn't affect anything.

@jreback jreback merged commit df8f428 into pandas-dev:master Aug 18, 2021
@jreback
Copy link
Contributor

jreback commented Aug 18, 2021

thanks @2435191

feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants