Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Importer issue #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alex-eri opened this issue Jul 11, 2020 · 1 comment
Closed

Importer issue #14

alex-eri opened this issue Jul 11, 2020 · 1 comment

Comments

@alex-eri
Copy link

alex-eri commented Jul 11, 2020


    connect(PythonQt::self(), SIGNAL(pythonStdErr(const QString&)), this, SLOT(log(const QString&)));
    PythonQt::self()->setImporter(NULL);
    Q_ASSERT(!mainModule.isNull());
    mainModule.evalScript(QString("import sys,site\n"));
    mainModule.evalScript("for s in site.getsitepackages(): sys.path.append(s)\n");
    mainModule.evalScript("sys.path.append(site.getusersitepackages())\n");
    mainModule.evalScript("sys.path.append(':cashcode')\n");
//    mainModule.evalScript("import serial\n");
    mainModule.evalScript("import ccnet\n");


On importing serial from module in qrc


ERROR:root:<module 'site' from '/usr/lib/python3.8/site.py'>
ERROR:root:['/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/lib/python3.8/site-packages', '/home/eri/.local/lib/python3.8/site-packages', ':cashcode']

Traceback (most recent call last):
  File \"/usr/lib/python3.8/linecache.py\", line 95, in updatecache
    
stat = os.stat(fullname)

FileNotFoundError
: 
[Errno 2] Нет такого файла или каталога: ':cashcode/ccnet.py'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File \"<string>\", line 1, in <module>
  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load
  File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked
  File \"<frozen importlib._bootstrap>\", line 655, in _load_unlocked
  File \"<frozen importlib._bootstrap>\", line 618, in _load_backward_compatible
  File \":cashcode/ccnet.py\", line 9, in <module>
  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load
  File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked
  File \"<frozen importlib._bootstrap>\", line 655, in _load_unlocked
  File \"<frozen importlib._bootstrap>\", line 618, in _load_backward_compatible
  File \"/home/eri/.local/lib/python3.8/site-packages/serial/__init__.py\", line 10, in <module>
    
from . import utilities, abc, model, marshal, errors, properties, meta, hooks, test, request

  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load
  File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked
  File \"<frozen importlib._bootstrap>\", line 655, in _load_unlocked
  File \"<frozen importlib._bootstrap>\", line 618, in _load_backward_compatible
  File \"/home/eri/.local/lib/python3.8/site-packages/serial/utilities/__init__.py\", line 5, in <module>
    
compatibility.backport()  # noqa

  File \"/home/eri/.local/lib/python3.8/site-packages/serial/utilities/compatibility.py\", line 21, in backport
    
frame_info = inspect.stack()[1]  # type: inspect.FrameInfo

  File \"/usr/lib/python3.8/inspect.py\", line 1514, in stack
    
return getouterframes(sys._getframe(1), context)

  File \"/usr/lib/python3.8/inspect.py\", line 1491, in getouterframes
    
frameinfo = (frame,) + getframeinfo(frame, context)

  File \"/usr/lib/python3.8/inspect.py\", line 1465, in getframeinfo
    
lines, lnum = findsource(frame)

  File \"/usr/lib/python3.8/inspect.py\", line 794, in findsource
    
lines = linecache.getlines(file, module.__dict__)

  File \"/usr/lib/python3.8/linecache.py\", line 47, in getlines
    
return updatecache(filename, module_globals)

  File \"/usr/lib/python3.8/linecache.py\", line 103, in updatecache
    
data = cache[filename][0]()

SystemError
: 
<built-in method get_source of PythonQtImport.PythonQtImporter object at 0x7fbdeac3ebb0> returned NULL without setting an error
"
@mrbean-bremen
Copy link
Contributor

PythonQtImporter is not really supported, see also this comment. Specifically, get_source is not implemented.
I'm moving this to discussion, as this is unlikely to change.

@MeVisLab MeVisLab locked and limited conversation to collaborators Dec 15, 2023
@mrbean-bremen mrbean-bremen converted this issue into discussion #174 Dec 15, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants