You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried the other applicable steps from the Troubleshooting Guide
Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
I import a module and then call a class of this module. This simply creates a AttributeError in Spyder but not outside. This occurs both when running a script that calls this object, or when doing it directly in the terminal.
This module is not public, but I will explain the situation here. Inside the project there is a folder called core. Inside this folder, there are several scripts, including one called count_lc.py, and an __init__.py file. Inside count_lc.py there is the class CountLC() that we want to call. Inside __init__.py, we can find imports such as from .count_lc import CountLC.
In other parts of the project, the CountLC object is called as follows:
This works fine when running the scripts that call this directly on the terminal, or within ipython console as well (as in the image above).
However, this fails when running scripts in spyder, or even within spyder Ipython console:
As you can see, in spyder it works when calling directly ec.CountLC, but not ec.count_lc.CountLC, while outside of spyder both work good.
Note: If the imports are done in the following way, it works as expected:
Is there something fundamentally wrong with the way the class is imported in this package? Even if there is, the fact that it works outside of spyder but not in spyder probably denotes an issue to be solved with Spyder, right?
What steps reproduce the problem?
Having a package with the imports as explained above
Running the ec.count_lc command after importing ec, as explained above.
What is the expected output? What do you see instead?
See description and images above.
Paste Traceback/Error Below (if applicable)
Traceback (most recent call last):
Cell In[18], line 1
ec.count_lc
AttributeError: module 'eclgrm_tools.core' has no attribute 'count_lc'
Hey @Miguel-LlamasLanza, thanks for reporting. Could you upload a simple code project (i.e. the folder that contains that code) that generates this problem?
Otherwise it'd be hard for us to understand why importing it inside Spyder is different from doing it outside of it.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)spyder --reset
Problem Description
I import a module and then call a class of this module. This simply creates a AttributeError in Spyder but not outside. This occurs both when running a script that calls this object, or when doing it directly in the terminal.
This module is not public, but I will explain the situation here. Inside the project there is a folder called
core
. Inside this folder, there are several scripts, including one calledcount_lc.py
, and an__init__.py
file. Insidecount_lc.py
there is the classCountLC()
that we want to call. Inside__init__.py
, we can find imports such asfrom .count_lc import CountLC
.In other parts of the project, the
CountLC
object is called as follows:This works fine when running the scripts that call this directly on the terminal, or within ipython console as well (as in the image above).
However, this fails when running scripts in spyder, or even within spyder Ipython console:
As you can see, in spyder it works when calling directly
ec.CountLC
, but notec.count_lc.CountLC
, while outside of spyder both work good.Note: If the imports are done in the following way, it works as expected:
Is there something fundamentally wrong with the way the class is imported in this package? Even if there is, the fact that it works outside of spyder but not in spyder probably denotes an issue to be solved with Spyder, right?
What steps reproduce the problem?
ec.count_lc
command after importingec
, as explained above.What is the expected output? What do you see instead?
See description and images above.
Paste Traceback/Error Below (if applicable)
Versions
Dependencies
The text was updated successfully, but these errors were encountered: