PyDev.Debugger icon indicating copy to clipboard operation
PyDev.Debugger copied to clipboard

TypeError: Error when calling the metaclass bases

Open EricSalemi opened this issue 5 years ago • 6 comments

The pydevd_thread_wrappers.py module decorates the Queue class. Somewhere in my code I define the dataBuffer class that derives from the Queue class but when I try to run my script in PyCharm "concurrency diagram" mode Python fails with a weird error:

Importing test library 'RXLibrary' failed: TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str
Traceback (most recent call last):
  File "C:\Users\salemi\Documents\vcs\spark\libraries\RXLibrary.py", line 32, in <module>
    import septentrio.pytest_rxGeneric as rxGeneric
  File "C:\Users\salemi\Documents\vcs\spark\libraries\septentrio\pytest_rxGeneric.py", line 8, in <module>
    import pytest_dataInOut as dataInOut
  File "C:\Users\salemi\Documents\vcs\spark\libraries\septentrio\pytest_dataInOut.py", line 67, in <module>
    class dataBuffer(Queue.Queue):
PYTHONPATH:
  C:\Users\salemi\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\191.7479.30\helpers\pydev
...

As far as I know a decorated class becomes a function and I could understand that Python cannot derive from a function.

How can I solve this problem?

EricSalemi avatar Jul 10 '19 09:07 EricSalemi

It seems that the PyCharm version has things not available in the version on pydevd (there's no pydevd_thread_wrappers.py module in pydevd), so, you should report to PyCharm.

fabioz avatar Jul 10 '19 10:07 fabioz

The module is there:

https://github.com/fabioz/PyDev.Debugger/blob/master/pydevd_concurrency_analyser/pydevd_thread_wrappers.py

EricSalemi avatar Jul 10 '19 11:07 EricSalemi

Oops, sorry about that... I think I searched for something wrong -- reopening ;)

fabioz avatar Jul 10 '19 11:07 fabioz

No problem :)

Would it help to create a small reproducible example?

EricSalemi avatar Jul 10 '19 11:07 EricSalemi

If you're up to it, what would really help is a test-case (see: tests_python/test_debugger.py) -- as a note, the concurrency analyzer is currently lacking tests, but it should be straightforward to create a test for it based on other tests.

fabioz avatar Jul 10 '19 12:07 fabioz

I will take a shot at creating a failing test case.

EricSalemi avatar Jul 10 '19 13:07 EricSalemi