Opened 13 years ago

Closed 12 years ago

#1301 closed defect (fixed)

wingrass: db.in.ogr fails to load .csv file

Reported by: morrisxs09 Owned by: grass-dev@…
Priority: normal Milestone: 6.4.1
Component: Database Version: svn-releasebranch64
Keywords: wingrass Cc:
CPU: x86-32 Platform: MSWindows XP

Description

db.in.ogr fails to load .csv file and returns with the following message...

db.in.ogr dsn=D:\Data\ProjData\GRASS_db\dmp_lg.csv output=test ERROR: Input table <D:DataProjDataGRASS_dbdmp_lg.csv> not found or not readable

GRASS_INFO_ERROR(5020,1): Unable to open data source <D:DataProjDataGRASS_dbdmp_lg.csv>

Workaround Replace pathname "\" with "/" then .csv load works

Change History (7)

comment:1 by hamish, 13 years ago

Keywords: wingrass added

"\" is used as the quoting character, this is often used to deal with path names with spaces, instead of breaking the path into two command line args (otherwise it would not know where dsn= ended and the next option [in this case one called output=] began). to get a literal "\" you either need to quote it (with itself) like "
" or put the whole thing in "double quotes". for example: dir=C:\\Program\ Files\\ or `dir="C:\Program Files\"

So the computer sees "D:\Data" with a literal "D", and it becomes translated to "D:Data".

Solution: always "quote" filenames, or use the "/" workaround.

 db.in.ogr dsn="D:\Data\ProjData\GRASS_db\dmp_lg.csv" output=test

Hamish

comment:2 by morrisxs09, 13 years ago

I'm using the winGRASS gui i.e.

File > Import database table > Multiple import formats using OGR Window pops up

. On the "Required" tab, select "Browse" button on the "Table file to be imported or DB connection string" to navigate to .csv file and select required file to load.

. Enter any other required fields on the other tabs

. Press "Run"

error occurs

Are you suggesting quotes have to be added after the "Table file to be imported or DB connection string" field is populated?

in reply to:  2 comment:3 by hamish, 13 years ago

Component: DatabasewxGUI

Replying to morrisxs09:

Are you suggesting quotes have to be added after the "Table file to be imported or DB connection string" field is populated?

try it. if that makes it work, then yes.

if so, the root of the problem is that the path strings are not getting quoted automatically by the file-picker?

Hamish

comment:4 by morrisxs09, 13 years ago

Tried it twice in the GUI, once with single quotes and once with double quotes and both failed with same issue.

comment:5 by morrisxs09, 13 years ago

Also tried it on the command line

db.in.ogr dsn='D:\Data\ProjData\GRASS_db\dmp_lg.csv' output=test

OR

db.in.ogr dsn="D:\Data\ProjData\GRASS_db\dmp_lg.csv" output=test

and both failed with same error.

comment:6 by hamish, 13 years ago

Component: wxGUIDatabase

ah, I think I found it, unquoted variables inside the shell script.

Hopefully fixed in r45609 (6.4) and r45610 (6.5).

for today, avoid the problem with "cd D:\Data\ProjData?\GRASS_db" on the command line and then run db.in.ogr with dsn=dmp_lg.csv, or the "/" workaround.

Hamish

comment:7 by neteler, 12 years ago

Resolution: fixed
Status: newclosed

No more remarks, hence closing as fixed. Reopen if needed.

Note: See TracTickets for help on using tickets.