Catch python ‘ImportError’ if import from source directory [duplicate]

ImportError: No module named foo actually means the module foo.py or package foo/__init__.py could not be found in any of the directories in the search path (sys.path list). Since sys.path usually contains . (the current directory), that’s probably what you meant by being in the source directory. You are in the top-level directory of package … Read more

DLL load failed when importing PyQt5

It is because of missing Python3.dll (stub dll, that re-exports Python3x.dll functions, so that one version of extension can work for multiple versions of python). If your Python distro doesn’t bundle python3.dll, you can try one from WinPython (https://winpython.github.io/). At least the 2017/04/01 versions should have it. 1) Download WinPython (‘Zero’ version suffices; must be … Read more

Python package import from parent directory

It all depends on which script you run. That script’s path will be added to python’s search path automatically. Make it the following structure: TestApp/ ├─ testapp/ │ ├─ __init__.py │ ├─ testmsg.py │ ├─ sub/ │ │ ├─ __init__.py │ │ ├─ testprinter.py ├─ README ├─ LICENSE ├─ setup.py ├─ run_test.py Then run TestApp/run_test.py … Read more

ImportError: cannot import name ‘…’ from partially initialized module ‘…’ (most likely due to a circular import)

For future readers, this can also happen if you name a python file the same name as a dependency your project uses. For example: I cannot have a file named retrying.py that is using the retrying package. Assuming I had the retrying package in my project, I could not have a file called retrying.py with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)