Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello β I'm @olemoritz on Twitter.
Check if script is executed within Pythonista
-
Hi!
I would like to write multi-platform scripts for Pythonista on iOS, Mac and Windows.
Do you know a way how a script which is executed within Pythonista can check that it is executed within Pythonista and not on a Mac?
-
-
Great @stephen thank you! It works well!
-
@elkrause outstanding! have a good one π
-
If you're only looking to determine which OS you're on (and not whether you're in the Pythonista IDE specifically), you can do that with:
from sys import platform print(platform)
If you're on iPhone/iPad, platform should be "iOS". If you're on macOS, you should get "darwin". Windows should be "win32" I believe.
-
@WyldKard
almost correct βΊοΈ heres what i get get fromprint(platform.platform())
on iPad Air2Darwin-19.3.0-iPad5,4-64bitmight be because of iPadOS?#Edit..
stand corrected...
print(sys.platform) >>> ios
sorry ππ
-
π just realised i can never trust the
platform
module again lol