RuntimeError: Unable to open shape_predictor_68_face_landmarks.dat? - python

I´ve made a project with python OpenCV, and used the shape_predictor_68... a .dat file.
Now when I build the project with cx_freeze, everything does right, but when I run the app build, it shows a error.

I am also facing the same issue but after some search, I get to know my shape_predictor_68_face_landmarks.dat is not updated or correct so I replace it with another and issue resolved, the link for the new shape_predictor_68_face_landmarks.dat file is
https://github.com/AKSHAYUBHAT/TensorFace/blob/master/openface/models/dlib/shape_predictor_68_face_landmarks.dat
replace the new file with older one.

Referring the solution to a similar issue here
If you are getting this error:
RuntimeError: Unable to open /home/lyz/openface-master/demos/web/../../models/dlib/shape_predictor_68_face_landmarks.dat
You probably haven't downloaded dlibs models properly, perform Step 4 from https://cmusatyalab.github.io/openface/setup/ again. In short, cd into your openface library and run
./models/get-models.sh
Also, I can't tell how you are running this but it could also be a case that the library may not be correctly imported in your current venv - where your interpreter is.

Install dlib correctly and just paste this .dat file in the same working directory as your code is present and try to run the code.
The link is
http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
You can find the .dat file here after extracting a WinZip file that can be downloaded from the dlib.net website.

Related

Xcode swift iOS project gives "usr/bin/python no such file or directory" error when try to build project

I am experiencing the problem after the macOS 12.3 Monterey update. I get the following error when I want to run the project. There is a code looking for "/usr/bin/python" in the project, but I couldn't find which part of code/framework/script etc. is looking for that path in my project. There is no problem in the path "usr/local/bin/python", but my project gives the error that I cannot find the path to "usr/bin/python". When I looked there, "/usr/bin/python3" exist. Unfortunately, since it is the system folder, I cannot make any changes(add or remove files or links) in that folder.
First you need to install python2. This can be done according to the guide
Then it is necessary in the file
{PATH_TO_PROJECT}/scripts/licenses/importLicensePods.py
replace the first line with #!/usr/bin/python to #!/usr/bin/local/python

"No such file or directory"

Hi,
I have a library called BioPython for Bioinformatics with several files.
I am unable to retrieve the file and it gives me the above errors.
My Python 3.8.2 IDE shell is in documents and my BioInformatics Library file is in documents as well. I think there is something wrong with the pathway of my package for python3.8 but I am not sure. Can someone guide me towards the right direction?
Keeping python shell and the file you want to access in the same directory does not matter. The only thing that matters is that your working working directory must have the file in order to import it without specifying the complete path.
Well, the error clearly shows that the name of the file has been either changed or it might have been moved to some other directory. It is better to specify the full path.

How to Give Python Permission to Write Files

I'm learning Python and don't quite have the vocabulary to describe this. However, I can't seem to save files created in Python to my Window10 computer. I discovered this while seeking a help to try to get a file to save in Pandas. I then discovered the same problem when creating a db using SQLITE3 the script seemed to have fun but no database files appeared.
Does anyone know how to fix this? FYI I've got a dual boot Ubuntu machine, I can save files via Python in Ubuntu but really need it to work on my windows machine too.
I am running python via Jupyter Notebook.
I had to make a couple changes to the code snipped that you linked in order to get this to work.
A difference between windows and linux is the file path deliminator is a forward slash:
df.to_csv("tests/ysi_test_files/filehere.csv", index = False)
If you want a hard absolute path to a file, then do something like:
df.to_csv('C://Folder//myfilename.csv', index=False)
Again, if you copy the folder path from a windows folder you will get the backslashes instead of forward slashes. You will need to change those in your code to save the file:
C:\Users\myuser\Desktop\python\
to
C:/Users/myuser/Desktop/python/
If you are running the python script from command prompt then right click on it and run as administrator should solve the issue.

CX_Freeze exe references old pyc file?

I have built a Cx Freeze exe from python code. Code worked fine. I recently modified one .py file and rebuilt the exe. Dragged the entire build directory over to another computer for use and it looked as though it was using an older version of the code. Rebuilt, retried. Same thing.
Ended up moving over the new updated python file to the other computer and the exe starts working correctly.
Looks like the exe is not truly independent of the uncompiled code?
Have any of you seen this? Is it a bug? Is there a fix?
thanks!!
I had this same issue and found some troubleshooting steps to fix the problem:
Change the version number in setup.py.
Change the name of the init.py (or whatever your first file is called.) Change the name in setup.py to match.
Copy your files into a separate folder along with the setup.py and rerun there.

Py2Exe won't successfully compile the pygame.font module on Python 3

I made a program using the pygame module on Python 3 and it works fine within python, but when I try to compile is using py2exe it won't run. (I just get the programName.exe has stopped working error upon trying to run it).
I managed to narrow down this problem to the pygame.font module as when I comment all the lines that use that module everything works fine. I tried to forcefully include the module using the -i flag in py2exe, but it doesn't appear to change anything...
What am I doing terribly wrong?
Edit: I managed to get the reason of the program not working - it crashes as it can not find build\executable.exe\pygame\freesansbold.ttf . What I don't understand is why the hell is the pygame folder supposed to be located in a folder with the name of my executable? (Of course, I can not create a folder with the same name as an existing file in the directory). If anyone has a clue to how to fix it, please help!!
I had the same problem using cx_Freeze, so hopefully this will work for you as well. Open up your pygame package folder. It should be C:\Python34\Lib\site-packages\pygame. There should be a True Type Font File titled freesansbold.ttf. Copy that file then open the folder containing your exe program. There should be a zipped file called library. Open it up and go to the pygame folder inside the zipped file. Should look something like this \build\exe.win32-3.4\library.zip\pygame. And just paste the freesansbold.ttf file in that folder and it should work perfectly.
I managed to find a way! By including -l library.zip argument in the build_exe command and then following the instructions given by DeliriousSyntax in the answer above I managed to get it to work!

Categories