Opened 10 years ago
Closed 8 years ago
#2605 closed defect (worksforme)
d.rast.leg: invalid literal for float(): rectangle
Reported by: | pertusus | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.5 |
Component: | Display | Version: | svn-releasebranch70 |
Keywords: | Cc: | ||
CPU: | Unspecified | Platform: | Unspecified |
Description
I get a traceback for d.rast.leg.
d.rast.leg raster_selection_basins_change lines=2
Traceback (most recent call last): File "/usr/local/grass-7.0.0svn//scripts/d.rast.leg", line 167, in <module> main() File "/usr/local/grass-7.0.0svn//scripts/d.rast.leg", line 103, in main f = tuple([float(x) for x in s.split()[1:5]]) ValueError: invalid literal for float(): rectangle:
This is triggered by a wrong parsing of d.info which returns:
frame rectangle: 0.000000 640.000000 0.000000 480.000000
Original code is
[float(x) for x in s.split()[1:5]]
which naturally the to x being 'rectangle:'
I attach a patch where I propose instead:
It seems more robust, though I don't know if the : will be there forever. Overall, the approach is not very robust, but I have no idea on what's going on so I only propose that fix which may not be appropriate in other cases.
Attachments (1)
Change History (9)
by , 10 years ago
Attachment: | d.rast.leg_d.info-parsing.diff added |
---|
comment:3 by , 9 years ago
I checked with the NC dataset, this one works:
GRASS 7.0.3svn (nc_spm_08):~ > g.region raster=basin_50K GRASS 7.0.3svn (nc_spm_08):~ > d.mon wx0 GRASS 7.0.3svn (nc_spm_08):~ > d.rast.leg basin_50K lines=2 100% 100% GRASS 7.0.3svn (nc_spm_08):~ > d.rast.leg basin_50K 100% 100%
Do you have an North Carolina example which fails?
comment:7 by , 9 years ago
Milestone: | 7.0.4 → 7.0.5 |
---|
comment:8 by , 8 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
No activity last 8 months, closing, feel free to reopen if needed.
patch to split first d.info output at :