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'

Answers

  • Jessica RJessica R Posts: 1,319 Rose Gold 4

    Thanks for your post!

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

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • gk70gk70 Posts: 2 New member
    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
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    edited March 1, 2021 9:21PM
    Thanks @gk70! Apologies for not remembering this before, but the Python generator only supports Python 2.7 or earlier.

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.