ImportError: cannot import name 'QtChart' from 'PyQt5' / Qprinter crashes

Hans Jörg Maurer hjm at pmeonline.net
Thu Jul 23 21:58:18 BST 2020


Dear Florian,


Part 1 (module not found) I could solve by changing the Python
Interpreter in 

Pycharm: '
File->Settings->Prioject Interpreter-> to C:\Program
Files\Python37\python.exe (Same as before, but other path)


Seems to be a virtual environment hassle.



Part 2: 



Aarghhh, you are right. In that testing module I forgot the
QApplication... I've got it just a minute before your mail.



Thanks a lot for your attention
Hans


I have to shut down earlier ;-)





Am Donnerstag, den 23.07.2020 um 22:40 schrieb Florian Bruhin:


On Thu, Jul 23, 2020 at 07:46:05PM +0200, hjm wrote:
> I've tested a script to use QPrinter and this ended up with Process
finished
> with exit code -1073740791 (0xC0000409) unable to debug (for me).
> 
> from PyQt5import QtPrintSupport
> myprinter= QtPrintSupport.QPrinter ()

You most likely need to create a QApplication before using QPrinter.

> After that I got an import error also frpm another script which
contains
> 
> from PyQt5import QtChart
> 
> ImportError: cannot import name 'QtChart' from 'PyQt5'
>
(C:\Users\myname\IR-Check_Tablet\lib\site-packages\PyQt5\__init__.py).
> 
> The files are installed, I have a directory with lot of files (53)
called
> c:\Program Files\Python37\Lib\site-packages\PyQt5\bindings\QtChart\

Those paths are different. It looks like you have two PyQt5 installs
now, one
in C:\Users\myname\IR-Check_Tablet\ (without QtChart) and one in
c:\Program
Files\Python37 (with QtChart). According to the ImportError, you're
using the
former.

Florian

-- 
me at the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org 
       https://bruhin.software/ |
https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 |
https://the-compiler.org/pubkey.asc
             I love long mails! |
https://email.is-not-s.ms/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200723/061e92b0/attachment.htm>


More information about the PyQt mailing list