importSHP, exportSHP and DBF writing to stderr

34 views
Skip to first unread message

Stephen Woodbridge

unread,
Sep 22, 2016, 12:00:47 PM9/22/16
to SpatiaLite Users
Hi,

I am accessing spatialite via Python using the sqlite3 module. It is working very nicely except in spatialite 4.3.0a in spatialite.c calls to dump_shapefile load_shapefile_ex2 are called with verbose=1 which causes it to write to stderr.

It would be nice if there were some way to control this either in the SQL or by setting some global override maybe like:

select spatialite_config('verbose', 0);

or something like that. Or maybe the default should just be that is off in the released code.

-Steve

mj10777

unread,
Sep 22, 2016, 12:11:19 PM9/22/16
to SpatiaLite Users


On Thursday, 22 September 2016 18:00:47 UTC+2, Stephen Woodbridge wrote:
Hi,

I am accessing spatialite via Python using the sqlite3 module. It is working very nicely except in spatialite 4.3.0a in spatialite.c calls to dump_shapefile load_shapefile_ex2 are called with verbose=1 which causes it to write to stderr.

It would be nice if there were some way to control this either in the SQL or by setting some global override maybe like:

select spatialite_config('verbose', 0);

For this you should open a ticket: 


spatialite_e
- is mostly being used for errors

But in this case it is being used for verbose messages in load_shapefile_ex3

Mark

Stephen Woodbridge

unread,
Sep 22, 2016, 12:57:52 PM9/22/16
to SpatiaLite Users

mj10777

unread,
Sep 23, 2016, 12:26:45 AM9/23/16
to SpatiaLite Users


On Thursday, 22 September 2016 18:57:52 UTC+2, Stephen Woodbridge wrote:
Done: https://www.gaia-gis.it/fossil/libspatialite/tktview/b67135df9d2263bf878a16ddbcc8c5c21055ad66

On Thursday, September 22, 2016 at 12:00:47 PM UTC-4, Stephen Woodbridge wrote:
Hi,

I am accessing spatialite via Python using the sqlite3 module. It is working very nicely except in spatialite 4.3.0a in spatialite.c calls to dump_shapefile load_shapefile_ex2 are called with verbose=1 which causes it to write to stderr.

It would be nice if there were some way to control this either in the SQL or by setting some global override maybe like:

select spatialite_config('verbose', 0);
For this you should use the standard redirection offered (in unix) since the 1960's and in the dos/windows world since cp/m 3 around 1983.

As a general rule:
- data-information (like results of sql query - i.e. data) goes to stdout ('>' or '1>')
- extended information (as in this case) and errors goes to stderr ('2>')

This is the intended default behavior
- which can easily be overrided by the user

# real world:
python myprogram.py 2> /dev/null
# windows world:
python myprogram.py 2> nul

With the use of '1>/dev/null 2>&1' (for windows replace '/dev/null' with 'nul')
--> both outputs will be transported to the 'land of nothing'

See my answer at:

for a sample I found (but not tested - not being a python person)
- how this is done from inside a python script

Mark

Reply all
Reply to author
Forward
0 new messages