Fix Python – ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there

I have a situation very much like the one at Error “ImportError: DLL load failed: %1 is not a valid Win32 application”, but the answer there isn’t working for me.
My Python code says:
import cv2

But that line throws the error shown in the title of this question.
I have OpenCV installed in C:\lib\opencv on this 64-bit machine. I’m using 64-bit Pyt….

Fix Python – Where is Python’s sys.path initialized from?

Where is Python’s sys.path initialized from?
UPD: Python is adding some paths before refering to PYTHONPATH:
>>> import sys
>>> from pprint import pprint as p
>>> p(sys.path)

Fix Python – Expand Python Search Path to Other Source

I have just joined a project with a rather large existing code base. We develop in linux and do not use and IDE. We run through the command line. I’m trying to figure out how to get python to search for the right path when I run project modules. For instance, when I run something like:

I get
ImportError: no module named ….

Fix Python – How to get the parent dir location

this code is get the templates/blog1/page.html in
path = os.path.join(os.path.dirname(__file__), os.path.join(‘templates’, ‘blog1/page.html’))

but i want to get the parent dir location:
| |—
| |—templates
| |——–blog1
| |——-page.html

Fix Python – How can I extract the folder path from file path in Python?

I would like to get just the folder path from the full path to a file.
For example T:\Data\DBDesign\DBDesign_93_v141b.mdb and I would like to get just T:\Data\DBDesign (excluding the \DBDesign_93_v141b.mdb).
I have tried something like this:
existGDBPath = r’T:\Data\DBDesign\DBDesign_93_v141b.mdb’
wkspFldr = str(existGDBPath.split(‘\\’)[0:-1])

Fix Python – Python list directory, subdirectory, and files

I’m trying to make a script to list all directory, subdirectory, and files in a given directory.
I tried this:
import sys, os

root = “/home/patate/directory/”
path = os.path.join(root, “targetdirectory”)

for r, d, f in os.walk(path):
for file in f:
print(os.path.join(root, file))

Unfortunatly it doesn’t work properly.
I get all the ….