GithubHelp home page GithubHelp logo

OrderedDict bug in 4.1.1 about pyq HOT 9 CLOSED

kxsystems avatar kxsystems commented on June 30, 2024
OrderedDict bug in 4.1.1

from pyq.

Comments (9)

abalkin avatar abalkin commented on June 30, 2024

@kaizeng - what python version are you using?

Please provide the output of pyq --versions command.

from pyq.

kaizeng avatar kaizeng commented on June 30, 2024

@abalkin Thanks very much for your very prompt reply. Here is the information:

$ pyq --version
Python 2.7.12 :: Anaconda custom (64-bit)

from pyq.

abalkin avatar abalkin commented on June 30, 2024

@kaizeng - sorry, I asked for pyq --versions with an s at the end. This is a pyq specific option that print more information than just --version. Also, what are the versions of scipy and statsmodels?

from pyq.

kaizeng avatar kaizeng commented on June 30, 2024

@abalkin - sorry i misread it. Here is the pyq version:

$ pyq --versions
PyQ 4.1.1
NumPy 1.11.2
KDB+ 3.3 (2016.02.02) l64
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]

and

>>> scipy.__version__
'0.18.1'

and

>>> statsmodels.__version__
'0.8.0'

from pyq.

abalkin avatar abalkin commented on June 30, 2024

@kaizeng - I was able to reproduce your issue. We will fix it in the next release. Meanwhile, please try the following workaround:

import pyq
del pyq.lazy_converters['collections']
from statsmodels.compat.collections import OrderedDict

Check that the conversion works:

>>> pyq.K(OrderedDict([('a',1)]))
k('(,`a)!,1')

from pyq.

kaizeng avatar kaizeng commented on June 30, 2024

@abalkin Thank you very much! I really appreciate your help! The workaround is working perfectly in the meantime!

from pyq.

abalkin avatar abalkin commented on June 30, 2024

I was able to reproduce this issue without statsmodels by simply creating a "compat" directory

compat/
    __init__.py
    collections.py

with an empty __init__.py and the following line in collections.py:

from collections import OrderedDict

With this setup,

$ pyq
Python 2.7.13 (default, Jun 13 2017, 14:40:28)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from compat.collections import OrderedDict
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/a/.virtualenvs/d/lib/python2.7/site-packages/pyq/__init__.py", line 774, in __import__
    m = _imp(name, globals, locals, fromlist, level)
  File "compat/collections.py", line 2, in <module>
    from collections import OrderedDict
  File "/Users/a/.virtualenvs/d/lib/python2.7/site-packages/pyq/__init__.py", line 777, in __import__
    _c.update((getattr(m, cname), conv) for cname, conv in pairs)
  File "/Users/a/.virtualenvs/d/lib/python2.7/site-packages/pyq/__init__.py", line 777, in <genexpr>
    _c.update((getattr(m, cname), conv) for cname, conv in pairs)
AttributeError: 'module' object has no attribute 'OrderedDict'

I feel this is a bug in statsmodels rather than pyq because adding

from __future__ import absolute_import

at the top of the compat/collections.py file fixes the problem.

from pyq.

abalkin avatar abalkin commented on June 30, 2024

The issue has been fixed in the third party code. See statsmodels/statsmodels#3976.

from pyq.

kaizeng avatar kaizeng commented on June 30, 2024

@abalkin Thanks a lot for the updates! I really appreciate your help!

from pyq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.