Hello,
If you give an illegal output name to i.rectify, this is only tested after rectification. This should be done before in order to have to wait for the whole process to finish to then notice it won't work.
Moritz
Hello,
If you give an illegal output name to i.rectify, this is only tested after rectification. This should be done before in order to have to wait for the whole process to finish to then notice it won't work.
Moritz
Moritz Lennert wrote on 11/05/2007 04:09 PM:
Hello,
If you give an illegal output name to i.rectify, this is only tested
after rectification. This should be done before in order to have to wait
for the whole process to finish to then notice it won't work.
Right - I guess
G_legal_filename()
at the beginning would do the job.
Markus
On 05/11/07 16:25, Markus Neteler wrote:
Moritz Lennert wrote on 11/05/2007 04:09 PM:
Hello,
If you give an illegal output name to i.rectify, this is only tested
after rectification. This should be done before in order to have to wait
for the whole process to finish to then notice it won't work.
Right - I guess
G_legal_filename()
at the beginning would do the job.
Yes, just make sure to check the given output filename + the given extension.
BTW anyone know how to give an empty extension in the tcltk gui ? On the command line I can use extension="", but in the gui I get an error because of an illegal ".
Moritz
Moritz Lennert wrote:
>> If you give an illegal output name to i.rectify, this is only tested
>> after rectification. This should be done before in order to have to wait
>> for the whole process to finish to then notice it won't work.
>>
> Right - I guess
> G_legal_filename()
> at the beginning would do the job.Yes, just make sure to check the given output filename + the given
extension.
Oh; you're talking about illegal *file* names (as opposed to map
names)?
I don't think that we have a check for that.
Actually, the only reliable way to check whether a filename is legal
is to actually create the file. That should also ensure that creation
doesn't fail for other reasons (permissions, read-only filesystem,
etc).
BTW anyone know how to give an empty extension in the tcltk gui ? On the
command line I can use extension="", but in the gui I get an error
because of an illegal ".
On the command line, using:
extension=""
is the same as using just:
extension=
The quotes are removed by the shell.
More generally, Tcl requires any quotes to go around the entire
"word", so a command line argument such as:
text="hello world"
would need to be entered as
"text=hello world"
or:
{text=hello world}
in Tcl.
--
Glynn Clements <glynn@gclements.plus.com>
On Mon, November 5, 2007 22:24, Glynn Clements wrote:
Moritz Lennert wrote:
>> If you give an illegal output name to i.rectify, this is only tested
>> after rectification. This should be done before in order to have to
wait
>> for the whole process to finish to then notice it won't work.
>>
> Right - I guess
> G_legal_filename()
> at the beginning would do the job.Yes, just make sure to check the given output filename + the given
extension.Oh; you're talking about illegal *file* names (as opposed to map
names)?
No sorry, I meant map names.
BTW anyone know how to give an empty extension in the tcltk gui ? On the
command line I can use extension="", but in the gui I get an error
because of an illegal ".On the command line, using:
extension=""
is the same as using just:
extension=
The quotes are removed by the shell.
Thanks for the info.
More generally, Tcl requires any quotes to go around the entire
"word", so a command line argument such as:text="hello world"
would need to be entered as
"text=hello world"
or:
{text=hello world}
So what would be the tcltk gui equivalent of extension= or extension="" ? "Extension" is a text field to be filled in. So as a result you get a command line with extension=anything you put in the field (without any quotes. However, leaving the field empty does not work, as it is a required field. '""' doesn't work either. Would it work if the gui used curly braces around the result ? I.e. how to indicate an empty string to the gui ?
Moritz
On 11/5/07 9:10 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:
BTW anyone know how to give an empty extension in the tcltk gui ? On the
command line I can use extension="", but in the gui I get an error
because of an illegal ".
Moritz,
I'd offer some advice, but I'm not sure I understand what you mean.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Moritz Lennert wrote:
>> >> If you give an illegal output name to i.rectify, this is only tested
>> >> after rectification. This should be done before in order to have to
>> wait
>> >> for the whole process to finish to then notice it won't work.
>> >>
>> > Right - I guess
>> > G_legal_filename()
>> > at the beginning would do the job.
>>
>> Yes, just make sure to check the given output filename + the given
>> extension.
>
> Oh; you're talking about illegal *file* names (as opposed to map
> names)?No sorry, I meant map names.
Oops; I saw "extension" and assumed filenames.
So what would be the tcltk gui equivalent of extension= or extension=""
?
The Tcl equivalent is just:
extension=
"Extension" is a text field to be filled in. So as a result you get a
command line with extension=anything you put in the field (without any
quotes. However, leaving the field empty does not work, as it is a
required field. '""' doesn't work either. Would it work if the gui used
curly braces around the result ? I.e. how to indicate an empty string to
the gui ?
This appears to be a deficiency with the way that the GUI decides
whether to pass an option.
G_parser() can distinguish between an absent option and an option with
the empty string as its value.
If the GUI treats an empty text field as the option not being given,
then there is no way to pass an empty string as an option value.
Anything you put into the text field will be passed literally as the
option's value.
AFAICT, the only solution is to add a checkbox to each option to force
the option to be passed. I suspect that i.rectify won't be the only
module where you might want to pass the empty string as an option
value.
Note that we have a similar problem with scripts using g.parser. I.e.
there's no way to distinguish between an absent option and the empty
string as the option's value.
--
Glynn Clements <glynn@gclements.plus.com>
On 06/11/07 03:25, Michael Barton wrote:
On 11/5/07 9:10 AM, "Moritz Lennert" <mlennert@club.worldonline.be>
wrote:BTW anyone know how to give an empty extension in the tcltk gui ?
On the command line I can use extension="", but in the gui I get an
error because of an illegal ".Moritz,
I'd offer some advice, but I'm not sure I understand what you mean.
How do you reproduce the following command:
i.rectify [...] extension=
in the gui launched when running i.rectify from the menu or from the
command line without options ?
Glynn has already pointed out that this seems to be a general deficiency:
On 06/11/07 11:08, Glynn Clements wrote:
This appears to be a deficiency with the way that the GUI decides whether to pass an option.
G_parser() can distinguish between an absent option and an option
with the empty string as its value.If the GUI treats an empty text field as the option not being given, then there is no way to pass an empty string as an option value. Anything you put into the text field will be passed literally as the option's value.
AFAICT, the only solution is to add a checkbox to each option to
force the option to be passed. I suspect that i.rectify won't be the
only module where you might want to pass the empty string as an
option value.Note that we have a similar problem with scripts using g.parser. I.e.
there's no way to distinguish between an absent option and the empty
string as the option's value.
Moritz
Sorry to be dense, but an *optioal* argument *must* be present in i.rectify,
even if it is empty? This seems like a very weird situation.
To do it in TclTk, I'd do it one of two ways, depending on which execution
procedure you are using.
You could just put the whole command in quotes as a string.
set cmd "i.rectify ... extension="
[parse and run] cmd
OR
You could put the command in a list and parse it that way.
set cmdlist [list "i.rectify" "arg1" "arg2" ... "extension="]
[parse and run] cmdlist
Michael
On 11/6/07 4:42 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:
On 06/11/07 03:25, Michael Barton wrote:
On 11/5/07 9:10 AM, "Moritz Lennert" <mlennert@club.worldonline.be>
wrote:BTW anyone know how to give an empty extension in the tcltk gui ?
On the command line I can use extension="", but in the gui I get an
error because of an illegal ".Moritz,
I'd offer some advice, but I'm not sure I understand what you mean.
How do you reproduce the following command:
i.rectify [...] extension=
in the gui launched when running i.rectify from the menu or from the
command line without options ?Glynn has already pointed out that this seems to be a general deficiency:
On 06/11/07 11:08, Glynn Clements wrote:
This appears to be a deficiency with the way that the GUI decides
whether to pass an option.G_parser() can distinguish between an absent option and an option
with the empty string as its value.If the GUI treats an empty text field as the option not being given,
then there is no way to pass an empty string as an option value.
Anything you put into the text field will be passed literally as the
option's value.AFAICT, the only solution is to add a checkbox to each option to
force the option to be passed. I suspect that i.rectify won't be the
only module where you might want to pass the empty string as an
option value.Note that we have a similar problem with scripts using g.parser. I.e.
there's no way to distinguish between an absent option and the empty
string as the option's value.Moritz
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
On 06/11/07 16:27, Michael Barton wrote:
Sorry to be dense, but an *optioal* argument *must* be present in i.rectify,
even if it is empty? This seems like a very weird situation.
It is not optional.
This is not an issue in gis.m from where you cannot call i.rectify anymore (you have to go through the georectifying tool) .You can try it by typing i.rectify at the command line. In the tcltk window that pops up, just type any bogus values into all fields except for extension. If you click on run, you will get the error message:
ERROR: Required parameter <extension> not set:
(Output file extension (inputfile(s) + extension)).
But in my case I don't want an extension, or, said differently, I want the extension to be empty. At the command line, I can just type 'extension=', but there is no way I can give an 'empty' value to the extension parameter in the tcltk gui.
To do it in TclTk, I'd do it one of two ways, depending on which execution
procedure you are using.You could just put the whole command in quotes as a string.
set cmd "i.rectify ... extension="
[parse and run] cmd
OR
You could put the command in a list and parse it that way.
set cmdlist [list "i.rectify" "arg1" "arg2" ... "extension="]
[parse and run] cmdlist
So this means we have to change g.parser as Glynn seems to suggest, especially if this concerns other modules as well.
Moritz
Is this an error of requiring extension to be set? If so, this can be
changed in the C code of the module. This seems like the simplest solution.
Michael
On 11/6/07 8:57 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:
On 06/11/07 16:27, Michael Barton wrote:
Sorry to be dense, but an *optioal* argument *must* be present in i.rectify,
even if it is empty? This seems like a very weird situation.It is not optional.
This is not an issue in gis.m from where you cannot call i.rectify
anymore (you have to go through the georectifying tool) .You can try it
by typing i.rectify at the command line. In the tcltk window that pops
up, just type any bogus values into all fields except for extension. If
you click on run, you will get the error message:ERROR: Required parameter <extension> not set:
(Output file extension (inputfile(s) + extension)).But in my case I don't want an extension, or, said differently, I want
the extension to be empty. At the command line, I can just type
'extension=', but there is no way I can give an 'empty' value to the
extension parameter in the tcltk gui.To do it in TclTk, I'd do it one of two ways, depending on which execution
procedure you are using.You could just put the whole command in quotes as a string.
set cmd "i.rectify ... extension="
[parse and run] cmd
OR
You could put the command in a list and parse it that way.
set cmdlist [list "i.rectify" "arg1" "arg2" ... "extension="]
[parse and run] cmdlist
So this means we have to change g.parser as Glynn seems to suggest,
especially if this concerns other modules as well.Moritz
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Michael Barton wrote:
>> Sorry to be dense, but an *optioal* argument *must* be present in i.rectify,
>> even if it is empty? This seems like a very weird situation.
>
> It is not optional.
>
> This is not an issue in gis.m from where you cannot call i.rectify
> anymore (you have to go through the georectifying tool) .You can try it
> by typing i.rectify at the command line. In the tcltk window that pops
> up, just type any bogus values into all fields except for extension. If
> you click on run, you will get the error message:
>
> ERROR: Required parameter <extension> not set:
> (Output file extension (inputfile(s) + extension)).
>
> But in my case I don't want an extension, or, said differently, I want
> the extension to be empty. At the command line, I can just type
> 'extension=', but there is no way I can give an 'empty' value to the
> extension parameter in the tcltk gui.
>
>>
>> To do it in TclTk, I'd do it one of two ways, depending on which execution
>> procedure you are using.
>>
>> You could just put the whole command in quotes as a string.
>>
>> set cmd "i.rectify ... extension="
>>
>> [parse and run] cmd
>>
>> OR
>>
>> You could put the command in a list and parse it that way.
>>
>> set cmdlist [list "i.rectify" "arg1" "arg2" ... "extension="]
>>
>> [parse and run] cmdlist
>
> So this means we have to change g.parser as Glynn seems to suggest,
> especially if this concerns other modules as well.Is this an error of requiring extension to be set? If so, this can be
changed in the C code of the module. This seems like the simplest solution.
No, the problem is gis.m's inability to pass the empty string as an
option's value. If you leave the text field blank, the option simply
doesn't get passed.
--
Glynn Clements <glynn@gclements.plus.com>
ERROR: Required parameter <extension> not set:
(Output file extension (inputfile(s) + extension)).But in my case I don't want an extension, or, said differently, I want
the extension to be empty. At the command line, I can just type
'extension=', but there is no way I can give an 'empty' value to the
extension parameter in the tcltk gui.
this would work around the immediate problem:
if(strlen(extension) == 0)
G_fatal_error(_("Extension required"));
or default to none,
ext->answer = "";
ext->required = NO;
or test for ext="none" and replace it with "".
personally, I've always just used ext='.rect' and worried more about what was
happening with the data bugs in order=3 and the -c flag.
Hamish
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
On 07/11/07 01:02, Glynn Clements wrote:
Michael Barton wrote:
Sorry to be dense, but an *optioal* argument *must* be present in i.rectify,
even if it is empty? This seems like a very weird situation.It is not optional.
This is not an issue in gis.m from where you cannot call i.rectify
anymore (you have to go through the georectifying tool) .You can try it
by typing i.rectify at the command line. In the tcltk window that pops
up, just type any bogus values into all fields except for extension. If
you click on run, you will get the error message:ERROR: Required parameter <extension> not set:
(Output file extension (inputfile(s) + extension)).But in my case I don't want an extension, or, said differently, I want
the extension to be empty. At the command line, I can just type
'extension=', but there is no way I can give an 'empty' value to the
extension parameter in the tcltk gui.To do it in TclTk, I'd do it one of two ways, depending on which execution
procedure you are using.You could just put the whole command in quotes as a string.
set cmd "i.rectify ... extension="
[parse and run] cmd
OR
You could put the command in a list and parse it that way.
set cmdlist [list "i.rectify" "arg1" "arg2" ... "extension="]
[parse and run] cmdlist
So this means we have to change g.parser as Glynn seems to suggest,
especially if this concerns other modules as well.Is this an error of requiring extension to be set? If so, this can be
changed in the C code of the module. This seems like the simplest solution.No, the problem is gis.m's inability to pass the empty string as an
option's value. If you leave the text field blank, the option simply
doesn't get passed.
To be totally fair it isn't gis.m's inability, but the inability of the automatically generated tcltk command gui...gis.m's menus actually do not include an entry for i.rectify as it is embedded in the georectifier (which always sets an extension).
Moritz