question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Changing the preferred binding order from Python code

See original GitHub issue

I am aware of the QT_PREFERRED_BINDING environment variable, but I would like to know if it is possible to alter the order of bindings directly from python. I am currently using Qt.py through vendoring, so I know that I could also alter this manually by changing default_order = ("PySide2", "PyQt5", "PySide", "PyQt4"). Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mottossocommented, Oct 17, 2017

Ah, yes you are right, this would override any existing variable.

How about asking for it first, and overriding if it doesn’t already exist?

import os

if "QT_PREFERRED_BINDING" not in os.environ:
  os.environ["QT_PREFERRED_BINDING"] = os.pathsep.join(
    ["PySide2", "PyQt5", "PySide", "PyQt4"]
  )

import Qt
0reactions
mottossocommented, Oct 17, 2017

You are most welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use binding to change the position of an arc?
python - How do I use binding to change the position of an arc? - Stack Overflow. Stack Overflow for Teams – Start...
Read more >
Programming FAQ — Python 3.11.1 documentation
Contents: Programming FAQ- General Questions- Is there a source code level debugger with breakpoints, single-stepping, etc.?, Are there tools to help find ...
Read more >
Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
Read more >
PEP 8: The Style Guide for Python Code
Because the code in question predates the introduction of the guideline and there is no other reason to be modifying that code. When...
Read more >
The 10 Most Common Mistakes That Python Developers Make
Common Mistake #5: Modifying a list while iterating over it. The problem with the following code should be fairly obvious: >>> odd =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found