Problem of Calling OB with PHP

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem of Calling OB with PHP

Jie Shen
Dear all,

I am now trying to built a web-based calculation server. It will work like this:

Using PHP call the python script in linux.

The script could run well in the terminal of linux, but the same
commands can not run successfully under PHP calling (using
"shell_exec")

The error listed:

Traceback (most recent call last):
 File "/home/monkey/Monkey0.01/selected.py", line 137, in
  main(sys.argv[1:])
 File "/home/monkey/Monkey0.01/selected.py", line 74, in main
  import getopt, string, readsdf
 File "/home/monkey/Monkey0.01/readsdf.py", line 33, in
  import pybel as pb
 File "/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/pybel.py",
line 16, in
  import openbabel as ob
 File "/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/openbabel.py",
line 36, in
  _openbabel = swig_import_helper()
 File "/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/openbabel.py",
line 35, in swig_import_helper
  return _mod
UnboundLocalError: local variable '_mod' referenced before assignment


The calling line in PHP is: (attached is the php file)

$results=shell_exec('/usr/local/bin/python
/home/monkey/Monkey0.01/selected.py -p '.$_POST['types'].' -s -1'.' -l
'.$_POST['classlabel'].' -i '.$uploadfile_train.' -o '.$ig_anal_out.'
2>&1');



BTW, this command can run successfully in the terminal after translation.
and we have exclude following reasons:
1. safe mode is already off
2. The shell command is right
3. there is no problem with "permission" issues.


I am grateful if anyone can help me.

Best regards,

Sincerely,

Jie Shen

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

upload_basic.php (6K) Download Attachment