ywangd / stash

StaSh - Shell for Pythonista
MIT License
1.94k stars 227 forks source link

error installing in Pythonista latest beta #138

Closed jjarava closed 8 years ago

jjarava commented 9 years ago

Hi!

Just tried to install in Pythonista (latest Beta) on my iPhone, iOS v8.4.1 and I'm getting an error.

I'm following the instructions on the Readme file and I get an error:

>>> import urllib2; exec urllib2.urlopen('http://bit.ly/get-stash').read()
Downloading files ...
https://raw.githubusercontent.com/ywangd/stash/master/stash.py?q=136402
https://raw.githubusercontent.com/ywangd/stash/master/bin/selfupdate.sh?q=569209
https://raw.githubusercontent.com/ywangd/stash/master/bin/echo.py?q=763539
https://raw.githubusercontent.com/ywangd/stash/master/bin/wget.py?q=266783
https://raw.githubusercontent.com/ywangd/stash/master/bin/unzip.py?q=105001
https://raw.githubusercontent.com/ywangd/stash/master/bin/rm.py?q=100868
https://raw.githubusercontent.com/ywangd/stash/master/bin/alias.py?q=863987
Bootstrapping ...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 40, in <module>
ImportError: No module named stash

Any idea what might be the issue?

ywangd commented 9 years ago

The error can be fixed by running following statements before the installation.

import sys; sys.path.insert(0, '.')

In contrast to v1.5, Pythonista v1.6 beta no longer has '.' (current working directory) in the default sys.path. So the installation script was unable to locate the stash module which is in the current directory. Above statements add the dot in sys.path so that the stash module can be found.

Since you are on beta, it may be worthwhile to try stash's version for beta. Please refer to this post for instructions.

Thank you!

dgelessus commented 9 years ago

It might be better to install stash under site-packages. This fixes the import problem and ensures that the module isn't reloaded every time you run a script (which Pythonista does as of a recent beta version).

ywangd commented 8 years ago

This should no longer be an issue with the new 0.5 version that is updated for Pythonista 2.0