Posts Tagged ‘python’

Python and Apache on Ubuntu (Edgy)

Tuesday, April 13th, 2010

See http://ubuntuforums.org/showthread.php?t=91101

  1. apt-get install libapache2-mod-python
  2. cd /etc/apache2/mods-enabled/
  3. sudo ln -s ../mods-available/mod_python.load mod_python.load
  4. sudo nano /etc/apache2/sites-available/default
  5. Add to the <Directory /> :
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On
  6. sudo /etc/init.d/apache2 restart
  7. Test using the following python script:
    def index(req):
    return “Hello Python!”

psycopg (Python module for PostgreSQL) on Ubuntu 6.10 (Edgy Eft)

Tuesday, April 13th, 2010

for psycopg 1, install python-psycopg
for psycopg 2, install python-psycopg2

OmniORB with Python on Ubuntu 6.10 (Edgy Eft)

Tuesday, April 13th, 2010

PART I

Install omniORB. Package list:

  • omniorb4
  • omniidl4
  • omniorb4-nameserver
  • omniidl4-python
  • libomniorb4c2
  • libomnithread3c2
  • python-omniorb2-omg
  • python-omniorb2-omg

Configure /etc/omniORB4.cfg

PART II

omniidl -bpython Hello.idl, results in:


omniidl: Could not import back-end ‘python’

omniidl: Maybe you need to use the -p option?

omniidl: (The error was ‘No module named python’)

Solution 1:

Set the path of omniidl. In my case it is:

omniidl -p /usr/share/pycentral/omniidl4-python/site-packages/omniidl_be/ -bpython Hello.idl

Solution 2:

Add path to omniidl to PYTHONPATH. I export PYTHONPATH in ~/.bashrc:

export PYTHONPATH=${PYTHONPATH}:/usr/share/pycentral/omniidl4-python/site-packages/omniidl_be/

PART III

import omniORB, results in: ImportError: No module named omniORB

Solution:

Add omniorbpy to PYTHONPATH. I do this in ~/.bashrc:

export PYTHONPATH=${PYTHONPATH}:/usr/share/pycentral/omniidl4-python/site-packages/omniidl_be/ –>

:/usr/share/pycentral/python-omniorb2/site-packages/:/usr/share/pycentral/python-omniorb2-omg/site-packages/