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.

Detect nuitka on the fly

See original GitHub issue

Hello,

I wrote a piece of code that asks for admin rights on Windows / Linux and if not found, asks for elevation. On Windows, it will ask for UAC elevation, keeps exit codes and allows to keep commandline arguments. On Linux, it will try to rerun with sudo, keeping exit codes, output and commandline arguments too. It currently works with the Nuitka compiler, and packagers like PyInstaller, py2exe, cx_freeze.

As of today, I’m using a sloppy nuitka detection on windows using:

sys.argv[0].endswith('.exe')

It gets worse when running on linux 😃

On the other packagers, generally sys gets a frozen attribute that can be checked with:

getattr(sys, "frozen", False)

Is there any way to detect if current script is Nuitka compiled ? Like a constant or a variable that is set globally in a compiled nuitka program ?

Best regards.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kayhayencommented, Feb 27, 2019

This is long released as 0.6.2 already.

0reactions
kayhayencommented, Jun 20, 2021

I don’t get what’s missing here:

nuitka_version(major=0, minor=6, micro=16, releaselevel=‘candidate’, standalone=False, onefile=False)

The oypy version info has only less. Notice, the last two fields are only in the upcoming release.

Yours, Kay

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detect nuitka on the fly · Issue #216 - GitHub
Hello, I wrote a piece of code that asks for admin rights on Windows / Linux and if not found, asks for elevation....
Read more >
User Manual - Nuitka
No information is available for this page.
Read more >
Intro to Nuitka: A better way to compile and distribute Python
You can use Nuitka to compile Python programs to standalone executables, then redistribute them without the Python runtime.
Read more >
How to get the current path of compiled binary from Python ...
I need a result like /another/path if I move compiled myproj.bin to /another/path . python · nuitka · Share.
Read more >
Nuitka-chat/community - Gitter
Hi, is there a possibility to compile the generated C code against lower version CPython? (And use it that way to gen higher...
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