patrickfuller / imolecule

An embeddable webGL molecule viewer and file format converter.
http://patrickfuller.github.io/imolecule/
MIT License
86 stars 18 forks source link

Multiprocessing on windows #11

Closed patrickfuller closed 9 years ago

patrickfuller commented 9 years ago

When run on windows, the process fails and spits out a looped error.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
    prepare(preparation_data)
  File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
Traceback (most recent call last):
  File "<string>", line 1, in <module>
      File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
assert main_name not in sys.modules, main_name
AssertionError: __main__
    prepare(preparation_data)
  File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
    assert main_name not in sys.modules, main_name

From this stackoverflow, it looks like multiprocessing on windows fails when you use relative imports. A weird bug, but an easy fix.

patrickfuller commented 9 years ago

To replicate, I opened a new windows 8.1 virtual machine and installed packages.

After this mess, I could run with imolecule. Everything worked:

windows

I found that windows is hiding the errors of the underlying process, so this reported bug likely had something to do with an improper openbabel install. I also found that windows was not honoring KeyboardInterrupt on tornado's server, so I added an explicit try-catch to handle this.

patrickfuller commented 9 years ago

Note that the ctrl-c signal takes a couple of seconds on windows. I'm guessing it has something to do with tornado's polling.