soravux / scoop

SCOOP (Scalable COncurrent Operations in Python)
https://github.com/soravux/scoop
GNU Lesser General Public License v3.0
625 stars 88 forks source link

problems using SCOOP shared object API #93

Closed bje- closed 2 years ago

bje- commented 3 years ago

I am trying to integrate SCOOP with the https://github.com/chriskiehl/Gooey package for adding a GUI front-end for command line options (and processing). Since I only want one GUI window to pop up, I am running that inside the __name__ == __main__ guard and then use the object sharing API to share the arguments with the workers. I've cut this down to a small reproducible test case which doesn't work. Can anyone help here, please?

from scoop import shared
from gooey import Gooey, GooeyParser

@Gooey()
def main():
    parser = GooeyParser(description='Process some integers.')
    parser.add_argument( 'required_field', metavar='Some Field', help='Enter some text!')
    args = parser.parse_args()
    shared.setConst(arguments=args)

if __name__ == '__main__':
    main()
else:
    print(shared.getConst('arguments'))

When running with python3 -m scoop testcase.py, I get a long traceback that concludes:

  File "testcase.py", line 16, in <module>
    print(shared.getConst('arguments'))
  File "/home/bje/.local/lib/python3.8/site-packages/scoop/shared.py", line 126, in getConst
    _control.execQueue.socket.pumpInfoSocket()
AttributeError: 'NoneType' object has no attribute 'socket'