rvojcik / gitlab-project-export

Simple python project for exporting GitLab projects with Export Project funkcionality in GitLab API. Import of exported projects is also supported
GNU General Public License v3.0
104 stars 39 forks source link

Import GitLab project error #4

Closed jiteshgupta1995 closed 3 years ago

jiteshgupta1995 commented 4 years ago

Hi,

I am trying to export one of the gitlab project and import it. While importing at first I got the issue,

AttributeError: module 'urllib' has no attribute 'quote'

But I resolved by changing the
urllib.quote(project_path, safe='') -> urllib.parse.quote(project_path, safe='')

Later while importing the file I am getting following issue:

File "gitlab-project-import.py", line 60, in <module>
    status = gitlab.project_import(args.project_path, args.filepath)
  File "....\gitlab-project-export\lib\gitlab.py", line 191, in project_import
    r = self.__api_import(project_name, namespace, filepath)
  File "....\gitlab-project-export\lib\gitlab.py", line 43, in __api_import
    headers=self.headers)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 459, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 317, in prepare
    self.prepare_body(data, files, json)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 505, in prepare_body
    (body, content_type) = self._encode_files(files, data)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 159, in _encode_files
    fdata = fp.read()
  File "....\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 111: character maps to <undefined>

Any idea how to resolve this?

rvojcik commented 4 years ago

Hi, thank you for your report. It looks like some problem with non Unicode characters. I'll try it later this week and I also fix the new urllib call

rvojcik commented 4 years ago

Thank you @matandd ! Looks great.

@jiteshgupta1995 could you please confirm that @matandd change fix your problem ?

Thx

jiteshgupta1995 commented 4 years ago

Yes, thanks a lot.