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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...