Zephyer Posted May 13, 2013 Posted May 13, 2013 Hello. i tried to run some basic python cgi files, which worked perfectly, with some imports. however, when i try to 'import json' or 'import simplejson', i get error 500 - internal server error. json is supposed to be baseline. am i missing something? what is wrong? Thanks! edit: link to screenshot of error: json module not foundhttp://i.imgur.com/zIk69vp.jpg
Krydos Posted May 13, 2013 Posted May 13, 2013 What server is your account located on, and which version of python are you using?
Shinryuu Posted May 13, 2013 Posted May 13, 2013 The answer to this answers the problem thoroughly. http://stackoverflow.com/questions/14221360/why-is-import-simplejson-failing-in-python-2-7-3-code-but-not-in-the-interpre
Zephyer Posted May 13, 2013 Author Posted May 13, 2013 Shinryuu - json doesnt work as well, not just simplejson Krydos - im on Johnny server. on my machine im using python 2.7. maybe its not the version the server is running? can i set it to be 2.7? thank you both for the replies
Shinryuu Posted May 13, 2013 Posted May 13, 2013 As the SO answer stated json didn't become a standard internal module until 2.6+. By default cPanel comes with 2.4.3, so #!/usr/bin/python will give that error. While #!/usr/local/bin/python2.7 will work fine. 1
Zephyer Posted May 13, 2013 Author Posted May 13, 2013 Shinryuu - i did not know how to check which version cpanel uses, silly me. thank you so much for your help, it works now
Krydos Posted May 13, 2013 Posted May 13, 2013 Unfortunately, python is heavily tied to cPanel, so if we upgrade the default version of python it could break a lot of other functionality. The good news is that multiple versions of python can coexist easily on the same server without interfering with each other; you just use different shebang lines to access the version that you need. 1
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