Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymzn.minizinc timeout leads to type error #35

Closed
Moisan opened this issue Apr 13, 2019 · 1 comment
Closed

pymzn.minizinc timeout leads to type error #35

Moisan opened this issue Apr 13, 2019 · 1 comment

Comments

@Moisan
Copy link
Contributor

Moisan commented Apr 13, 2019

While trying to call pymzn.minizinc with a timeout argument, I get a type error:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    sol = pymzn.minizinc("cumul_sched.mzn", "cumul_sched.dzn", timeout=5)
  File "/usr/local/lib/python3.7/site-packages/pymzn/mzn/minizinc.py", line 649, in minizinc
    **solver_args
  File "/usr/local/lib/python3.7/site-packages/pymzn/mzn/minizinc.py", line 794, in solve
    proc = _run_minizinc_proc(*args, input=input)
  File "/usr/local/lib/python3.7/site-packages/pymzn/mzn/minizinc.py", line 56, in _run_minizinc_proc
    return run_process(*args, input=input)
  File "/usr/local/lib/python3.7/site-packages/pymzn/mzn/process.py", line 63, in run_process
    shell=shell, bufsize=1, universal_newlines=True
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1453, in _execute_child
    restore_signals, start_new_session, preexec_fn)
TypeError: expected str, bytes or os.PathLike object, not int

This is due to this line in mzn/minizinc.py which should be

args += ['--time-limit', str(timeout * 1000)]

I will shortly send a pull-request.

@paolodragone
Copy link
Owner

Solved in 35b04cf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants