Jump to content

Recommended Posts

Posted (edited)

Hello Helioids!

 

Just found this service and started poking around. I'm glad HelioHost exists!

 

Determining without command line access which python packages are available was a bit tricky. I'm documenting a solution here so it will show up for others in search.

 

The following script is tested as working on server Johnny, under Python 3.6. Upload it to, for example, /home/USERNAME/public_html/cgi-bin/SCRIPTNAME.py. Don't forget to make it executable (chmod 755 SCRIPTNAME.py). Sending a request to that file from your browser, for example by visiting YOURSUBDOMAIN.heliohost.org/cgi-bin/SCRIPTNAME.py, will return installed module details wrapped in html that should be good enough for your browser to parse. Hope someone else finds this helpful!

#!/usr/bin/python3.6

import sys
import pip

version = sys.version
modules = pip.get_installed_distributions()

print("Content-type: text/html\n\n", "Python ", version, "<br><br>")

for mod in sorted(modules, key=lambda mod: mod.key):
    try:
        deets = next(pip.commands.show.search_packages_info([mod.key]))
        print(deets["name"], "<br>")
        print(deets["version"], "<br>")
        print(deets["summary"], "<br>")
        print(deets["author"], "<br>")
        print(deets["author-email"], "<br>")
        print(deets["home-page"], "<br><br>")
    except:
        print("<p>", mod.key, "</p>")
Edited by bfirest1
  • Like 1
Posted (edited)

One of Heliohost's Admin's Krydos already has a script to view the list of installed modules. The link to view installed modules for python version 3.6 is https://krydos2.heliohost.org/cgi-bin/modules37.py 

 

Similarly this link https://krydos2.heliohost.org/cgi-bin/modules27.py can be used to view the installed modules for python verision 2.7 

 

qsgt

Edited by Krydos
Johnny has been upgraded to python 3.7

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