in reply to call python from perl cause error

produce error

What means produce?

Any way to modify the Perl script to eliminate the error?

No. Consider

$ perl -e " $foo = qx{perl -e \x22system q/ping 127.6.6.6 >NUL/\x22} " $ $ perl -e " $foo = qx{perl -e \x22system q/ping 127.6.6.6 >&NUL/\x22} +" >& was unexpected at this time. $ perl -e " $foo = qx{perl -e \x22system q/ping 127.6.6.6 &>NUL/\x22} +" The syntax of the command is incorrect.

The error messages produced are what cmd.exe spits out on STDERR when invoked via system

Now you might be able to consume STDERR with Try::Tiny, or simply redirect it with  2>NUL ...

Does that work for you?

Treasure trove of shell links

See also

Replies are listed 'Best First'.
Re^2: call python from perl cause error
by anaconda_wly (Scribe) on Aug 09, 2013 at 08:52 UTC

    Not just to eliminate the error message, I'd like not to produce the error.

    On win2k3, when from the Perl process starting another Python process, and in Python execute redirection commands, this error happens.

    When I type "test.py" in cmd promp and execute, will execute well without error; When I execute "perl test.pl" to call it, the error happens......

      Not just to eliminate the error message, I'd like not to produce the error.

      First you have to figure out which program/process produces the error