Hi,
I'm having some trouble configuring the Android SDK on Arch Linux (64-bit).
I'm using Titanium Studio 1.0.2.201107130739.
The problem is simple. In my box /usr/bin/python points to Python 3.2.1, and Titanium Studio needs Python 2.x.
!MESSAGE File "/home/user/.titanium/mobilesdk/linux/1.7.2/android/avd.py", line 41 print "Usage: %s <directory>" % os.path.basename(sys.argv[0])Is it possible to configure the python command used by Titanium Studio? Some env variable or flag in TitaniumStudio.ini?
I've already tried a couple of things:
- Environment variables:
- PYTHON
- PYTHONHOME
ln -s /usr/bin/python2 pythonin my user's bin/ directory, so that thepythoncommand for that user is Python 2.7.2.- Replacing every occurrence of
#!/usr/bin/env pythonwith#!/usr/bin/env python2in.titanium/mobilesdk.
The only workaround I've found so far is doing this:
sudo rm /usr/bin/python sudo ln -s /usr/bin/python2 /usr/bin/pythonBut that has the slight disadvantage of breaking all other python packages / scripts in my system.
Any ideas would be appreciated, thanks.
2 Answers
We solved this problem with per process namespaces. We basically changed the /usr/bin/python link (to point to python2) in the process running titanium rather than changing it for the whole system.
#define _GNU_SOURCE #include <sched.h> #include <syscall.h> #include <unistd.h> int main(int argc, char *argv[]) { syscall(SYS_unshare, CLONE_NEWNS); if (argc > 1) return execvp(argv[1], &argv[1]); return execv("/bin/sh", NULL); }And we run this in a little bash script that creates the process and sets up the filesystem, something like:
#!/bin/bash sudo ./newns sh -c "mount -n --bind /usr/bin/python2 /usr/bin/python; su username"Hope this helps someone.
Hi there Eduardo Lopez,
I'm pretty new to Arch Linux and a i'm a n00b with python & custom environment (to python2.7).
Could you please explained your solution with more detail ?
Configuring Titanium Studio correctly would make arch uber cool ::):)
Thank you very much!
Your Answer
Think you can help? Login to answer this question!