Trying to make a simple Python script run inside Maxscript


#1

Hi,

I decided to try and do a date comparison inside my Maxscript using Python! I found this snippet online:

from datetime import date
d0 = date(2017, 8, 18)
d1 = date(2017, 10, 26)
delta = d1 - d0
print(delta.days)

And I thought I’d have a go at trying to running this. This is a far as I got, LOL!

bi = Python.Import("datetime")	
d0 = bi.date(2020,8,6)

Which gives me this error:

– Error occurred in anonymous codeblock; filename: ; position: 54; line: 3
– Syntax error: at , expected
– In line: d0 = bi.date(2020,8

I’ve read the “Executing Python from MAXScript” bit in the manual, but didn’t find it to be much help. Does anyone have any pointers? Thanks!