coin-or / rbfopt

RBFOpt library for black-box optimization
Other
188 stars 33 forks source link

import rbfopt causes Excel to close #26

Closed bash-j closed 5 years ago

bash-j commented 5 years ago

I know this is a really weird issue. I have been using Python on Windows for 6 years and never encountered something like this before.

I am running Python 3.6.7 on Windows 7 64bit and Microsoft Excel 2016 64bit. When I run import rbfopt, if I have Excel open, it triggers Excel to close. I get a popup asking if I want to save the file first, so it's not forcing Excel to exit. Is anyone else able to confirm if this is also happening to them?

All you need is a .py file with the line and a running instance of Excel. Or type it into a running Python console. import rbfopt

Using the module after it has been imported doesn't affect Excel, just the import line.

gnannicini commented 5 years ago

I don't really know how to replicate this - I don't have access to such a configuration. Does it happen only with rbfopt? Is it possible it's one of the dependent imports?

bash-j commented 5 years ago

Looks like it's caused by this issue with pyomo https://github.com/Pyomo/pyomo/issues/355 import pyomo.dataportal.plugins.sheet

As the last comment by goroderickgo states, if you install pyomo==5.2 the problem no longer occurs.

@jsiirola or @whart222 Glad I stumbled upon this issue, as we are still having this issue with pyomo 5.3+.

After testing, 5.2 is the last release in which this bug doesn't cause Excel to quit. Is there a better fix than us modifying pyomo.core.plugins.data.sheet.py (now at pyomo.dataportal.plugins.sheet.py)?

Would be possible to check whether there is already an active instance of Excel (as this StackOverflow post suggests) before trying to do tmp._excel_dispatch(); tmp._excel_quit()?

gnannicini commented 5 years ago

Ok, thanks for digging into this. It is very useful information. I am going to close this issue since it's not due to RBFOpt, but one of its dependencies and it can be fixed installing a more recent version.