ImportError: Import by filename is not supported when unpickleing

Nobody nobody at nowhere.invalid
Thu Jul 28 08:51:45 EDT 2016


On Wed, 27 Jul 2016 22:47:15 -0400, Larry Martell wrote:

> Also let me add that initially I was calling Popen with shell=False and
> the arguments in a list, and that was failing with:
> 
> arg 2 must contain only strings

That indicates that you're calling Popen() incorrectly.

> And when I debugged I found that this was happening in the execvp call in
> subprocess and arg 2 was a str. So then I changed it using shell=False
> with the command line in a string, and that is when I get the  ImportError
> error.

This is just hiding the error. Passing the command line as a string will
result in the string being parsed in some way (the details depend upon the
OS). Unless the string was assembled with the correct quoting, this will
corrupt the string.

I'd suggest starting off by ensuring that the string received by the child
process is the one which you intended to pass. Calculate and display (or
log) its hash (see the hashlib module) in both the sender and receiver and
confirm that they're the same.




More information about the Python-list mailing list