How can we help you today? How can we help you today?

Simple python script throws error even after env path set to C:\python39

Hi,
I tried a simple script per https://forum.red-gate.com/discussion/comment/136911#Comment_136911.
Error: Syntax Error: unexpected token 'clr'

gk70
0

Comments

3 comments

  • Jessica R

    Thanks for your post!

    Are you able to share the exact script that you've entered?

    Jessica R
    0
  • gk70
    import clr 
    clr.AddReference("System") 
    from System import Random 
    random = Random(); 
    
    def main(config): 
        return str(random.Next(1, 3<span>));</span>
    This was done since I had used latest python version 3.9 instead of 2.7 .For now I am able to work after downloading python 2.7 with path added to env variable.But was curious to know if I could use the methods in .NET
    gk70
    0
  • Jessica R
    Thanks @gk70! Apologies for not remembering this before, but the Python generator only supports Python 2.7 or earlier.
    Jessica R
    0

Add comment

Please sign in to leave a comment.