Drop Python 2 and conver to Python 3

Can I safely update my python 2 scripts to python 3 using pyrevit?

As I understand it, you should be able to. But I’ve learned that the future of PyRevit is probably going to keep going forward with both P3 AND P2.
P3 will offer some more luxuries like (hopefully) pip packages and modern syntax
P2 will offer robustness and better performance. (Because apparently ironpython interfaces more efficiently with dotnet than P3)

So the choice is up to you, I thought I’d just provide a bit more nuance that could help you make a choice.

1 Like

Then for now I’ll keep it py2. Thanks for that more in dept addition.

I’ve been doing some discord bot programming in my spare time which I’m coding in py3. So atm. I switching between py2 and py3. Result: print (“test”) in py2 and print “test” in py3.

I’ll keep things seperated for now: discord py3, pyrevit py2 and my brain … should just get used to it! :rofl:

slices = brain.split(len(brain)/2)
if IPY2:
   sclices[0]
else:
    slices[-1]
1 Like
import datetime

today = datetime.date.today()
is_monday = today.weekday() == 0

if is_monday:
   brain = False
else:
   slices = brain.split(len(brain)/2)
   if IPY2:
      sclices[0]
   else:
      slices[-1]
3 Likes