3

At the moment, we are using jinja2 to generate python code. And the file would have both jinja template code and python code as well. The problem is pycharm (we use community edition) are not happy with this. It's mark it as a syntax error, that is so inconvenient. Like this:

//python code 
{% include 'templates/base.py'%} 
//python code 

Do you have any solution to make IDE understand this and will not mark it as syntax error? Since we need code completion in these files.

Thank you very much!

trongd
  • 273
  • 2
  • 9
  • Python itself is so dynamic that I can not see a valid usecase for creating code dynamically. So, what is the idea behind that? – Klaus D. Feb 24 '16 at 08:14
  • I don't think it will mark it as a syntax error. What is the file extension? – Selcuk Feb 24 '16 at 09:00
  • @Selcuk the file extension is .py – trongd Feb 25 '16 at 06:59
  • @KlausD. Basically, we use python for a drawing script. There are 2 process: 1 - build and 2 run-time. At build time, we use jinja2 to generate different python code. And at run-time, it executes python code and draw objects – trongd Feb 25 '16 at 07:04
  • @trongd The file extension is your problem. PyCharm thinks that you are writing Python code, so it expects valid Python code. – Selcuk Feb 25 '16 at 10:46

0 Answers0