[GRASS-dev] [GRASS GIS] #1301: wingrass: db.in.ogr fails to load .csv file

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: Database | Version: svn-releasebranch64
Keywords: | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------
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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: Database | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------
Changes (by hamish):

  * keywords: => wingrass

Comment:

"\" 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

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1301#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: Database | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------

Comment(by morrisxs09):

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?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: wxGUI | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------
Changes (by hamish):

  * component: Database => wxGUI

Comment:

Replying to [comment:2 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

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1301#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: wxGUI | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------

Comment(by morrisxs09):

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: wxGUI | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------

Comment(by morrisxs09):

Also tried it on the command line

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

OR[[BR]]

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

and both failed with same error.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
------------------------+---------------------------------------------------
Reporter: morrisxs09 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.1
Component: Database | Version: svn-releasebranch64
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
------------------------+---------------------------------------------------
Changes (by hamish):

  * component: wxGUI => Database

Comment:

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1301: wingrass: db.in.ogr fails to load .csv file
---------------------------+------------------------------------------------
  Reporter: morrisxs09 | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.1
Component: Database | Version: svn-releasebranch64
Resolution: fixed | Keywords: wingrass
  Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Changes (by neteler):

  * status: new => closed
  * resolution: => fixed

Comment:

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1301#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>