ywangd / stash

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

No module named 'urlparse' for python3 #321

Open yjqiang opened 6 years ago

yjqiang commented 6 years ago

StaSh v0.7.0 on python 3.6.1 Warning: you are running StaSh in python3. Some commands may not work correctly in python3. Please help us improving StaSh by reporting bugs on github. Tip: Use mc to access files in your Dropbox or on a FTP-Server [~/Documents]$ git Opening: https://github.com/jsbain/gittle/archive/master.zip

Save as: /private/var/mobile/Containers/Data/Application/****/tmp//gittle.zip (??? bytes) 28334 Opening: https://github.com/FriendCode/funky/archive/master.zip

Save as: /private/var/mobile/Containers/Data/Application/****/tmp//funky.zip (??? bytes) 8474 stash: <class 'ModuleNotFoundError'>: No module named 'urlparse'

[~/Documents]$

l1m0n3 commented 6 years ago

use python2 and edit some line in 'git.py'.

  1. modify 'urlparse.urlparse(...)' to 'urlparse(...)' (modify 'urlparse.urlunparse(...)' too)

  2. import 'urlunparse' from 'six.moves.urllib.parse'

  3. delete 'config.write_to_path()' from 'get_config_or_prompt()'

yjqiang commented 6 years ago

@l1m0n3 Thanks. But I want to keep this issue open since it looks like this project will abandon python2. So I think it is a bug for python3 user.

l1m0n3 commented 6 years ago

Unfortunately, some libraries are not compatible with python3... So its kind of hard to fix it :(

bennr01 commented 6 years ago

since it looks like this project will abandon python2

It is unlikely that we abandon python2 anytime soon. There is simply no reason to do so. The only reason we may have sometime in the future to abandon python2 would be if pythonista stopped supporting python2.

dan3dewey commented 6 years ago

Yes, it is a problem for this python 3 user ;-) (Note the app is called "Pythonista 3" on the apple store.) Is there an alternate way to clone a git repo into pythonista using StaSh, or otherwise?

Are other packages required: there was also a "dulwich" requirement to run git: Installing StaSh on an iPhone 6s I get the same startup messages as the OP, but then typing [~/Documents]$ git Produces: dulwich was not found. Will attempt to download. ... [y/n]? y which, as with OP above, ends with: stash: <class 'ModuleNotFoundError'>: No module named 'urlparse'

bennr01 commented 6 years ago

@dan3dewey Well, you can still run StaSh in python2 (works also in pythonista 3) until git is ported. You could even run a py2 StaSh-instance and a py3 StaSh-instance next to each other at the same time, so you could use 'git' in py2 StaSh and do your py3 work in the py3 StaSh instance.

dan3dewey commented 6 years ago

@bennr01 Yes, that works fine - thanks.

andreiw commented 6 years ago

@l1m0n3 thanks, your edits made git push work with py2. @ywangd will you make these changes part of StaSh?

kimber409 commented 6 years ago

Is there a fix for it yet on Pythonista 3?

yjqiang commented 6 years ago

Is there a fix for it yet on Pythonista 3?

Not yet for now. You should use python2 to run stash. Or if you just want to clone it, you can use wget.

TAbdiukov commented 5 years ago

thanks

cclauss commented 5 years ago

Could we please fix our git dependencies to work on Python instead of requiring StaSH to run on legacy Python? https://github.com/jsbain/gittle seems to be many commits behind the Python 3 changes to its upstream. 213 days until Python 2 end of life.

bennr01 commented 5 years ago

Could we please fix our git dependencies to work on Python instead of requiring StaSH to run on legacy Python? https://github.com/jsbain/gittle Seems to be many commits behind the Python 3 changes to its upstream. 213 days until Python 2 end of life.

What exactly do you mean? Are you proposing that we should completeley drop py2 and only focus on py3? I dont think that would be a good idea. Before we should discontinue support for py2, we should have at least one version of StaSh supporting both py2 and py3, otherwise we create some sort of frankenstein monster which neither runs on py2 nor py3 correctly.

If you mean we should just switch to mainstream gittle then i support that idea. I have experimented with porting git to py3 a few times and it seems that using pip install <dependencies here> for dependency installation would fix a few things.

Honestly i think git does need a complete rewrite, but that would be a ton of work. IIRC dulwich.porcelain could largely replace gittle, but last time i checked (~half a year ago), it was still missing some important features regarding remote, merge and status. If anyone is interested, i still have code from an old attempt for a complete rewrite somewhere in my files.

cclauss commented 5 years ago

I am fine with 2+3 but at a minimum, StaSH git should work on Python 3.

yjqiang commented 5 years ago

There are many things like basestring and urlparse. Even I fixed this, then I got KeyError "thin-pack".

luckydonald commented 4 years ago

Okey, with python 2 now officially dead, how's it going?

yjqiang commented 4 years ago

Okey, with python 2 now officially dead, how's it going?

But python is still supported on pythonista. And we don’t know what’s omz’s plan about this.

TAbdiukov commented 4 years ago

@luckydonald unfortunately the reality is, sometimes py2 is still dead required

cclauss commented 4 years ago

Py2 is still required on iOS?

TAbdiukov commented 4 years ago

@cclauss i have no affiliation with this repo (just bookmarked this issue since it comes up often), and idk much about iOS Py2 programming, but I use an amazing package called pwntools, and it pretty much requires Py2. The sooner we move on to Py3, the sooner we will live the up-to-date programming life

cclauss commented 4 years ago

These repos WANT to be on Python 2... pwntools: https://github.com/Gallopsled/pwntools/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed pupy: https://github.com/n1nj4sec/pupy/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed