[issue39147] using zipfile with root privilege shows FileNotFoundError

Patrick Liu report at bugs.python.org
Sat Dec 28 04:56:02 EST 2019


New submission from Patrick Liu <liupeifox at gmail.com>:

When I run the python script with root privilege, it can clone the repo successfully but with the error message as follow.
However, it runs correctly with normal user.
Why it cannot find the html file? Thanks.

Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from git_clone import git_clone
>>> git_clone('https://github.com/android9527/android9527.github.io')
13472.0 KB, 13574 KB/s, 0.99 seconds passed         Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/anaconda3/lib/python3.7/site-packages/git_clone/git_clone.py", line 53, in git_clone
    f.extractall(path + '/.')
  File "/root/anaconda3/lib/python3.7/zipfile.py", line 1619, in extractall
    self._extract_member(zipinfo, path, pwd)
  File "/root/anaconda3/lib/python3.7/zipfile.py", line 1673, in _extract_member
    open(targetpath, "wb") as target:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/fit-Knowledgezoo/test/android9527.github.io-master/2019/01/24/2019-01-24-Java 重入锁 synchronized /index.html'
>>> exit()

----------
messages: 358937
nosy: Patrick Liu
priority: normal
severity: normal
status: open
title: using zipfile with root privilege shows FileNotFoundError
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39147>
_______________________________________


More information about the Python-bugs-list mailing list