GithubHelp home page GithubHelp logo

Comments (8)

FYJNEVERFOLLOWS avatar FYJNEVERFOLLOWS commented on August 23, 2024 1

@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.

a4fr avatar a4fr commented on August 23, 2024

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.

city535364 avatar city535364 commented on August 23, 2024

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.

oevl avatar oevl commented on August 23, 2024

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.

a4fr avatar a4fr commented on August 23, 2024

You right. Now i do new commit

from ocrspace.

FYJNEVERFOLLOWS avatar FYJNEVERFOLLOWS commented on August 23, 2024

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.

ErikBoesen avatar ErikBoesen commented on August 23, 2024

@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.

ErikBoesen avatar ErikBoesen commented on August 23, 2024

Glad to hear it! Don't hesitate to reach out with any further feedback :)

from ocrspace.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.