Skip to content

Commit

Permalink
GUI: sync GConsole skipInterface handling with g.parser (#3375)
Browse files Browse the repository at this point in the history
  • Loading branch information
landam committed Jan 26, 2024
1 parent 12152c5 commit fd3f484
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions gui/wxpython/core/gconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,14 +634,13 @@ def RunCmd(
skipInterface = True
if os.path.splitext(command[0])[1] in (".py", ".sh"):
try:
sfile = open(command[0], "r")
for line in sfile.readlines():
if len(line) < 2:
continue
if line[0] == "#" and line[1] == "%":
skipInterface = False
break
sfile.close()
with open(command[0], "r") as sfile:
for line in sfile.readlines():
if len(line) < 3:
continue
if line.startswith(("#%", "# %")):
skipInterface = False
break
except OSError:
pass

Expand Down

0 comments on commit fd3f484

Please sign in to comment.