First time here? Check out the FAQ!
1

Debugging Qt application

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

Amit's avatar
56
Amit
asked 2017-05-29 06:43:00 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2019-03-13 10:16:04 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

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

Amit's avatar
56
Amit
answered 2017-06-04 17:49:00 -0500
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-07 07:19:31 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Wingware Support's avatar Wingware Support (2017-06-05 08:37:00 -0500) edit
add a comment see more comments
0

Are you possibly using PyInstaller or something else that might account for this? Maybe the work-around described in https://github.com/pyinstaller/pyinst... 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.

Wingware Support's avatar
4k
Wingware Support
answered 2017-05-29 10:34:00 -0500
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-07 07:19:15 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer