sinkuri256 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

environment variables support needed (such as PERL5LIB/PYTHONPATH) #557

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I found that there is no way to set PERL5LIB/PYTHONPATH or such environment 
variables before launching script interpreter. 
As the result, I cannot using personal script packages...

Original issue reported on code.google.com by itar...@gmail.com on 5 Aug 2011 at 9:19

GoogleCodeExporter commented 9 years ago
As a workaround, you could write a very short bash script to set the 
environment variable and then run your script.

In Python, you could also use sys.path[1] to modify the module search path. I 
haven't tried it in SL4A, but modifying os.environ[2] might also work.

[1]: http://docs.python.org/library/sys.html#sys.path
[2]: http://docs.python.org/library/os.html#os.environ

Original comment by barbaraj...@gmail.com on 5 Aug 2011 at 1:17

GoogleCodeExporter commented 9 years ago
Thanks for comment.
Yes, your workaround might be work.
But sl4a shell interpreter says it cannot find the path of execs (perl) among 
default $PATH.
Where are those interpreter installed ?

Original comment by itar...@gmail.com on 5 Aug 2011 at 1:57

GoogleCodeExporter commented 9 years ago
You'll need to provide the full path to the executable: 
/data/data/com.googlecode.perlforandroid/files/perl/perl

Original comment by barbaraj...@gmail.com on 5 Aug 2011 at 2:11

GoogleCodeExporter commented 9 years ago
Thank you for comment. I tested below, and it worked.

export PERL5LIB=/mnt/sdcard/lib/perl
/data/data/com.googlecode.perlforandroid/files/perl/perl scripts/test.pl

and locating personal packages in /mnt/sdcard/lib/perl folder.

Original comment by itar...@gmail.com on 5 Aug 2011 at 9:27

GoogleCodeExporter commented 9 years ago

Original comment by rjmatthews62 on 21 Aug 2011 at 12:00