Archive for the tag 'Python'

How to check if Python script engine is enabled

We can check using the default Parallels Plesk Panel domain page content (http://domain.tld/index.html) - then by the “Python” item.

The test looks successful if a page with a list of environment variables is shown.

Test can be done using a simple script like this.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print “Content-Type: text/plain;charset=utf-8″
print

print “Hello World!”

It is necessary to put the content into a text file and save in the domain web-accessible folder (like $HTTPD_VHOSTS_D/domain.tld/httpdocs) on the server with .py extension (test.py for example). Then try to open the file via browser by the http://domain.tld/test.py URL.

The test looks successful if a page shows the “Hello World!” string. If an error or full script listing is visible, it means that Python engine is not configured for the domain properly.

Reference: http://parallels.com/

Problem importing one of the Python modules required to run yum

Error: There was a problem importing one of the Python modules required to run yum. … Cannot allocate memory.

Solution: Python frequently runs into the memory limits set inside WHM and cPanel. You may be able to resolve this issue by increasing the per process memory limit in the WHM Tweak Settings feature, or by running EasyApache from the command line to minimize its memory footprint.

Reference: http://cpanel.net