You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
next = lambda o: o.next()
from cStringIO import StringIO as BytesIO
basestring = str
from io import BytesIO
def execfile(fn, globs=None, locs=None):
if globs is None:
globs = globals()
if locs is None:
locs = globs
exec(compile(open(fn).read(), fn, 'exec'), globs, locs)
tries to provide some standard Python2 functions when run with Python3, but is broken if other packages already do the same, but for a different subset. Specifically, if another package already defined (in Python3) builtins.basestring = str, the import of cStringIO will fail with an ImportError, and later calls to next will fail too.
This issue caused the cStringIO import error when I imported pandas after importing pyqtgraph on Python 3.4. Pyqtgraph has a python2_3 compatibility module in which builtins.basestring = str is implemented for Python 3. Pandas, during initialization, imports pkg_resources which then throws " ImportError: No module named 'cStringIO' ". For me this means if pyqtgraph and pandas are both imported, pandas should be imported first if possible. That or some kind of check that deletes basestr.
Better yet.... I think I'll just add ImportError to the structure shown above so that the except is triggered when cStringIO isn't found in Python 3.
This needs to utilize sys.version_info or at least handle the ImportError.