Jump to content

Recommended Posts

Posted

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 found

http://i.imgur.com/zIk69vp.jpg

Posted

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 :)

Posted

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.

  • Like 1
Posted

Shinryuu - i did not know how to check which version cpanel uses, silly me. thank you so much for your help, it works now :)

Posted

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.

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