cross-platform

Is it possible to use Python to write cross-platform apps for both iOS and Android?

Is it possible to use Python to write cross-platform apps for both iOS and Android? Question: Is it possible to use Python to write cross-platform apps for both iOS and Android Asked By: user1404932 || Source Answers: For Android Google provides something called ASE (Android Scripting Environment) which allows scripting languages (Python included) to run …

Total answers: 5

Simple IPC between C++ and Python (cross platform)

Simple IPC between C++ and Python (cross platform) Question: I have a C++ process running in the background that will be generating ‘events’ infrequently that a Python process running on the same box will need to pick up. The code on the C side needs to be as lightweight as possible. The Python side is …

Total answers: 7

Platform-independent file paths?

Platform-independent file paths? Question: How can I use a file inside my app folder in Python? Platform independent of course… something similar to this: #!/bin/sh mypath=${0%/*} LIBDIR=$mypath/modules Asked By: Hairo || Source Answers: __file__ contains the module’s location. Use the functions in os.path to extract the directory from it. Answered By: Ignacio Vazquez-Abrams You can …

Total answers: 5

How can I create a ramdisk in Python?

How can I create a ramdisk in Python? Question: I want to create a ramdisk in Python. I want to be able to do this in a cross-platform way, so it’ll work on Windows XP-to-7, Mac, and Linux. I want to be able to read/write to the ramdisk like it’s a normal drive, preferably with …

Total answers: 4

What is the correct cross-platform way to get the home directory in Python?

What is a cross-platform way to get the home directory? Question: I need to get the location of the home directory of the current logged-on user. Currently, I’ve been using the following on Linux: os.getenv("HOME") However, this does not work on Windows. What is the correct cross-platform way to do this ? Asked By: Nathan …

Total answers: 5

How can I move file into Recycle Bin / trash on different platforms using PyQt4?

How can I move file into Recycle Bin / trash on different platforms using PyQt4? Question: I would like to add the next feature to my cross-platform PyQt4 application: when user selects some file and select “remove” action on it that file will be moved to Recycle Bin folder instead of being permantly removed. I …

Total answers: 3

How to add a timeout to a function in Python

How to add a timeout to a function in Python Question: Many attempts have been made in the past to add timeout functionality in Python such that when a specified time limit expired, waiting code could move on. Unfortunately, previous recipes either allowed the running function to continue running and consuming resources or else killed …

Total answers: 5

Is it safe to use sys.platform=='win32' check on 64-bit Python?

Is it safe to use sys.platform=='win32' check on 64-bit Python? Question: The usual check to differentiate between running Python-application on Windows and on other OSes (Linux typically) is to use conditional: if sys.platform == ‘win32’: … But I wonder is it safe to use today when 64-bit Python is more widely used in last years? …

Total answers: 4

Python: Platform independent way to modify PATH environment variable

Python: Platform independent way to modify PATH environment variable Question: Is there a way to modify the PATH environment variable in a platform independent way using python? Something similar to os.path.join()? Asked By: resi || Source Answers: You should be able to modify os.environ. Since os.pathsep is the character to separate different paths, you should …

Total answers: 4