0

I'm working on a tool that is auto generating python code (converting it from C#). I'm looking for a way to check if the generated code syntax is valid.

Is there a way to run a Python interpreter from C# and pass to it the generated files?

  • You can [run pyflakes on the file](https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it) once it is generated to check Syntax. If you want to do it from within C# code, you can use [this answer](https://stackoverflow.com/questions/206323/how-to-execute-command-line-in-c-get-std-out-results) – matszwecja Apr 27 '22 at 12:32
  • There are some ways to reach your goal. You can use validators like: https://github.com/atifaziz/CSharpSyntaxValidator – Dominik Apr 27 '22 at 12:33

0 Answers0