silverx Posted September 3, 2017 Posted September 3, 2017 (edited) Hi everyone,i have just tried to launch a python script but it trows the infamous 500 Error.I think there might be some module missing from the server. Here is what i need: Server: Johnny User: silverb Python Version: 2.7 Modules: - __future__ for the print_function - os - json - time The baffling fact is that these modules should come with a "default" python installation, so i'm not sure if this is the problem. I would also need the httplib2, google api client and oauth2 module, but i read that they are already present in johnny's python 2.7. Apart from a possible module missing, could there be some problem with reading a file from the current work directory or creating a folder and a file? Thank you for your support and your time. Edited September 3, 2017 by silverx
Krydos Posted September 3, 2017 Posted September 3, 2017 The baffling fact is that these modules should come with a "default" python installation,The modules that come with a default python are not included on the list because they are guaranteed to be there. The list is for installed modules only.# /usr/bin/python2.7 Python 2.7.13 (default, Aug 25 2017, 20:17:53) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> import json >>> import time >>> import httplib2 >>> import googleapiclient >>> import oauth2client >>> from __future__ import print_function >>> import not_a_module Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named not_a_module None of your imports are causing the 500 error. The final not_a_module is to show what it would look like if any of those imports were the issue. Here's a way to debug your script:Go to https://johnny.heliohost.org:2083/frontend/paper_lantern/cron/index.htmlType in an email address that you would like to receive the error report atClick update emailGo to https://www.google.com/search?q=current+time+in+pstPick a time roughly 5 minutes in the future to give you time to finish the rest of this tutorialType the minutes (example: 5 for 2:05pm)Type in the hour in 24 hour format (example: 14 for 2:05pm)Put * in the next three boxes, day, month, weekdayIn command put your shebang without the leading #! (example: /usr/bin/python2.7)Followed by a space and then the absolute path to your script that is throwing a 500 error (example: /home/silverb/public_html/DFArchiver.py)Click Add New Cron JobWait until the time that you set your cron job to run and then check your emailIf you got an email be sure to click delete next to your cron under the Current Cron Jobs header to make sure you don't exceed your 2 per day limitHere is an example email I just got: Date: Sun, 03 Sep 2017 08:06:02 -0700 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - johnny.heliohost.org X-AntiAbuse: Original Domain - yahoo.com X-AntiAbuse: Originator/Caller UID/GID - [503 498] / [47 12] X-AntiAbuse: Sender Address Domain - johnny.heliohost.org X-Get-Message-Sender-Via: johnny.heliohost.org: authenticated_id: krydos2/primary_hostname/system user X-Authenticated-Sender: johnny.heliohost.org: krydos2 X-Source: X-Source-Args: CROND X-Source-Dir: /home/krydos2 Content-Length: 136 File "/home/krydos2/public_html/cgi-bin/test.py", line 6 ^ SyntaxError: unexpected EOF while parsing Sure enough line 6 is print("Heliohost rules!" It's (intentionally) missing the closing parenthesis.
silverx Posted September 3, 2017 Author Posted September 3, 2017 Thank you very much for your patience. It was a stupid typo that i inserted while adapting it to the new file hierarchy. Now it works like a charm.
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