Skip to content

Commit

Permalink
v.concave.hull
Browse files Browse the repository at this point in the history
file -> open
  • Loading branch information
metzm committed May 2, 2020
1 parent f78f39e commit 15345f1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions grass7/vector/v.concave.hull/v.concave.hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def cleanup():
grass.run_command('g.remove', flags = 'f', type = 'vector', pattern = prefix + '_*', quiet = True)

def sortfile(infile, outfile):
inf = file(infile, 'r')
outf = file(outfile, 'w')
inf = open(infile, 'r')
outf = open(outfile, 'w')

if grass.find_program('sort', '-n'):
grass.run_command('sort', flags = 'n', stdin = inf, stdout = outf)
Expand Down Expand Up @@ -107,20 +107,20 @@ def main():
database = db_info['database']
driver = db_info['driver']
sql = "SELECT length FROM %s" % (table)
tmpf = file(tmp, 'w')
tmpf = open(tmp, 'w')
grass.run_command('db.select', flags = 'c', table = table,
database = database, driver = driver, sql = sql,
stdout = tmpf)
tmpf.close()

# check if result is empty
tmpf = file(tmp)
tmpf = open(tmp, 'r')
if tmpf.read(1) == '':
grass.fatal(_("Table <%s> contains no data.") % table)
tmpf.close()

N = 0
tmpf = file(tmp)
tmpf = open(tmp)
for line in tmpf:
N += 1
tmpf.close()
Expand All @@ -141,7 +141,7 @@ def main():
thresh = int(perc) - 90
grass.warning(_('Threshold reduced to %d to calculate hull' % thresh ))

inf = file(tmp + ".sort")
inf = open(tmp + ".sort", 'r')
l = 0
for line in inf:
if l == ppos:
Expand Down

0 comments on commit 15345f1

Please sign in to comment.