Constant "ImportError: No module named..." - python

I'm kind of new on Python, and I'm trying to do some things but I keep having this "ImportError: No module named ..." error (in different cases) Now I'm trying a tutorial of automated testing with Python but in the first example it didn't run because it give me the same kind of error "ImportError: No module named mobydick".
It's important to say that all the times that I got that error (like four or five different cases) I checked and the modules that I was referring are there, I think this could be something about configuration maybe that I can`t get now, I have been looked a lot on Google and here on Stackoverflow and haven't find a solution yet.
The structure of the tutorial code (it comes with the tutorial, it's supposed to work, is this:
code
-mobydick
--_init_.py
--word_counter.py
-tests_unittest
--test_unit_test.py
I'm working on Mac environment

Require __init__.py file for every directory.
code
-__init__py
-mobydick
--__init__py
--word_counter.py
-tests_unittest
-__init__py
--test_unit_test.py

Related

python - No module named 'pywidevine.L3'

Have been trying a python script which has required a bunch of additional modules, that I've installed according to the error messages, leading to the next one until I got stuck. The specific error is: "ModuleNotFoundError: No module named 'pywidevine.L3"
Have already installed "pywidevine". Did this on a whim without really knowing what to do when the previous module error message called for "pywidevine.L3.cdm.formats.widevine_pssh_data_pb2", after which this current module error message calling for "pywidevine.L3" comes up. Little to no idea what I'm actually doing or how these things work – only trying to get a script to work.
edit: https://github.com/JockeyJarus/AppleMusic-DownloaderV2
how to use:
python applemusic.py [applemusic link]
The error is correct there is no module called L3 in pywidevine. please refer to the source code of the package repository. Please make edit to your question so that we can know what are you trying to achieve?

Whenever I try to import a python library I always get "ModuleNotFoundError" what do I do?

Whenever I try to import the libraries "beautifulsoup" or "requests" I always get the same error. The error I get looks like this... ModuleNotFoundError: No module named 'bs4'. I already have these libraries installed I just can't seem to figure out what's wrong.
If you look at the image below, I noticed when I use the recommended interpreter I get a problem saying "Import "bs4" could not be resolved from source". However, when I select one of the other Python 3.10.7 interpreters the problem goes away(see second picture). Either way I still get the Module not found error. I was thinking this info might help diagnose the problem I'm having.
I think you need to cross check environmental variable path of python and editor interpreter path
so, may be possible you downloaded that library but it available on another path for that he can't reach out and you get error

Cannot import eurostag.dll into Python

I am new with programming, so it is maybe harder for me to understand but I have the following issue:
I have a script that imports "eurostag.dll", which according to its manual, should work until Python 3.6. (but the manual is not updated, so it may work also with later updates, I assume).\ The issue is that I have Python 3.8. and when running the script I receive the following message:
"Failed to load EUROSTAG library (Could not find module 'D:\Eurostag\eustag_esg.dll' (or one of its dependencies). Try using the full path with constructor syntax.)"
I have tried to move the .dll library where the script is, but nothing changed. I tried also changing the directory with os.chdir, but the same message appears (with the same 'D:\Eurostag\eustag_esg.dll', so the directory was not changed.
Does anybody know if there is any workaround for this?
Thank you!

EtradePythonClient cannot import or find accounts.accounts or markets.markets

I am trying to set up etrade's python api, and I tested it yesterday with no problems. When I ran etrade_python_client.py today, I recieved an error, "no module named accounts.accounts". Same thing with markets.markets. I did nothing different and even redownloaded all python client files to start from square one. I don't know where to begin as the example file worked with no issues previously.

"No Module named..."-error in editor despite code appearing to work

I've been struggling for quite some time trying to import a module from a molder in a separate directory on my computer for a python project. Currently the code seems to work, but Pycharm is still giving me errors that the module cannot be found. Despite this, if I run the code it seems to do what is intended.
What I have is essentially this:
import sys
sys.path.append(r'D:\Progam\bin')
import foo
Where foo is a module found in D:\Progam\bin, and it's warning me that there is no module named foo. Considering how much issue I've for some reason had to get this working I'm hesitant to just ignore the warning if there's some underlying problem
Anyone have any idea what's happening here?
Because the file isn't in your path globally, your IDE isn't recognizing that it is then valid during execution. It would probably be a security issue if it were adding files to its path from potentially unknown code.
You could either add that directory to your path via CMD like so:
set PATH=%PATH%;C:\your\path\here\
Or just ignore the error.
EDIT: Ignore that, I'm being a sleep deprived dumbass. Take a look at:
how to manage sys.path globally in pycharm
(Thought this edit would be slightly more useful than me just deleting my answer)

Categories