StochasticNumerics / mimclib

A software library for UQ methods
GNU General Public License v2.0
6 stars 8 forks source link

(User?) errors in run.py #10

Closed Virtakuono closed 8 years ago

Virtakuono commented 8 years ago

The behaviour of this file is very bizarre. I set chmod 755 run.py ./run.py

and the script prints

from: can't read /var/mail/future
from: can't read /var/mail/future
from: can't read /var/mail/future

htop shows that not much is happening in the background, but the mouse pointer (in unity) changes shape into a crosshair. As I move mouse around the desktop, and click around, the comp puts screen shot images into the working directory, with names that seem to come from the code (for example "mimc", "mimcdb", "os.path" and "warnings").

Finally the script dies printing

./run.py: line 12: syntax error near unexpected token (' <br/> ./run.py: line 12: "{}:{}: ({}) {}\n".format(os.path.basename(filename),'

Virtakuono commented 8 years ago

Also, there is probably some flaw in the way command line arguments are handled. If I don't chmod the file but run instead python ./run.py The script throws an attribute error and dies:

Traceback (most recent call last):
File "run.py", line 127, in
main()
File "run.py", line 45, in main
mimcRun = mimc.MIMCRun(vars(parser.parse_known_args()[0]))
File "/home/jhappola/.local/lib/python2.7/site-packages/mimclib/mimc.py", line 122, in
init
self.data = MIMCData(dim=self.params.dim)
File "/home/jhappola/.local/lib/python2.7/site-packages/mimclib/mimc.py", line 106, in
getattr**
provided!".format(name))
AttributeError: Argument 'dim' is required but not provided!

haji-ali commented 8 years ago

You cannot execute ./run.py without adding the line

!/usr/bin/python

or something at the top of the file.

You also have to specify the parameters of the run. Please use ./echo_test_cmd.py | bash for a single verbose run without saving in DB, as mentioned in my email.

EDIT: I should probably change the names to reflect that run.py cannot be run as is.

Virtakuono commented 8 years ago

Ok, in running the ./echo_test_cmd.py, I get a ModuleDeprecationWarning about the module oldnumeric which apparently is deprecated. It is stated as a warning, but it seems like it is really an error, as the program terminates because of it.

Virtakuono commented 8 years ago

Apparently some information on suppressing the warnings can be found here... http://stackoverflow.com/questions/23886889/how-to-suppress-warning-when-executing-python-code-from-within-vim

Investigating...

Virtakuono commented 8 years ago

The brute force solution for this is to comment away the following line. https://github.com/StochasticNumerics/mimclib/blob/693653b4868a74a9db50ea4f98cd776441a0e3e4/tests/gbm/run.py#L72

The problem with this is of course that it the doRun() throws a warning (or even an error) that is more severe than a deprecation warning for the oldnumeric, you end up glancing over that too...

haji-ali commented 8 years ago

Please don't. The correct way is to comment this line https://github.com/StochasticNumerics/mimclib/blob/693653b4868a74a9db50ea4f98cd776441a0e3e4/tests/gbm/run.py#L14

This line makes warnings behave like errors. I had it enabled to catch all warning with proper call stack.

haji-ali commented 8 years ago

Fixed in ba0596b53290247e7803ef940b3efedaa6a22558