Permission error when running from browser
See original GitHub issueHi, basically I have created a script that launches Ocrmypdf.
$c = ('ocrmypdf -l lav --rotate-pages --pdf-renderer tesseract --output-type pdf --sidecar output.txt input.pdf output.pdf');');
exec($c, $output);
print_r($output)
When I try to call the PHP script from the server itself: php ocr.php I get the intended result.
However, when I try to open it and run from browser, I got the following permission error:
Traceback (most recent call last):
File "/usr/local/bin/ocrmypdf", line 7, in <module>
from ocrmypdf.__main__ import run_pipeline
File "/usr/lib/python3.6/site-packages/ocrmypdf/__init__.py", line 3, in <module>
import pkg_resources
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 646, in _build_master
ws = cls()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 639, in __init__
self.add_entry(entry)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 695, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2019, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2432, in from_location
py_version=py_version, platform=platform, **kw
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2772, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2397, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2565, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1467, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1463, in get_metadata
value = self._get(self._fn(self.egg_info, name))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1572, in _get
with open(path, 'rb') as stream:
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/ruffus-2.6.3-py3.6.egg-info/PKG-INFO'
/usr/local/bin/ocrmypdf
cat /usr/local/bin/ocrmypdf
#!/usr/bin/python3.6
import re
import sys
from ocrmypdf.__main__ import run_pipeline
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(run_pipeline())`
OS: Centos 7.
I’m aware that this may not be strictly OCRMYPDF related issue. But it is quite strange that I continue to get this error even when (for testing purposed) did CHMOD/CHOWN whole Python directory to more open permissions. My initial impression is that that some of those packages require higher user access?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Fix “Access Denied, You Don't Have Permission To Access on ...
The “Access Denied” error appears when your browser uses different proxy settings or VPN instead of what's really set on your Windows 10...
Read more >What Is the 403 Forbidden Error and How to Fix It (8 Methods ...
A common cause of these errors is the file or folder permission settings, which control who can read, write, and execute the file...
Read more >Permission denied if reading Location object property
This article provides many methods for you to solve the Permission denied error message that occurs if you read properties of the Location ......
Read more >Download Failed - Insufficient Permissions Error in Chrome
Download Failed - Insufficient Permissions error in Google Chrome occurs due to the browser being unable to write to its default save location....
Read more >Error: Permission denied to access property "x" - JavaScript
The JavaScript exception "Permission denied to access property" occurs when there was an attempt to access an object for which you have no ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It should be fine for an intranet, just not a space where people could deliberately try to break it.
Temporary storage usage is linear with the number of pages in the PDF so you can usually handle hundreds of pages before that is an issue.
On Nov 21, 2017 07:42, “Gugols” notifications@github.com wrote:
I’ll close the issue now since the main concern seemed to be a platform configuration issue. If you have further related questions feel free to reopen it.