回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我想知道如何在Python中使用此页中的脚本:</p>
<p><a href="http://www.fmwconcepts.com/imagemagick/textcleaner/index.php" rel="nofollow noreferrer">http://www.fmwconcepts.com/imagemagick/textcleaner/index.php</a></p>
<p>下载时没有分机。我试着把它改名为“文本清理器.sh“并运行以下命令:</p>
<pre><code>import subprocess
subprocess.check_call(['textcleaner.sh', '-g', '-e', 'normalize', 'input_image.jpg', 'output_image.jpg'])
</code></pre>
<p>但是这样做的时候我得到了一个错误:</p>
<pre><code>Traceback (most recent call last):
File "C:/Users/ikdem/PycharmProjects/McAffeeeeeee/bash test.py", line 11, in <module>
subprocess.check_call(['textcleaner.sh', '-g', '-e', 'normalize', 'opl-small-1.jpg', 'output.jpg'])
File "C:\Users\ikdem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 579, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\ikdem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 560, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\ikdem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "C:\Users\ikdem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
</code></pre>