johnchoo Posted August 31, 2014 Posted August 31, 2014 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/pythonfrom pychartdir import * # The data for the bar chartdata = [85, 156, 179.5, 211, 123] # The labels for the bar chartlabels = ["Mon", "Tue", "Wed", "Thu", "Fri"] # Create a XYChart object of size 250 x 250 pixelsc = XYChart(250, 250) # Set the plotarea at (30, 20) and of size 200 x 200 pixelsc.setPlotArea(30, 20, 200, 200) # Add a bar chart layer using the given datac.addBarLayer(data) # Set the labels on the x axis.c.xAxis().setLabels(labels) # Output the chartprint("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
yashrs Posted August 31, 2014 Posted August 31, 2014 I was able to generate this thing here - http://yash.heliohost.org/cgi-bin/ChartDirector/lib/yash.py I guess you are using the Linux (i386/i686) platform. Use the Linux (x86_64) platform from here: http://download2.advsofteng.com/chartdir_python_linux_64.tar.gz 1
johnchoo Posted August 31, 2014 Author Posted August 31, 2014 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
yashrs Posted September 1, 2014 Posted September 1, 2014 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 ! 1
johnchoo Posted September 1, 2014 Author Posted September 1, 2014 YESSS!! IT works!!! Thank you Mr Yashrs, you are a life saver. btw, is the server really 64bit?
yashrs Posted September 1, 2014 Posted September 1, 2014 You are welcome. Glad your problem got solved.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now