-
Notifications
You must be signed in to change notification settings - Fork 21
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
Updates to NoTask to prevent argparse error #20
Comments
…ure that EmptyTask does not create an argument parser (gh-20). Also fixing an issue with EmptyClass where the overloaded __init__ method was not passing the id and name arguments down to the base class. This would have prevented the NoTask object from declaring itself with id=0. Just deleting the __init__ method rather than fixing it since it simply calls the base class __init__.
Sorry, I replaced /usr/local/lib/python3.4/dist-packages/pyutilib/workflow/task.py with the new task.py from your commit but I still have the error AttributeError: 'module' object has no attribute 'argv' (unless I comment row 189 self._parser = argparse.ArgumentParser() ) when I call from C, using the python C api, a function in a script that from pyomo.core imports * ...
/Antonello |
Thanks for letting us know. I guess this won't be such a simple fix on our part. Can you work around the issue using the approach outlined in the StackOverflow answer in the following link? |
Hi.. thanks.. I did already tried that, but not being really sure it was the right approach and having a small problem with it, I didn't implemented it. So, to call a pyomo optimisation routine from C is enough to wrap the model in a function and call from C that function after you run:
Thanks again for the support.. /Antonello |
This issue will track changes related to the thread here: https://groups.google.com/forum/#!topic/pyomo-forum/Att_92wrAoI
It looks like the attempt to create an argument parser by the global NoTask object in pyutilib.workflow.task is preventing a user from executing a Pyomo script from C code. I don't know whether or not this is highlighting a problem within the argparse module, but a reasonable change on our part would be to just not create an argument parser for the NoTask object (I can't see how it would be needed).
The text was updated successfully, but these errors were encountered: