Opened 8 years ago
Last modified 6 years ago
#3162 new defect
Quote script module path when calling its gui from parser
Reported by: | marisn | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.4.5 |
Component: | Parser | Version: | svn-trunk |
Keywords: | python | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Currently parser will fail if a script module path contains spaces:
grass_trunk > python /home/maris/nezinatniskie_projekti/Zinatnes\ nakts\ 2016/gol.py Traceback (most recent call last): File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 2962, in <module> task.set_options(cmd[1:]) File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/task.py", line 299, in set_options key, value = opt.split('=', 1) ValueError: need more than 1 value to unpack
The problem comes from recreate_command in lib/gis/parser.c invoking forms.py and passing all args as a single string. Forms.py expect each space to be an argument separator thus causing failure in option parsing. Easiest workaround is to quote module path and name while calling forms.py.
I'm attaching patch that provides required quoting and thus allows to have script modules to be located in a path with spaces. As parser is quite sensitive thing (too easy to break something by accident), I haven't it applied to svn myself to get some feedback first. If it will be considered to be safe, backport to all 7.x is needed.
Attachments (1)
Change History (8)
by , 8 years ago
Attachment: | parser_quote_prog_name.patch added |
---|
follow-up: 4 comment:1 by , 7 years ago
Keywords: | python added |
---|
Ping Pythonistas. Is it safe to commit this patch or forms.py should be changed?
comment:3 by , 6 years ago
Milestone: | 7.4.1 → 7.4.2 |
---|
comment:4 by , 6 years ago
Replying to marisn:
Ping Pythonistas. Is it safe to commit this patch or forms.py should be changed?
Perhaps apply the patch in trunk? Otherwise feedback does not seem to come up...
lib/gis/parser.c patch quoting program name