pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Condition on generated code for function() or die() is backwards

Open snoopyjc opened this issue 3 years ago • 1 comments

Given this perl code:

open(FILE,'<',$file) or die("cannot open $file $!");

The generated python code is calling the die() routine if the open succeeds, instead of fails:

if(FILE:=open(file,'r')):
   sys.exit(f"cannot open {file} {sys.last_value}")

snoopyjc avatar Nov 07 '21 07:11 snoopyjc

Fixed in https://github.com/snoopyjc/pythonizer

snoopyjc avatar Feb 07 '22 16:02 snoopyjc