Hi, Folks: I am using Python in WSH. However, I got a strange problem on my computer. Here is a small program to show the problem.
# xxx.pys objArgs = WScript.Arguments for i in xrange(objArgs.Count()): WScript.Echo(objArgs(i)) WScript.Echo('Total %d arguments.' % objArgs.Count()) If I execute this document by following command, the objArgs.Count() always return 0 and no argument was included. > xxx.pys 1 2 3 4 Because, the script will show "Totals 0 arguments", the program can be executed normally. It just can't get the arguments. However, if I use following command to execute the script. I can get the arguments. > wscript.exe xxx.py 1 2 3 4 If I drag some documents and drop them onto the icon of xxx.pys file, it still can't get the arguments. I am sure that the DropHandler has been set properly. Finally, I use a wsf file to embeded the same script file. It looks like this: <?xml version="1.0" ?> <package id="xxx"> <job id="myjob"> <comment>blah blah</comment> <script language="python"> <![CDATA[ objArgs = WScript.Arguments for i in xrange(objArgs.Count()): WScript.Echo(objArgs(i)) WScript.Echo('Total %d arguments.' % objArgs.Count()) ]]> </script> </job> </package> This wsf file can work very well. When I drop some files onto it, it can show the path of those documents. However, I just want to know why my pys file can't work. Does anyone have the same situation? Is it my pywin32 package corrupted? I've downloaded the last pywin32 package and executed the site-packages\win32comext\axscript\client\pyscript.py to register the PyScript. But, the problem is still there. Sincerely yours, Gary -- http://mail.python.org/mailman/listinfo/python-list