/usr/lib/python3/dist-packages/pyocr/util.py is in python3-pyocr 0.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/usr/bin/env python
import os
def to_unicode(string):
if hasattr(string, 'decode'):
return string.decode('utf-8')
return string
def is_on_path(exec_name):
"""
Indicates if the command 'exec_name' appears to be installed.
Returns:
True --- if it is installed
False --- if it isn't
"""
for dirpath in os.environ["PATH"].split(os.pathsep):
path = os.path.join(dirpath, exec_name)
if os.path.exists(path) and os.access(path, os.X_OK):
return True
return False
|