Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

On python 3.5 error is NameError: name 'basestring' is not defined #21

Open
lalat-das opened this issue Aug 13, 2017 · 3 comments
Open

Comments

@lalat-das
Copy link

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

@RPDiep
Copy link

RPDiep commented Nov 21, 2017

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.

@moenka
Copy link

moenka commented Feb 7, 2018

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.

@patsevanton
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants