execl difficulty

Bengt Richter bokr at oz.net
Sun Dec 14 16:32:05 EST 2003


On Sun, 14 Dec 2003 20:53:10 GMT, "python newbie" <mesteve_b at hotmail.com> wrote:

>Can anyone tell me why this would cause "Invalid Number of Parameters" while
>trying to compile (or interpret or whatever)
>
>import os
>os.execl("C:/WINDOWS/system32/xcopy.exe","E:/MainWeb/dreampics/*.*","E:/Main
>Web/dp")
>
>Here's what the Python reference says:
>     execl(path,arg0, arg1, ...)
>
>if you can see something obvious, please tell me

I think xcopy uses suffixed optional forward-slash switch options, so it might be getting confused?
I'd try (note the 'r' prefixes for raw string literals):

    os.execl(r"C:\WINDOWS\system32\xcopy.exe", r"E:\MainWeb\dreampics\*.*", r"E:\MainWeb\dp")

I don't know what the length or count limits might be on expansion of "*.*" but hopefully
it it pretty big.

Regards,
Bengt Richter




More information about the Python-list mailing list