top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Setting environment variables from within python?

0 votes
292 views

I want to submit a qsub job to my hpc cluster from within python. In this case, I must set some environment variables specific for this qsub job and then invoking a bash script from within python.

What python code should be used for this job?

posted Mar 23, 2016 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+5 votes

Using 1/3 as an example,

 >>> 1./3
0.3333333333333333
 >>> print "%.50f" % (1./3)
0.33333333333333331482961625624739099293947219848633
 >>> print "%.50f" % (10./3)
3.33333333333333348136306995002087205648422241210938
 >>> print "%.50f" % (100./3)
33.33333333333333570180911920033395290374755859375000

which seems to mean real (at least default) decimal precision is limited to "double", 16 digit precision (with rounding error). Is there a way to increase the real precision, preferably as the default?
For instance, UBasic uses a "Words for fractionals", f, "Point(f)" system, where Point(f) sets the decimal display precision, .1^int(ln(65536^73)/ln(10)), with the last few digits usually garbage.
Using "90*(pi/180)*180/pi" as an example to highlight the rounding error (4 = UBasic's f default value):

 Point(2)=.1^09: 89.999999306
 Point(3)=.1^14: 89.9999999999944
 Point(4)=.1^19: 89.9999999999999998772
 Point(5)=.1^24: 89.999999999999999999999217
 Point(7)=.1^33: 89.999999999999999999999999999999823
 Point(10)=.1^48: 89.999999999999999999999999999999999999999999997686
 Point(11)=.1^52: 89.9999999999999999999999999999999999999999999999999632

If not in the core program, is there a higher decimal precision module that can be added?

+4 votes

I have been trying to set up a python, django, mysql, virtualenvwrapper and git development project and am really confused. All of the documentation seems to ignore the apt-get installation methods used by Debian Linux and its derivatives. Does pip install the same as apt-get; I don't think so. If I use virtualenvwrapper, how does this fit with the normal debian (wheezy) installation. I also need git which just confuses the situation even more. Must I give up the automatic updating system that Debian provides when setting up the development environment?

The documentation centers on Windows, Mac and generic Linux distributions and ignores the automation of the Debian installation. All of the documentation I have found concentrates on the installation of individual packages or on the use of python-django and is very sketchy on the overall virtualenv(wrapper), git, python-django file structure and installation order.

+1 vote

I want to install path.py in my Python 3.4 environment on a Centos 5 box. My /usr/local/bin/ contains:

easy_install-3.4 
python3.4  
etc. 

We are behind a proxy server and I tried this:

# /usr/local/bin/easy_install-3.4 path.py 

Searching for path.py 
Reading https://pypi.python.org/simple/path.py/ 
Download error on https://pypi.python.org/simple/path.py/: hostname '172.29.68.1  
' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org',  
'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org',  
'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org',  
'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org' --  
Some packages may not be found! 

Couldn't find index page for 'path.py' (maybe misspelled?), Am I best to use pip or easy_install? also if easy_install, how can I fix the above error?

+1 vote

We have a server running a web-based terminal emulator (based on shellinabox for screen-casting check www.webminal.org) that allows users to learn simple bash commands. This Linux environment secured by things like quota, selinux,ulimit etc

Now some users are requesting python access. How to ensure python is executed in a restricted environment. I came across
http://docs.python.org/2/library/restricted.html
but it seems like disabled in 2.3. Any thoughts on how we can safely provide python access to users.

...