I want to load and run the wrds library in DataSpell. I used pip to install version 3.1.6.
The wrds library works like a charm in PyCharm and Spyder.
However, when using DataSpell, I get the below error. I use the same Anaconda interpreter for all three (Spyder 5.4.3, PyCharm, Dataspell). I also deleted all files from the .idea folder in my project folder. And nothing works.
It is annoying, because DataSpell works better than PyCharm in scientific mode and Spyder is kinda feature poor.
import os
import wrds # https://matteocourthoud.github.io/post/wrds/
Traceback (most recent call last):
File "/home/martien/.local/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-254b32a46b05>", line 1, in <module>
import wrds # https://matteocourthoud.github.io/post/wrds/
^^^^^^^^^^^
File "/home/martien/.local/share/JetBrains/Toolbox/apps/DataSpell/ch-0/233.13135.105/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/../../wrds.py", line 21, in <module>
if os.name=='nt':
^^
NameError: name 'os' is not defined
Maybe it has to do with this line which appears at the top of the console when I run these two import commands (import os and import wrds):
/home/user_me/.local/share/JetBrains/Toolbox/apps/DataSpell/ch-0/233.13135.105/plugins/python-ce/helpers/pydev/pydevconsole.py
Here is the help info of DataSpell:
DataSpell 2023.3.2
Build #DS-233.13135.105, built on December 21, 2023
Licensed to
Subscription is active until
For educational use only.
Runtime version: 17.0.9+7-b1087.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-87-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
python.scientific.always_use_sci_view=true
python.scientific.show_help_window=false
editor.minimap.enabled=true
Non-Bundled Plugins:
com.github.copilot (1.4.8.4188)
nl.rubensten.texifyidea (0.9.2)
Current Desktop: X-Cinnamon
Here is the help info of PyCharm:
PyCharm 2023.3.2 (Professional Edition)
Build #PY-233.13135.95, built on December 20, 2023
Licensed to
Subscription is active until
For educational use only.
Runtime version: 17.0.9+7-b1087.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-87-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Non-Bundled Plugins:
com.github.copilot (1.4.5.4049)
Current Desktop: X-Cinnamon
The magical world of JetBrains:
import wrdsreferred to a same-namedwrds.pyfile higher up in the project tree.I removed the
.ideafolder at that higher level and opened the working folder at the proper level of my project tree.