How to have python 2 and 3 both on windows?

Dennis Lee Bieber wlfraed at ix.netcom.com
Sat Apr 23 23:44:21 EDT 2022


On Sun, 24 Apr 2022 01:19:38 +0000 (UTC), Sunil KR <krlinus at yahoo.com>
declaimed the following:

>
>-- Why are my strings being sent to python3, so that I get the unicode related error?
>-- in other cases I see error pertaining to the print function

	In python2, the default for strings is BYTES -- you must explicitly ask
for unicode (for literals, using u'literal' notation). Python3 strings are,
by default, interpreted as unicode (with the encoding for source code [and
hence, literals] specified somewhere via a special comment). Getting a
normal python2 string requires using the b'literal' notation to indicate
/bytes/.

	Also, in Python2, print is a language statement, not a function. If you
have any print statements that do not have ( ) surrounding the output
items, it WILL fail in Python3.

>In my case, I don't own the python2 scripts and so I am not allowed to change any part of them. And I wouldn't need to either, if I can make python 2 and 3 coexist on my system
>

	Even if you are not "allowed to change" those scripts, have you tried
feeding them through the 2to3 conversion script just to see what type of
changes would be required?
https://docs.python.org/3/library/2to3.html


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list