You'll need to do the ReadLine() just once in each iteration of the loop so that you don't get the P1 from one line pairing with the P2 from the next line, something like this:

set file=##class(%Stream.FileCharacter).%New()

do file.LinkToFile("c:\location of csv")

for  quit:file.AtEnd  set line=file.ReadLine() set ^GLOBAL($piece(line,",",1),$piece(line,",",*))=""


USER>k temp  set $LIST(temp,31)="",myVar=$LISTTOSTRING(temp,"=?",1)
USER>w myVar

You mentioned that you ran, but you are running Python version 3.6.0.

I believe is the install for Python 2. Have you also tried running i.e.

  • python3 install