HR / github-clone

:octocat: ⬇️ ⠀git clone repo subdirectories
https://git.io/ghclone
Apache License 2.0
179 stars 15 forks source link

error: raise HTTPError(http_error_msg, response=self) #3

Closed yansheng836 closed 5 years ago

yansheng836 commented 5 years ago

When I trying to execute the example code ,it presents a problem:

$ ghclone https://github.com/HR/Crypter/tree/master/app
Cloning into 'app'...
Traceback (most recent call last):
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 80, in clone
    r.raise_for_status()
  File "g:\python-3.7.1\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.github.com/repos/HR/Crypter/contents%5Capp?ref=master

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\python-3.7.1\Scripts\ghclone-script.py", line 11, in <module>
    load_entry_point('ghclone==1.1.0', 'console_scripts', 'ghclone')()
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 143, in main
    clone(api_req_url, rel_url, path, ref)
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 82, in clone
    exit_with_m('Failed to fetch metadata for ' + path, e)
TypeError: exit_with_m() takes from 0 to 1 positional arguments but 2 were given

In addition to this, when i pip the package ,it report a waring , I don't know if that will make a difference?

 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz

But it should have been installed successfully, as it show the result code:

 Installing collected packages: docopt, ghclone
  Running setup.py install for docopt: started
    Running setup.py install for docopt: finished with status 'done'
  Running setup.py install for ghclone: started
    Running setup.py install for ghclone: finished with status 'done'
Successfully installed docopt-0.6.2 ghclone-1.1.0

My envirement:

$ git --version
git version 2.21.0.windows.1

$ ghclone --version
1.1.0
yansheng836 commented 5 years ago

When I visit that url:https://api.github.com/repos/HR/Crypter/contents%5Capp?ref=master,it show like this:

{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3/repos/contents/#get-contents"
}
HR commented 5 years ago

I fixed it @yansheng836 try it now. The issue was that it wasn't windows-path-compatible but it should be now.

yansheng836 commented 5 years ago

Sorry, I don't know how to update this tool.Could you give me some suggestions?

HR commented 5 years ago

No worries. Just pip install it again

pip install git+git://github.com/HR/github-clone#egg=ghclone
yansheng836 commented 5 years ago

I had tried this ,but it seem no work

yansheng@MECHREVO MINGW64 /d/Users/yansheng/Desktop/新建文件夹 (2)
$ pip install git+git://github.com/HR/github-clone#egg=ghclone
Requirement already satisfied: ghclone from git+git://github.com/HR/github-clone#egg=ghclone in g:\python-3.7.1\lib\site-packages (1.1.0)
Requirement already satisfied: requests>=2.20.0 in g:\python-3.7.1\lib\site-packages (from ghclone) (2.21.0)
Requirement already satisfied: docopt>=0.6.2 in g:\python-3.7.1\lib\site-packages (from ghclone) (0.6.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in g:\python-3.7.1\lib\site-packages (from requests>=2.20.0->ghclone) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in g:\python-3.7.1\lib\site-packages (from requests>=2.20.0->ghclone) (2018.11.29)
Requirement already satisfied: idna<2.9,>=2.5 in g:\python-3.7.1\lib\site-packages (from requests>=2.20.0->ghclone) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in g:\python-3.7.1\lib\site-packages (from requests>=2.20.0->ghclone) (1.24.1)

yansheng@MECHREVO MINGW64 /d/Users/yansheng/Desktop/新建文件夹 (2)
$ ghclone https://github.com/HR/Crypter/tree/master/app
Cloning into 'app'...
Traceback (most recent call last):
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 80, in clone
    r.raise_for_status()
  File "g:\python-3.7.1\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.github.com/repos/HR/Crypter/contents%5Capp?ref=master

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\python-3.7.1\Scripts\ghclone-script.py", line 11, in <module>
    load_entry_point('ghclone==1.1.0', 'console_scripts', 'ghclone')()
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 143, in main
    clone(api_req_url, rel_url, path, ref)
  File "g:\python-3.7.1\lib\site-packages\ghclone\ghclone.py", line 82, in clone
    exit_with_m('Failed to fetch metadata for ' + path, e)
TypeError: exit_with_m() takes from 0 to 1 positional arguments but 2 were given
HR commented 5 years ago

That’s still the old version

Try uninstalling it and then reinstalling it. The current version is 1.2.0

yansheng836 commented 5 years ago

Thank you very much. The uninstall command $ pip uninstall git+git://github.com/HR/github-clone#egg=ghclone can work. Just like what you said, the new version tool can download the folder one of a repository.

The main reason is that I find the name of the library a bit strange, which I've never seen it. So I don't think the library can be uninstalled with this command and no have a try.

HR commented 5 years ago

It’s just pip uninstall ghclone

yansheng836 commented 5 years ago

I don't know why, it doesn't seem to work for me.

HR commented 5 years ago

Open your Python 3.3+ site-packages path and delete the following:

Then reinstall it

I tried 1.2.0 with a fresh Windows install just yesterday and everything worked fine.

yansheng836 commented 5 years ago

Ok, thank you for your answer.