Closed swarnak25 closed 6 years ago
Hi! First things first: are there .png
files in the directory (F:)/Trackpy-examoles-master/sample_data/bulk_water/
?
No I made a mistake.It should be (F:)/Trackpy-examples-master/Trackpy-examples-master/sample_data/bulk_water/.How do I set this new path?
import pims
frames = pims.ImageSequence('(F:)/Trackpy-examoles-master/Trackpy-examoles-master/sample_data/bulk_water/*.png', as_grey=True) Traceback (most recent call last):
File "
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")
OSError: No files were found matching that path.
For some reason examples turned into examoles . I correceted that and ran the command but still the same errors are there.
Thanks. I am still confused. What directory are you in when you run the command? (Use %pwd
.) And in what directory is the walkthrough notebook located? I ask because this looks like more of a problem with where the files are (and where you are) in your own computer's filesystem.
I get what you are saying.But I am unable to fix it.I ran %pwd.I got this. In[22]: %pwd Out[22]: 'C:\Users\swarnak\TrackingWithPython\trackpy-examples-master\sample_data\bulk_water' I have checked and put it in that folder.
frames = pims.ImageSequence('(C:)/Users/swarnak/TrackingWithPython/trackpy-examples-master/sample_data/bulk_water/*.png', as_grey=True) Traceback (most recent call last):
File "
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")
OSError: **No files were found matching that path.**
This was supposed to be simple.What am I missing?
Thanks for trying to help me out.
No problem! pims just uses glob() to find the files, which is a standard part of Python. So you should be able to do
from glob import glob print(len(glob(your_pattern)))
where your_pattern is a path ending in *.png like the ones you’ve been using. If you can get something other than zero length, then pims.open(your_pattern)) will work.
I am not a Windows user so I can’t help much with that. But I can say that this doesn’t look like a pims problem; you need to research how to specify paths in Python on Windows.
On Mar 4, 2018, 3:09 AM -0800, swarnak25 notifications@github.com, wrote:
Thanks for trying to help me out.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/soft-matter/trackpy-examples/issues/47#issuecomment-370220462, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AC2NbarmVrq0Khy-Y0oNywvb36ZdFd8Rks5ta8t6gaJpZM4SSIRR.
from glob import glob
print(len(glob('(C:)/Users/swarnak/TrackingWithPython/trackpy-examples-master/sample_data/bulk_water/*.png'))) 0
If you look in the file browser do the pngs exist?
I suggest starting from (C:)/Users
and using os.path.exists
(https://docs.python.org/2/library/os.path.html#os.path.exists) or Path.exists
(https://docs.python.org/3/library/pathlib.html#pathlib.Path.exists) if you are on python3 to make sure each layer of the path is correct and exists.
Hello Nathan,I have fixed the problem by putting a small r in front of the string representing the file name.
That’s great! Sorry we don’t have more experience with the basics on Windows.
frames = pims.ImageSequence('../sample_data/bulk_water/.png', as_grey=True) When I try to run this the following error shows- File "", line 1, in
frames = pims.ImageSequence('(F:)/Trackpy-examoles-master/sample_data/bulk_water/ .png', as_grey=True)
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)
File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")
OSError: No files were found matching that path.