Debugging Qt application


91
views
1
26 days ago by
Amit  

Hi,

I am trying to debug an application that uses a Qt framework (enaml) which uses Qt API version 2.

Once the debugging session starts I get the following error:

"ValueError: API 'QDate' has already been set to version 1"

The application runs correctly when lunched from the command line.

My guess is that wingide already sets the API version. Is it possible to change this behavior (I cannot change the API version that my application uses)?

Thanks,

Amit

 

 

add commentfollow this post modified 19 days ago by Wingware Support   • written 26 days ago by Amit  

2 Answers


1
20 days ago by
Amit  

Hi,

I am not using pyinstaller.

The problem occurs when matplotlib is imported before enaml (the qt framework I am using). The work around is to import enaml before matplotlib.

I compared both setups (command line and wingide). The only difference I found was that wingide injects the following environment variables:

 

'PYTHONIOENCODING',
'WINGDB_ACTIVE',
'WINGDB_PARENT_PIDS',
'WINGDB_SPAWNCOOKIE'

 

Thanks,

Amit

add comment written 20 days ago by Amit  

Ah, yes, that would explain it. If matplotlib is using the Qt backend then it would initialized PyQt first.  Thanks for posting the solution!

written 19 days ago by Wingware Support  
0
26 days ago by

Are you possibly using PyInstaller or something else that might account for this? Maybe the work-around described in https://github.com/pyinstaller/pyinstaller/wiki/Recipe-PyQt4-API-Version will solve it?

Wing uses PyQt itself but other than possibly leaking an environment variable your debug process should not be in any way affected by this, since it runs in a separate process space.  I checked this just now and don't see any environment variable set that I think could cause this, so I am guessing that it's some other cause, but still worth a check by looking at os.environ in each case. 

Also take a look at compare sys.executable and sys.path to make sure the same are being used in each case.  You can alter those by setting/adding values in Project Properties.  If sys.executable is wrong, set that into Python Executable.  To add things to sys.path put them in Python Path.

add comment written 26 days ago by Wingware Support  
Please log in to add an answer/comment or follow this question.

Share this question


Similar posts:
Search »