Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

I guess you have this in the second last line :-

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

It should be

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

Try it and see if that works out !

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...