Skip to content

Commit

Permalink
r.connectivity.corridors: Use default number of files limit (#659)
Browse files Browse the repository at this point in the history
Uses a default value for ulimit to use when module resource cannot be imported. The resource module is available for Linux, but not Windows.

Fixes #657
  • Loading branch information
echoix committed Jan 4, 2022
1 parent ac7e44c commit b7a36eb
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -135,7 +135,12 @@
import os
import sys
import string
import resource

try:
import resource
except ImportError:
resource = None

import copy
from io import StringIO
import numpy as np
Expand Down Expand Up @@ -216,7 +221,9 @@ def main():
d_flag = flags["d"]
r_flag = flags["r"]

ulimit = resource.getrlimit(resource.RLIMIT_NOFILE)
ulimit = (512, 2048) # Windows number of opened files (soft-limit, hard-limit)
if resource:
ulimit = resource.getrlimit(resource.RLIMIT_NOFILE)

net_hist_str = (
grass.read_command("v.info", map=network_map, flags="h")
Expand Down

0 comments on commit b7a36eb

Please sign in to comment.