ywangd / stash

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

stash does not run with Pythonista v3.4 Beta #462

Open mkb79 opened 1 year ago

mkb79 commented 1 year ago

Today Pythonista v3.4 Beta was released.

When I execute launch_stash.py the following issue appears:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/04823405-B61A-4EBC-8D72-116EB0824B40/Pythonista3/Documents/launch_stash.py", line 28, in <module>
    from stash import stash
  File "/private/var/mobile/Containers/Shared/AppGroup/04823405-B61A-4EBC-8D72-116EB0824B40/Pythonista3/Documents/site-packages/stash/__init__.py", line 2, in <module>
    from . import core as stash
  File "/private/var/mobile/Containers/Shared/AppGroup/04823405-B61A-4EBC-8D72-116EB0824B40/Pythonista3/Documents/site-packages/stash/core.py", line 23, in <module>
    from .system.shcommon import (_EXTERNAL_DIRS, _STASH_CONFIG_FILES, _STASH_ROOT, _SYS_STDOUT, IN_PYTHONISTA, ON_IPAD)
  File "/private/var/mobile/Containers/Shared/AppGroup/04823405-B61A-4EBC-8D72-116EB0824B40/Pythonista3/Documents/site-packages/stash/system/shcommon.py", line 20, in <module>
    _properties = plistlib.readPlist(os.path.join(os.path.dirname(sys.executable), 'Info.plist'))
AttributeError: module 'plistlib' has no attribute 'readPlist'

Maybe there will be any fix in the near future?

Edit: After fixing this issue a new one appears with these line _ShTerminal = create_objc_class('_ShTerminal', ObjCClass('SUITextView'), [keyCommands, kcDispatcher_]). SUITextView does not exists.

mkb79 commented 1 year ago

I‘ve tried to patch stash myself and opened a new PR #463

cclauss commented 1 year ago

tl;dr: Solution is https://github.com/ywangd/stash/issues/462#issuecomment-1472858042

cclauss commented 1 year ago
import requests as r; exec(r.get('https://bit.ly/get-stash').content)

Uses branch master which has code that crashes on the current beta release of Pythonista. What command can I run to force the use of branch dev instead of master?

The following unfortunately installs master.zip, not dev.zip!

url = 'https://raw.githubusercontent.com/ywangd/stash/dev/getstash.py'; import requests as r; exec(r.get(url).content)

Downloading https://github.com/ywangd/stash/archive/master.zip ...

So on the new beta, you need to do the normal install and let it crash💥 then

  1. Reboot Pythonista
  2. Copy the contents of https://raw.githubusercontent.com/ywangd/stash/dev/system/shcommon.py
  3. On Pythonista, paste that content into Python Modules/site-packages/stash/system/shcommon.py
  4. Run launch_stash.py from the default directory.

It says StaSH was successfully installed but then crashes. Rebooting Pythonista and then running launch_stash.py reveals that you modifications to shcommon.py are gone and you have made no progress at all.

sbbosco commented 1 year ago

This command worked for me: url = 'https://raw.githubusercontent.com/ywangd/stash/dev/getstash.py'; import requests as r; exec(r.get(url).text.replace('master', 'dev'))

ikiziki commented 1 year ago

Seems as though the most recent TestFlight beta changed the name of the site-packages folder which broke pip. I'm guessing here...

Pip install now errors when trying to install packages.

I'm not talented enough to figure out a fix myself. Can anyone point me in the right direction?

ikiziki commented 1 year ago

image

Here's a screenshot of the error

sbbosco commented 1 year ago

@AltKrypto A quick fix that might work for you.

edit stash/lib/libdist.py under Python Modules / site-packages (user) to remove '-3'

    if six.PY3:
        #SITE_PACKAGES_DIR_NAME = "site-packages-3"
        SITE_PACKAGES_DIR_NAME = "site-packages"
    else:
ikiziki commented 1 year ago

@AltKrypto A quick fix that might work for you.

edit stash/lib/libdist.py under Python Modules / site-packages (user) to remove '-3'


    if six.PY3:

        #SITE_PACKAGES_DIR_NAME = "site-packages-3"

        SITE_PACKAGES_DIR_NAME = "site-packages"

    else:

That did the trick