Krikov Posted February 28, 2008 Share Posted February 28, 2008 Hello, did any one try ever to run Python Script From Autoit My Problem is to Run an Python Script With Two Parameters that i read from 2 Input Box when i run the script i get "File Not Found" Python Code import sys; import glob; import os; dirs = []; def listFiles( outFile, path ): files = glob.glob( path + "\\*" ); for f in files: sys.stderr.write( f + "\n" ); if os.path.isfile( f ): outFile.write( f + "\n" ); if os.path.isdir( f ): dirs.append( f ); def main( argv ): FROM_PARAM_INDEX = 1; TO_PARAM_INDEX = 2; LIST_FROM = argv[FROM_PARAM_INDEX]; LIST_TO = argv[TO_PARAM_INDEX]; dirs.append( LIST_FROM ); outFile = file( LIST_TO, "w" ); while ( len(dirs) > 0 ): dir = dirs.pop( 0 ); listFiles( outFile, dir ); outFile.close(); if __name__ == "__main__": sys.exit( main( sys.argv ) ); And This is The Run Command RunWait("ListFile.py "&(GUICtrlRead($Input1))&" "&(GUICtrlRead($Input2))) The system cannot find the file specified. [topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic] Link to comment Share on other sites More sharing options...
GEOSoft Posted February 28, 2008 Share Posted February 28, 2008 Hello, did any one try ever to run Python Script From Autoit My Problem is to Run an Python Script With Two Parameters that i read from 2 Input Box when i run the script i get "File Not Found" Python Code import sys; import glob; import os; dirs = []; def listFiles( outFile, path ): files = glob.glob( path + "\\*" ); for f in files: sys.stderr.write( f + "\n" ); if os.path.isfile( f ): outFile.write( f + "\n" ); if os.path.isdir( f ): dirs.append( f ); def main( argv ): FROM_PARAM_INDEX = 1; TO_PARAM_INDEX = 2; LIST_FROM = argv[FROM_PARAM_INDEX]; LIST_TO = argv[TO_PARAM_INDEX]; dirs.append( LIST_FROM ); outFile = file( LIST_TO, "w" ); while ( len(dirs) > 0 ): dir = dirs.pop( 0 ); listFiles( outFile, dir ); outFile.close(); if __name__ == "__main__": sys.exit( main( sys.argv ) ); And This is The Run Command RunWait("ListFile.py "&(GUICtrlRead($Input1))&" "&(GUICtrlRead($Input2))) The system cannot find the file specified.The runwait is probably looking for a path in front of "ListFile.py" Also look in the help file for ShellExecuteWait. It may work better for you. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Krikov Posted February 29, 2008 Author Share Posted February 29, 2008 Thanks But when i try the ShellExecuteWait i still get the same error The system cannot find the file specified. the only way that i waz sucessed to run the Python script is with _RunDos but this is not very good for me cuz when i try to select a folder with Hebrew Characters the Dos Windows Show me gibberish font and the script not running so i must solve it with RunWait or ShellExecuteWait Krikov [topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic] Link to comment Share on other sites More sharing options...
GEOSoft Posted February 29, 2008 Share Posted February 29, 2008 Thanks But when i try the ShellExecuteWait i still get the same error The system cannot find the file specified. the only way that i waz sucessed to run the Python script is with _RunDos but this is not very good for me cuz when i try to select a folder with Hebrew Characters the Dos Windows Show me gibberish font and the script not running so i must solve it with RunWait or ShellExecuteWait KrikovDid You check for the path to the file? If it's in the same folder as the au3 file then you could use RunWait(@ScriptDir & "\ListFile.py "&(GUICtrlRead($Input1))&" "&(GUICtrlRead($Input2))) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Starschaser Posted March 15, 2011 Share Posted March 15, 2011 Hello, i am having the same problem of not able to run python in Autoit.. the scenario is that i have a script at C:\Python25\ and the python script is Audio_Play.py which takes argument of filename to play like sound.mp3 so the Command i use in normal window run is : C:\Python25\Audio_Play.py sound.mp3 how can this be called in Autoit?? and also is it possible to return a value from called python function to autoit ? Thanks nd Regards Link to comment Share on other sites More sharing options...
Krikov Posted March 15, 2011 Author Share Posted March 15, 2011 (edited) Hello, i am having the same problem of not able to run python in Autoit.. the scenario is that i have a script at C:\Python25\ and the python script is Audio_Play.py which takes argument of filename to play like sound.mp3 so the Command i use in normal window run is : C:\Python25\Audio_Play.py sound.mp3 how can this be called in Autoit?? and also is it possible to return a value from called python function to autoit ? Thanks nd Regards Hi first of all you can try to complie the PY File to EXE like PY2EXE take a look at this link :http://www.ehow.com/how_2091641_compile-python-code.html or try to use the Pyton.exe Audio_Play.py sound.mp3 and the Autoit Command will : $Run = RunWait("C:\Pyton25\Pyton.exe Audio_Play.py sound.mp3","") Krikov Edited March 15, 2011 by Krikov [topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic] Link to comment Share on other sites More sharing options...
Starschaser Posted March 15, 2011 Share Posted March 15, 2011 thanks for the reply.. i tried to using py2exe but its still not working.. normally on command prompt its running fine.. but wen i try it using Autoit i'm not able to.. wat might be the problem?? Link to comment Share on other sites More sharing options...
Starschaser Posted March 15, 2011 Share Posted March 15, 2011 other .exe files are running but no luck with .exe of python from py2exe. $Run = RunWait("C:\Pyton25\Pyton.exe Audio_Play.py sound.mp3","") and also the above command is also not working. Link to comment Share on other sites More sharing options...
saywell Posted March 15, 2011 Share Posted March 15, 2011 $Run = RunWait("C:\Pyton25\Pyton.exe Audio_Play.py sound.mp3","")If that's a cut & paste from your script*, the missing 'h's might be a problem.William* as opposed to typos if you typed it directly into the forum Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now