unrecognized type basestring

Bug #1636146 reported by Matěj Cepl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pyflakes
Invalid
Undecided
Unassigned

Bug Description

These two lines of the code:

    if isinstance(pk_proc.before, basestring):
                cmd_output += pk_proc.before

will be honored by pyflakes (and flake8) with

    libs/proc.py:443:39: F821 undefined name 'basestring'

which is just wrong. `basestring` is perfectly defined type and this seems like a quite canonical way how to check (in Py2k) whether the variable is either unicode or str.

Revision history for this message
Ian Cordasco (icordasc) wrote :

You seem to be running PyFlakes and Flake8 under python 3. You can verify this by doing `flake8 --version`. basestring is actually *not* defined on Python 3, so if you're writing code for Python 2 (that isn't going to run on Python 3) you should install Flake8 for Python 2 and run it that way too, e.g.,

```
curl -O https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py
python2.7 -m pip install flake8
python2.7 -m flake8 libs/proc.py
```

Changed in pyflakes:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.