stash icon indicating copy to clipboard operation
stash copied to clipboard

No module named 'urlparse' for python3

Open yjqiang opened this issue 7 years ago • 21 comments

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]$

yjqiang avatar May 07 '18 17:05 yjqiang

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()'

l1m0n3 avatar May 08 '18 15:05 l1m0n3

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

yjqiang avatar May 11 '18 08:05 yjqiang

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

l1m0n3 avatar May 11 '18 08:05 l1m0n3

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.

bennr01 avatar May 11 '18 09:05 bennr01

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'

dan3dewey avatar May 28 '18 16:05 dan3dewey

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

bennr01 avatar May 28 '18 16:05 bennr01

@bennr01 Yes, that works fine - thanks.

dan3dewey avatar May 28 '18 20:05 dan3dewey

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

andreiw avatar Jun 29 '18 03:06 andreiw

Is there a fix for it yet on Pythonista 3?

kimber409 avatar Sep 23 '18 14:09 kimber409

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.

yjqiang avatar Oct 31 '18 23:10 yjqiang

thanks

TAbdiukov avatar Apr 11 '19 17:04 TAbdiukov

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.

cclauss avatar Jun 02 '19 10:06 cclauss

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.

bennr01 avatar Jun 02 '19 10:06 bennr01

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

cclauss avatar Jun 02 '19 11:06 cclauss

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

yjqiang avatar Jun 02 '19 11:06 yjqiang

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

luckydonald avatar Jan 29 '20 19:01 luckydonald

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.

yjqiang avatar Jan 29 '20 23:01 yjqiang

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

TAbdiukov avatar Jan 30 '20 22:01 TAbdiukov

Py2 is still required on iOS?

cclauss avatar Jan 30 '20 22:01 cclauss

@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

TAbdiukov avatar Jan 30 '20 22:01 TAbdiukov

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

cclauss avatar Jan 30 '20 22:01 cclauss