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

Cannot access imported submodules in sympy.core #12115

Closed
gerritholl opened this issue Jan 31, 2017 · 3 comments
Closed

Cannot access imported submodules in sympy.core #12115

gerritholl opened this issue Jan 31, 2017 · 3 comments

Comments

@gerritholl
Copy link

When importing a submodule from sympy.core using import sympy.core.module, any attempt to access the imported module results in AttributeError, as shown below. Using from sympy.core import module does work:

In [482]: import sympy.core.function

In [483]: sympy.core.function
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-483-7a4eba796946> in <module>()
----> 1 sympy.core.function

AttributeError: module 'sympy.core.core' has no attribute 'function'

In [484]: from sympy.core import function

In [485]: function
Out[485]: <module 'sympy.core.function' from '/dev/shm/gerrit/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/function.py'>
@gerritholl
Copy link
Author

This happens because sympy/__init__.py has a from .core import *, this imports sympy.core.core to replace sympy.core, which makes the other sympy.core.* modules not directly accessible.

skirpichev added a commit to skirpichev/diofant that referenced this issue Feb 1, 2017
In [1]: import diofant.core.function

In [2]: diofant.core.function
Out[2]: <module 'diofant.core.function' from
'/home/sk/src/diofant/diofant/core/function.py'>

Closes sympy/sympy#12115
skirpichev added a commit to skirpichev/diofant that referenced this issue Feb 1, 2017
In [1]: import diofant.core.function

In [2]: diofant.core.function
Out[2]: <module 'diofant.core.function' from
'/home/sk/src/diofant/diofant/core/function.py'>

Closes sympy/sympy#12115
@Smit-create
Copy link
Member

Currently:

>>> import sympy.core.function
>>> sympy.core.function
<module 'sympy.core.function' from '/home/smit/Smit Lunagariya/sympy/sympy/core/function.py'>

@oscarbenjamin Is this issue fixed?

@oscarbenjamin
Copy link
Collaborator

Yes, this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants