Ticket Hash: | b67135df9d2263bf878a16ddbcc8c5c21055ad66 | |||
Title: | importSHP, exportSHP and DBF writing to stderr | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Cosmetic | Priority: | Zero | |
Subsystem: | Resolution: | Rejected | ||
Last Modified: | 2016-11-26 10:31:24 | |||
Version Found In: | 4.3.0a | |||
User Comments: | ||||
anonymous added on 2016-09-22 16:48:59:
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 added on 2016-09-23 03:19:39:
I assume that following is meant: if (verbose) spatialite_e ("========\nLoading shapefile at '%s' into SQLite table '%s'\n", shp_path, table); In src/headers/spatialite/debug.h
spatialite_i and in debuging modus: spatialite_d
'e' is sent to stderr The extra 'information' message sent with 'verbose' is sent to stdout
Since stderr is a standard output, redirecting it should be no problem. As a non-Python expert, I quickly found the following, Cross-platform, solution at:
import os import sys f = open(os.devnull, 'w') sys.stdout = fReplacing os.devnull with 'error.script_name.txt' might be considered useful. Calling a python-script (same page with stdout ['>' or '1>']) with stderr ['2>'] is also easy: # real world: python myprogram.py 2> /dev/null # windows world: python myprogram.py 2> nulWith the use of '1>/dev/null 2>&1'
These methods have existed since the beginning of unix in the 1960's Separating data-output and any extra information/errors between stdout and stderr also. Conclusion: This is the desired behavior and not an error. The desired effect of removing the undesired output can
mj10777 added on 2016-09-23 03:22:58: I will defer the final decision on this to Sandro. |