Discuss / Python / 没看懂是啥意思, win7 环境下 拷贝了 廖大的文件丢在www目录下,运行报错...

没看懂是啥意思, win7 环境下 拷贝了 廖大的文件丢在www目录下,运行报错...

Topic source

一雷叔一

#1 Created at ... [Delete] [Delete and Lock User]

没看懂是啥意思, win7 环境下 拷贝了 廖大的文件丢在www目录下,运行报错...

[Monitor] Watching directory g:\Work File\awesome-python3-webapp\www... [Monitor] Start process python3 wsgiapp.py... Traceback (most recent call last): File "pymonitor.py", line 71, in <module> startwatch(path, None) File "pymonitor.py", line 54, in startwatch start_process() File "pymonitor.py", line 43, in start_process process = subprocess.Popen(command, stdin=sys.stdin, stdout=sys.stdout, stde rr=sys.stderr) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\subpro cess.py", line 950, in __init restore_signals, start_new_session) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\subpro cess.py", line 1220, in _execute_child startupinfo) FileNotFoundError: [WinError 2] 系统找不到指定的文件。

万凯明

#2 Created at ... [Delete] [Delete and Lock User]

按照如下修改即可解决

if __name__ == '__main__':
    argv = sys.argv[1:]
    if not argv:
        print('Usage: ./pymonitor your-script.py')
        exit(0)
    if argv[0] != 'python':  # 这里用python不要用python3除非你的系统也是用python3 XX.PY来启动python程序的
        argv.insert(0, 'python')
    command = argv
    path = os.path.abspath('.')
    start_watch(path, None)

小提示:所有的python3都要改成python

英睿都督

#4 Created at ... [Delete] [Delete and Lock User]

我在win10下运行: 拷贝pymonitor.py到www目录下,再把文件中的python3改成python. if name == 'main': argv = sys.argv[1:] if not argv: print('Usage: ./pymonitor your-script.py') exit(0) if argv[0] != 'python': argv.insert(0, 'python') command = argv path = os.path.abspath('.') start_watch(path, None) 运行>python pymonitor.py app.py就ok了 ps:廖大这个python3 pymonitor.py wsgiapp.py里的wsgiapp.py指的是要启动的程序app.py吧,总之我是这样理解的

我的也是这个问题,已经能用了

我也是这个问题,把所有python3改成python就好了。原因大概是平时我们使用的时候,打开python3,都是直接用的python命令


  • 1

Reply