繁体   English   中英

错误:PermissionError:[WinError 5]访问被拒绝:

[英]Error: PermissionError: [WinError 5] Access is denied:

我正在使用这个(trufflehog.py)python模块扫描任何github仓库

通过在Windows中从命令行使用CLI并获得准确的结果。

但是现在我正在尝试使用nodeJs.So我正在使用PythonShell,我将使用它来做与cli相同的事情。

NodeJs代码: -

var pythonShell= require("python-shell")

var options = {
 args: ['--regex','put your repo address here.']
};

pythonShell.PythonShell.run('truffleHog.py',options,function (err,results) {
  if (err) throw err;
console.log('finished'+err);
   console.log('results: %j', results);
});

但是从上面的代码得到了错误: -

Error: PermissionError: [WinError 5] Access is denied: 'C:\\Users\\sagar\\AppData\\Local\\Temp\\tmp6ji867wv'
    at PythonShell.parseError (E:\node_server\node_modules\python-shell\index.js:246:21)
    at terminateIfNeeded (E:\node_server\node_modules\python-shell\index.js:129:32)
    at ChildProcess.<anonymous> (E:\node_server\node_modules\python-shell\index.js:121:13)
    at ChildProcess.emit (events.js:189:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
    ----- Python Traceback -----
    File "C:\Users\sagar\AppData\Local\Programs\Python\Python38-32\lib\shutil.py", line 567, in _rmtree_unsafe
      os.rmdir(path)
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\sagar\\AppData\\Local\\Temp\\tmp6ji867wv'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "truffleHog.py", line 312, in <module>
      main()
    File "truffleHog.py", line 57, in main
      output = find_strings(args.git_url, args.since_commit, args.max_depth, args.output_json, args.do_regex, do_entropy, surpress_output=False, branch=args.branch, repo_path=args.repo_path)
    File "truffleHog.py", line 303, in find_strings
      shutil.rmtree(project_path, onerror=del_rw)
    File "C:\Users\sagar\AppData\Local\Programs\Python\Python38-32\lib\shutil.py", line 681, in rmtree
      return _rmtree_unsafe(path, onerror)
    File "C:\Users\sagar\AppData\Local\Programs\Python\Python38-32\lib\shutil.py", line 569, in _rmtree_unsafe
      onerror(os.rmdir, path, sys.exc_info())
    File "truffleHog.py", line 83, in del_rw
      os.remove(name)

弄清楚这个问题会很棒。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM