shuzijun / leetcode-editor

Do Leetcode exercises in IDE, support leetcode.com and leetcode-cn.com, to meet the basic needs of doing exercises.Support theoretically: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
https://plugins.jetbrains.com/plugin/12132-leetcode-editor
Apache License 2.0
3.75k stars 404 forks source link

The keyword 'nonlocal' can not be executed successfully. #659

Closed michael5182 closed 1 year ago

michael5182 commented 1 year ago

Problem: In python code, the keyword 'nonlocal' can not be executed successfully. The error message:

Compile Error
SyntaxError: invalid syntax
                  ^
    nonlocal solved
...

Situation: When I write the question [37]Sudoku Solver, I can't run the code copied from the editorial page successfully but the Leetcode browser compiler does.

Environment: LeetCode Editor Pro: 2023.1.2 Pycharm: 2023.1.4 Professional Edition. OS: macOS Monterey 12.6.8.

When I write the code containing nonlocal keyword, I copied the code into the Leetcode browser compiler to get the pass. Does anyone know how to to deal with this problem?

Thanks.

shuzijun commented 1 year ago

It is a keyword introduced by python3, check whether the configuration is correct.

image
michael5182 commented 1 year ago

Solved!

Thank you for your help.