OSError:[WinError 193]%1不是有效的Win32应用程序

卡克斯顿:

我试图从带有子进程的python解释器中调用python文件“ hello.py”。但是我无法解决此错误。[Python 3.4.1]。

import subprocess    
subprocess.call(['hello.py', 'htmlfilename.htm'])
Traceback (most recent call last):
  File "<pyshell#42>", line 1, in <module>
    subprocess.call(['hello.py', 'htmlfilename.htm'])
  File "C:\Python34\lib\subprocess.py", line 537, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Python34\lib\subprocess.py", line 858, in __init__
    restore_signals, start_new_session)
  File "C:\Python34\lib\subprocess.py", line 1111, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

除了使用子进程以外,还有没有其他方法可以“使用参数调用python脚本”?提前致谢。

大卫·赫弗南(David Heffernan):

错误非常明显。该文件hello.py不是可执行文件。您需要指定可执行文件:

subprocess.call(['python.exe', 'hello.py', 'htmlfilename.htm'])

您需要python.exe在搜索路径上可见,或者可以将完整路径传递给运行调用脚本的可执行文件:

import sys
subprocess.call([sys.executable, 'hello.py', 'htmlfilename.htm'])

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Anaconda / Orange3产生OSError:[WinError 193]%1不是有效的Win32应用程序

OSError:[WinError 193]%1不是有效的Win32应用程序opencv.js

如何解决“ OSError:[WinError 193]%1不是有效的Win32应用程序”

如何修复Jupyter Notebook熊猫错误(OSError:[WinError 193]%1不是有效的Win32应用程序)

OSError: [WinError 193] %1 在使用 ctypes 时不是有效的 Win32 应用程序

WinError 193]%1不是有效的Win32应用程序

Python [WinError 193]%1不是有效的Win32应用程序

OSError:[WinError 193]%1不是有效的Win32应用程序错误,在Windows上通过Selenium和Python使用GeckoDriver和Firefox

OSError:[WinError 193]%1不是有效的Win32应用程序,同时使用CTypes读取python中的custim DLL

pycharm-selenium-python:无法启动 chromedriver 服务 - [WinError 193] %1 不是有效的 Win32 应用程序

CreateProcess错误= 193,%1不是有效的Win32应用程序-> [帮助1]

IOException:无法运行程序:CreateProcess错误= 193,%1不是有效的Win32应用程序

错误:java.io.IOException:CreateProcess错误= 193,%1不是有效的Win32应用程序

Pycharm与Electron -Runnerw.exe:CreateProcess失败,错误193:%1不是有效的Win32应用程序

读取Perl脚本错误:CreateProcess错误= 193,%1不是有效的Win32应用程序

pyinstaller 錯誤:OSError: [WinError 6] 句柄無效

通过Java和Selenium启动Internet Explorer时出现“ OsProcess checkForError:CreateProcess错误= 193,%1不是有效的Win32应用程序”

DLL加载失败:%1不是有效的Win32应用程序-Appcelerator

JNI C ++ DLL-'UnsatisfiedLinkError:%1不是有效的Win32应用程序'

Python:DLL加载失败:%1不是有效的Win32应用程序

PHP加载错误:%1不是有效的Win32应用程序。

Rails 3.2.1:%1不是有效的Win32应用程序。-c:/ RailsInstaller

错误:%1不是有效的Win32应用程序

psexec %1 不是有效的 Win32 应用程序

Qt 和 Web 服务器应用程序 OSError: [WinError 10038] 尝试对不是套接字的东西进行操作

VLC.DotNet System.ComponentModel.Win32Exception:'%1不是有效的Win32应用程序'

为什么很少用“%1不是有效的Win32应用程序”代替%1。

启动安装程序时不是有效的win32应用程序

Wampserver gibin 不是带有 php 5.4 的有效 Win32 应用程序