I´m trying to use pytesser but I´m getting this error:
IOError: [Errno 2] No such file or directory:
I´m using a mac machine and the code I´m using is this:
from pytesser import *
import os
im = Image.open('/screenshot.png')
text = image_to_string(im)
print text
Thanks in advance!
Related
I am running Deepface Analyze on images and getting below error, please assist.
OSError: Unable to open file (truncated file: eof = 49623168, sblock->base_addr = 0, stored_eof = 538771776)
enter image description heretrying to use cdll.LoadLibrary function in Python 3.11.0 in Ubuntu 22.04.1 LTS 64-bit.
Below error occured. If you have faced this kind of issue please help.
Traceback (most recent call last):
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/main.py", line 10, in <module>
main()
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/main.py", line 5, in main
handler = DTKVideoStreamHandler()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/Services/Implements/DTKVideoStreamHandler.py", line 28, in _init_
self.__DTKLPR = cdll.LoadLibrary(DTKLPR5Lib)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/_init_.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/_init.py", line 376, in __init_
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libDTKLPR5.so: cannot open shared object file: No such file or director
Thanks in advance...
In windows 10 64-bit. There is some kind of solution with using
os.add_dll_directory(full_path)
before calling
self.__DTKLPR = cdll.LoadLibrary(DTKLPR5Lib)
but this solution is not working in Ubuntu. Because add_dll_directory is supposed to only windows. (Based on information in its documentation)
I'm trying to change the directory to the folder that contains the folder I'm in.
That is, I'm in /Users/ethanfuerst/Documents/Coding/mpgdata and I'm trying to go back to /Users/ethanfuerst/Documents/Coding and access a text file in the Coding folder.
When I run this code:
import os
print(os.getcwd())
os.chdir('Users/ethanfuerst/Documents/Coding')
I get this output and error
/Users/ethanfuerst/Documents/Coding/mpgdata
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-19-6c6ee01785f6> in <module>
1 import os
2 print(os.getcwd())
----> 3 os.chdir('Users/ethanfuerst/Documents/Coding')
FileNotFoundError: [Errno 2] No such file or directory: '\u2068Users/ethanfuerst/Documents/Coding'
Does anyone know why this could be the case?
Edit: forgot to mention I am on a Mac
Try using C:\ in front of Users. If that does not work, try using .. in the directory specification to go back one directory.
Use double quotes os.chdir("Users/ethanfuerst/Documents/Coding") instead of os.chdir('Users/ethanfuerst/Documents/Coding')
I'm trying to parse text from pdf file. while I was doing tutorial of how to PyPDF2 I got the following error. I did the search for an answer but ended up finding none. Any Help will be greatly appreciated.
Traceback (most recent call last):
File "D:/text_recognizer/main.py", line 4, in <module>
inputStream = PyPDF2.PdfFileReader(input)
File "D:\KimKanna's Class\python27\lib\site-packages\PyPDF2\pdf.py", line 1084, in __init__
self.read(stream)
File "D:\KimKanna's Class\python27\lib\site-packages\PyPDF2\pdf.py", line 1689, in read
stream.seek(-1, 2)
IOError: [Errno 22] Invalid argument
here is fullcode
import PyPDF2
with open(".\\pdf\\test_sample.pdf","rb") as input:
inputStream = PyPDF2.PdfFileReader(input)
In my case the .pdf I wanted to open is empty and not closed from previous python code in powershell(cmd prompt). So, when I tried to delete those files it says 'Close the file and try again'. (that was my "AHaa" moment)
So I stopped the py.exe from my Windows task manager and deleted those empty, not closed files. Then I run the same code with another files, It worked fine.. :)
Error
IOError: [Errno 2] No such file or directory: 'nik7.jpg'
I am trying to read an image but get the above error.
Code:
from PIL import Image
pil_im=Image.open('C"\Users\nikhil\Desktop\nik7.jpg' )
Two things:
You're missing a colon
\ escapes the next character, so either use two (double escape): \\, or use the Unix-style / which works on Windows too:
pil_im = Image.open('C:/Users/nikhi/Desktop/nik7.jpg')