procfs
procfs copied to clipboard
On python 3.5 error is NameError: name 'basestring' is not defined
I just downloaded it and tried to run on the python 3.5 interpreter. Following us the detailed error . And it is the same error which appear for every command.
proc.loadavg Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.5/dist-packages/procfs-0.5.0-py3.5.egg/procfs/core.py", line 129, in getattr File "/usr/local/lib/python3.5/dist-packages/procfs-0.5.0-py3.5.egg/procfs/core.py", line 152, in _handle_file File "/usr/local/lib/python3.5/dist-packages/procfs-0.5.0-py3.5.egg/procfs/core.py", line 165, in _call_file_handler File "/usr/local/lib/python3.5/dist-packages/procfs-0.5.0-py3.5.egg/procfs/core.py", line 88, in init File "/usr/local/lib/python3.5/dist-packages/procfs-0.5.0-py3.5.egg/procfs/core.py", line 30, in init NameError: name 'basestring' is not defined
basestring
is removed in python 3:
https://docs.python.org/3.0/whatsnew/3.0.html
The builtin basestring abstract type was removed. Use str instead. The str and bytes types don’t have functionality enough in common to warrant a shared base class. The 2to3 tool (see below) replaces every occurrence of basestring with str.
Replacing basestring
with str
in core.py
fixes this problem, but I don't know yet whether or not this introduces other issues.
Can you please upload a 5.1 version to pypi where this fix is integrated? From the source code it looks like you only test for strings, never bytes (which would need a decode() step anyway). Also having this on pypi will give you more feedback on this topic then not having it on pypi.
python3 -V
Python 3.5.2
print(proc.sys.vm.overcommit_memory)
if proc.sys.vm.overcommit_memory != '100':
logging.info("Informational message")
NameError: name 'basestring' is not defined