Forum Archive

Downloading modules from the internet?

dorien_jansen

I'm new her and I was wondering if it is possible to download custom modules from the web?

dgelessus

Yes, you can use stash for that. In most cases you can use its pip command to install a module from PyPI automatically. If that doesn't work or the module is not on PyPI, you can download it manually with wget, unpack it with tar or unzip, and move the correct folder to site-packages by hand.

dorien_jansen

Awesome! Thanks for your help 😊

dorien_jansen

Does anyone know how i can download urllib.request?

Webmaster4o

@dorien_jansen just import urllib. urllib.request is part of the standard library.

dgelessus

That is a module from the Python 3 standard library. Pythonista currently uses Python 2, where you'd use urllib2. If you're trying to run a script that imports urllib.request, then it's written for Python 3 and can't run on the current Pythonista. (A Python 3 version of Pythonista is currently in beta, though as far as I know it won't be released for a while.)

dorien_jansen

Thanks for the info, I'll wait for the final release

ccc
try:                 # Python 3 and later
    from urllib.request import urlopen
except ImportError:  # Python 2
    from urllib2 import urlopen
Tizzy

also, using the Pip command in Stash you can install from github repos using pip install UserName/ProjectName