Jump to content

Python Cgi Script Not Working, Help Please


Recommended Posts

Hi everybody,

 

I am quite excited to be starting my first website with heliohost, and am happy to join this community.

 

My first challenge: I have a python cgi script, that calls a module, the files for which are placed in the same folder as the python cgi script. the folder is placed as a sub folder under the cgi-bin folder. I have placed the python shebang line(#!/usr/bin/python), the content type (print("Content-type: image/png\n")), and made the entire subfolder and its contents chmod permission 755.

 

the code in my file is as follows:

#!/usr/bin/python

from pychartdir import *

 

# The data for the bar chart

data = [85, 156, 179.5, 211, 123]

 

# The labels for the bar chart

labels = ["Mon", "Tue", "Wed", "Thu", "Fri"]

 

# Create a XYChart object of size 250 x 250 pixels

c = XYChart(250, 250)

 

# Set the plotarea at (30, 20) and of size 200 x 200 pixels

c.setPlotArea(30, 20, 200, 200)

 

# Add a bar chart layer using the given data

c.addBarLayer(data)

 

# Set the labels on the x axis.

c.xAxis().setLabels(labels)

 

# Output the chart

print("Content-type: image/png\n")

binaryPrint(c.makeChart2(PNG))

 

I placed all the files for the pychartdir module in the same folder.

but it still doesnt work. the link is here: http://promtech.heliohost.org/ . (its the 3rd broken link)

 

I would appreciate very much if anyone here can point out something I have been missing. I have tried to find the answers on these forums and google, but have come up with nothing that works. Many thanks in advance!

 

John

Link to comment
Share on other sites

Hi Yashrs,

 

That is fantastic! how did you do it? Yes I was using the (i386/i686) version, and it was because my laptop is 32 bit. Why is it that the 64 bit version works? is it because the server is 64 bit linux? I am sorry for my noob question, but I am new at this, and would really love to learn how to make it work.

I am assuming there is nothing wrong with the python script? so therefore the problem is in some settings? I am afraid I still can't get mine to work.

 

John

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...