Comments (8)
@FYJNEVERFOLLOWS Would you mind providing a minimal example of code that causes this problem for you, along with any image files you're using? I'm not able to reproduce this issue on my machine.
I just got the code snippet provided by "Zaargh" and the wrapper provided by you mixed up. The probelm is solved. Thanks for your comment!
from ocrspace.
There is problem in your path. You must change path to 'D:\shot.jpg'
in Windows os. Also you can use method like this text = api.ocr_file(open(path, 'rb'))
from ocrspace.
hello,
I use the following code to run, but it is usually error!
---------------code-----------------------
import os
import ocrspace
here = os.path.dirname(os.path.abspath(file))
image_path = os.path.join(here, 'shot.jpg')
print(image_path)
api = ocrspace.API()
text = api.ocr_file(open(image_path, 'rb'))
print(text)
----------------error--------------------------------------
Traceback (most recent call last):
File "", line 1, in
runfile('D:/2018_3/ai/FT700/ch10/testocrspace.py', wdir='D:/2018_3/ai/FT700/ch10')
File "C:\Users\nhu\Anaconda3\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:\Users\nhu\Anaconda3\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/2018_3/ai/FT700/ch10/testocrspace.py", line 7, in
text = api.ocr_file(open(image_path, 'rb'))
File "C:\Users\nhu\Anaconda3\envs\tensorflow\lib\site-packages\ocrspace\main.py", line 62, in ocr_file
files={filename: f},
NameError: name 'filename' is not defined
from ocrspace.
I fixed this on my Python 2.7 installation on Windows by going to C:\Python27\Lib\site-packages\ocrspace\main.py and changing:
files={filename: f}
to
files={"filename": f}
from ocrspace.
You right. Now i do new commit
from ocrspace.
I use the following code, it cannot work and show the error below every time.
---------------code-----------------------
res = api.ocr_file('myfilepath') # either of these two expressions will cause the error below
res = api.ocr_file(open(r"myfilepath", "rb")) # either of these two expressions will cause the error below
print(res)
----------------error--------------------------------------
File "myocrspace.py", line 11, in
res = api.ocr_file('myfilepath')
File "C:\Users*\AppData\Local\Continuum\anaconda3\lib\site-packages\ocrspace\main.py", line 67, in ocr_file
return self._parse(r.json())
File "C:\Users*\AppData\Local\Continuum\anaconda3\lib\site-packages\ocrspace\main.py", line 51, in _parse
raise Exception(raw['ErrorMessage'][0])
Exception: Parameter name 'filename' is invalid. Valid parameters: apikey,url,language,isoverlayrequired,base64image,iscreatesearchablepdf,issearchablepdfhidetextlayer,filetype,addressparsing,scale,detectorientation,istable,ocrengine,detectcheckbox,checkboxtemplate,checkboxtemplateregex
appreciate any help I may get.
from ocrspace.
@FYJNEVERFOLLOWS Would you mind providing a minimal example of code that causes this problem for you, along with any image files you're using? I'm not able to reproduce this issue on my machine.
from ocrspace.
Glad to hear it! Don't hesitate to reach out with any further feedback :)
from ocrspace.
Related Issues (11)
- Code runs with no errors but doesnt return any text? HOT 12
- Exception: Timed out waiting for results continually comes up HOT 1
- way to use it for local image HOT 5
- Add engine parameter to modify OCREngine payload property HOT 2
- OCREngine 2 and 3 does not work in docker HOT 3
- license?
- Upload to PyPI HOT 1
- Directly return text HOT 2
- Latest version not uploaded to pypy HOT 1
- no base-64 image support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocrspace.