Jump to content

Recommended Posts

Posted

Hi.

I'm trying to get a simple Python script running:

 

#!usr/bin/python3.6
print ("Hello")
tried #!usr/bin/python3.6, #!usr/bin/python3, #!usr/bin/python
without success. Also tried print "Hello" without parenthesis.
the file is chmod 755 and is in the cgi-bin directory.
What's wrong?
user: ktulxx
server: Tommy.
Thanks.
Posted

 

#!usr/bin/python3.6
print ("Hello")

 

With the leading / that will work as a cron job or on a shell prompt, but it won't work as a cgi script because you don't output any content type headers. With dedicated web scripting languages like php or jsp or asp.net they handle the headers for you, but on a language like python or perl or ruby you have to specify the headers yourself. Try this:

#!/usr/bin/python3.6

print("Content-Type: text/html\n\n")
print("Hello")
Posted

Yeah, I just figured it out too by trying every solution I could find.

Strangely there is NOTHING about it in the results if you google for "python 500 error". May be a good idea to add this info into your wiki.

 

How can one know what python libraries are installed on the server?

Does Tommy only have Python 3.6?

 

Thanks, Krydos.

Posted

May be a good idea to add this info into your wiki.

Since it's a wiki it is updated and maintained by our users. Let me know your wiki username and I'll grant you edit access so you can add the information that would have helped you.

 

How can one know what python libraries are installed on the server?

Python 3.6 on Tommy currently has

['bleach==2.0.0',
 'click==6.7',
 'cycler==0.10.0',
 'decorator==4.0.11',
 'django-debug-toolbar==1.8',
 'django-jinja==2.3.1',
 'django==1.10.5',
 'entrypoints==0.2.3',
 'flask==0.12.2',
 'html5lib==0.999999999',
 'ipykernel==4.6.1',
 'ipython-genutils==0.2.0',
 'ipython==6.1.0',
 'ipywidgets==6.0.0',
 'itsdangerous==0.24',
 'jedi==0.10.2',
 'jinja2==2.9.6',
 'jsonschema==2.6.0',
 'jupyter-client==5.0.1',
 'jupyter-console==5.1.0',
 'jupyter-core==4.3.0',
 'jupyter==1.0.0',
 'markupsafe==1.0',
 'matplotlib==2.0.2',
 'mistune==0.7.4',
 'mysqlclient==1.3.10',
 'nbconvert==5.2.1',
 'nbformat==4.3.0',
 'notebook==5.0.0',
 'numpy==1.13.0',
 'pandas==0.20.2',
 'pandocfilters==1.4.1',
 'pexpect==4.2.1',
 'pickleshare==0.7.4',
 'pip==9.0.1',
 'postmarker==0.8.1',
 'prompt-toolkit==1.0.14',
 'ptyprocess==0.5.1',
 'pygments==2.2.0',
 'pyparsing==2.2.0',
 'python-dateutil==2.6.0',
 'pytz==2017.2',
 'pyzmq==16.0.2',
 'qtconsole==4.3.0',
 'requests==2.13.0',
 'scikit-learn==0.18.1',
 'scipy==0.19.0',
 'setuptools==28.8.0',
 'simplegeneric==0.8.1',
 'six==1.10.0',
 'sqlparse==0.2.3',
 'terminado==0.6',
 'testpath==0.3.1',
 'tornado==4.5.1',
 'traitlets==4.3.2',
 'wcwidth==0.1.7',
 'webencodings==0.5.1',
 'werkzeug==0.12.2',
 'widgetsnbextension==2.0.0']
If you need something installed just state your username, server, python version, and the module you need.

 

Does Tommy only have Python 3.6?

Nope, /bin/python is 2.7.5. If you need a specific version of python it can probably be installed.

 

This might be more useful than my posted list of modules though as it will always be up to date: https://krydos.heliohost.org/cgi-bin/modules36.py

Posted

 

Since it's a wiki it is updated and maintained by our users. Let me know your wiki username and I'll grant you edit access

Ok, it's ktulxx. I'll try to write some lines )

 

 

Nope, /bin/python is 2.7.5. If you need a specific version of python it can probably be installed.

I'm perfectly fine with these two.

 

 

If you need something installed just state your username, server, python version, and the module you need.

 

I do need some, but I'll make another post for that.

 

Thanks for your support.

Best regards.

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...