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.
Related
I am running Spyder in Linux Ubuntu and am trying to use data saved in a .txt file that is saved in the same directory as the python script I am trying to load it to using numpy's loadtxt function, however every time i try to, an error comes up stating that the file is not found which doesn't make sense as they are both in the same directory.
I am just wondering if anyone knows what this issue could be, other than the file not being in the same directory or the file name being spelt wrong in my code as neither is the case.
Any help would be very much appreciated!
How do I get the full path of the current file's directory?
Yes, I already tried these methods. They all give me the folder that contains Blender.exe
which is D:\program\Blender 2.90
And what I supposed to get is C:\Users\username\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\someAddonFolder right?
Is something changed in version 2.9?
Without the Blender environment, I mean run under normal Python. Methods from that topic all work well.
Did I miss something?
The old way I made the script work is by putting .blend .json .py all together in the same folder.
and refer to the relative path using //
bpy.utils.user_resource('SCRIPTS', "addons")
use this code can get you the path your custom addon you install at.
for me, it's 'C:\Users\Naoki\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons'
found the answer over here:
https://blender.stackexchange.com/questions/20850/how-to-automatically-get-a-add-on-folders-path-regardless-of-os
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.
I am looking to run a file I created in python from a matlab script. I have checked that my python file works if I run it from the python interface. However I have not been able to get my python to run from matlab. The following is the code situation I am in.
In matlab., I have the following code:(My file name is pgcode.py)
! python pgcode.py
and interchangeably I have use this code as well:
system('python pgcode.py')
The error that results in matlab is:
"python: can't open file 'pgcode.py': [Errno 2] No such file or directory"
I have set my PATH directory and I really think this is an issue with setting the path so that I can find the file I have created but I haven't been able to figure out how to do this. I am using windows and Python 2.7.5. Any help is much appreciated. Thanks in advance!
There might be another way to do this, but here are two options.
First replace system('python pgcode.py') with system('pgcode.py'). Make sure that pgcode.py has execute permissions and in on your PATH. If you're using a unix/linux/mac type system, make sure pgcode.py has #!/usr/bin/env python as the first line, that's called a shebang.
Option two, is to use the full path when you call system(pathon /full/path/to/pgcode.py).
Hope that helps.
Your $PATH should control where python comes from, but I don't believe it will control where your pgcode.py comes from - at least, not in the way you're using it now.
You might want to either use a #!/usr/bin/env python and make your script executable, or be very mindful of what directory you're in when you try to python pgcode.py (you can prepend "pwd;" to your python command to see), or specify a full path to pgcode.py.
HTH
I'll preface this question by saying that I've barely used python before, and never before on Mac OS, so I am fully ready to accept that I'm probably doing something rather silly!
I've been sent two python projects, one of which I need to run. When I open the project I'm interested in (in TextWrangler), and run, I get the following error:
context.py:16: ImportError: No module named fetch_command
Well.. fetch_command is a module in the other program, which is in the same directory (/Users/myname) as the program that I am trying to run. The (scant documentation for the applications suggests:
"I wouldn't try installing into your python installation dirs,
I'd install to some home directory or prefix and set up your
PYTHONPATH and PATH (or use virtualenv)"
and so I have tried (and succeeded - I've tested by calling echo $PATH and echo $PYTHONPATH) adding Users/myname to PATH and PYTHONPATH. This did nothing. I then tried adding /Users/myname/other_python_app/src to PATH and PYTHONPATH, but this also hasn't worked. Anyone know what I'm doing wrong..?
Thanks a lot in advance!
Ah, I understand the issue now. It's not that you can't find it in your Python project, but rather in your text editor. There should be a menu entry to set your PYTHONPATH from within TextWrangler (I tried looking for the documentation but the site seems to be down). Oftentimes, these editors don't respect the PYTHONPATH variable or do so only on restart.
This is a bit of a hack in your case, but try adding an empty file __init__.py so Python knows that this directory contains a module.