the new python 3 code should call the existing functions..
challenges eg: .find .strip, .split
use : theText.split("\n") does not work anymore
use split(b"\n")
that also seems to work with python2
eg:
- Code: Select all
cmd= "ps -ef | grep '.py' | grep -v grep"
ret = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[0]
lines = ret.split(b"\n")
works
w/o the b infront of the "\n" it complains
and
import Queue
is now
import queue
and
soc.send(theText)
is now
soc.send(bytes(theText,"utf8"))
and unicode("some text") not good
etc etc
Do we want to go to python 3 in indigo?
That would be a major undertaking I guess.
BUT I like to write code from here on that works under 2 and 3 .. any pointers to some GOOD lectures?
Karl