File Uploader and OCR

Excellent, thanks, one step nearer!

  File "D:\Progs\WPy64-3770\python-3.7.7.amd64\lib\site-packages\PIL\Image.py", line 2131, in save
   fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/preview.png'

I’m thinking WinPython should be mapping /tmp on to %USERPROFILE%\AppData\Local\Temp?

Okay, this is basically a bug - I need to fix my code so it detects when a system is Linux or Windows. You can get it working by modifying settings.py file - on your system it should be in the python\lib\site-packages\rest_uploader folder. Just define your temp folder path there. While you’re modifying it, you can change the name of the default Joplin Notebook where the program dumps newly added files.

After you copy the files over, before you run the command prompt. Did you register the package using winpython control panel.exe? You need to do this or else it wont run correctly.

Didn't know I had to. - how do I do that?

Just run ‘winpython control panel’, select the advanced tab and register register distribution. Thats it.

One thing to note, if you update winpython to a new version, don’t forget to unrevister the old version first.

Oh shoot - WinPython Control Panel.exe doesn’t run when I double click on it.

Odd, but i know it takes a few seconds to load.

@sttrebo

It just flashes a tiny blue circle (I think, it’s so fast difficult to see it)

You say if I don’t register the package it won’t run correctly. What will it do or won’t do that it should?

And has this got anything to do with the fact that it doesn’t work in a Powershell window, it has to be in the WinPython Command Prompt.exe’s window.

@kellerjustin

Changing settings.py TEMP_PATH = “/tmp/” to “D:\Tmp” gives an EOL error, had to remove the last back slash and then WOW there it was, thanks a lot for your help with this.

Just one thing last thing though the PDF is three pages and all were OCR’d ok but the ‘rendered view’ only showed the first page, is that by design?

If you dont register the package then the search path in the environment wont get updated with the path to the python directories so your python code wont run. Registering it like this does the same thing as if you installed python normally. What version OS are you running and which winpython did you get, the ‘cod’ or the ‘dot’ version?

Windows 10 home Version 1909 build 18363.778. The ‘dot’ as carefully described in message posted 7 hrs ago which shows that I PIP installed it. Does that make a difference?

Oops, crap sorry i missed that. You need the file Winpython64-3.7.7.0.exe . This gives you the full python distribution. Its a big download, but it gives you the works.

Glad you got it working! Yes, by design it only renders a preview of the first page of the PDF.
Thanks

@sttrebo Why do I need the full Python distribution? rest_uploader is uploading now

@kellerjustin Just wondering why you chose to set the source by a command line parameter and the destination by an ini file?

Full distribution gives you all of the libs and related utilities. Depends on what you need. For me its just easier so i dont have to think about it.

Ha, well the settings.py file existed before I added command line args and options. Indeed the destination notebook would make more sense as a command line option. Next version. Thanks, I appreciate the feedback.

@kellerjustin It would be nice to have choice. Both in the settings file but overridden by command line if present?

@sttrebo. I need the absolute minimum to allow rest_uploader to work. Don’t want to carry around unnecessary stuff on my USB flash drive. Whole different ball game for portable apps.

good point, but outside my use scenario so I can’t be much help there. but it does give me something to experiment with a bit when i get the time. good luck anyway…