For some reason, the -O flag (optimized) is not recognized on the shebang line on the Red Hat Enterprise Server (release 5.3), which I refer to. In other systems, the flag is recognized without any problems.
Running the script below on OS X works fine. The recognition of the -O flag can be checked because it allows (when absent) or disables (when set) something under the condition if __debug__ :
#!/usr/bin/env python -O if __name__ == '__main__': if __debug__: print 'lots of debugging output on' print 'Fin'
Running the same script on the RHE system will result in:
/ usr / bin / env: python -O: No such file or directory
Without the -O flag, the script runs normally on the RHE system (i.e. the __debug__ built-in variable will be set to True ).
Is there a cross-platform way to solve this problem? Is there even a platform-specific way to fix the checkbox problem in the shebang string for the python interpreter?
Edit: Any other workarounds for setting the __debug__ variable (without using the shebang flags) to the interpreter will also be of interest.
python shell shebang
awesomo
source share