Skip to content
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

qt browser does not work on python 3.8 #74

Open
mwcraig opened this issue Feb 17, 2020 · 2 comments
Open

qt browser does not work on python 3.8 #74

mwcraig opened this issue Feb 17, 2020 · 2 comments

Comments

@mwcraig
Copy link
Contributor

mwcraig commented Feb 17, 2020

When I try the program below on python 3.8 I get the error traceback that is below the program.

to reproduce, run this

from vpython import *
set_browser(type='pyqt')
b = box()

Error traceback

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/runpy.py", line 263, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/mattcraig/development/vpython-jupyter/Demos_no_notebook/qt.py", line 3, in <module>
    b = box()
  File "/Users/mattcraig/development/vpython-jupyter/vpython/vpython.py", line 1099, in __init__
    super(box, self).setup(args)
  File "/Users/mattcraig/development/vpython-jupyter/vpython/vpython.py", line 579, in setup
    super(standardAttributes, self).__init__()
  File "/Users/mattcraig/development/vpython-jupyter/vpython/vpython.py", line 236, in __init__
    from .no_notebook import _
  File "/Users/mattcraig/development/vpython-jupyter/vpython/no_notebook.py", line 265, in <module>
    __m.start()
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/mattcraig/miniconda3/envs/vptest/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Exception ignored in: <function standardAttributes.__del__ at 0x7f8a780971f0>
Traceback (most recent call last):
  File "/Users/mattcraig/development/vpython-jupyter/vpython/vpython.py", line 1092, in __del__
    super(standardAttributes, self).__del__()
  File "/Users/mattcraig/development/vpython-jupyter/vpython/vpython.py", line 317, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'box' object has no attribute 'idx'
@atitus
Copy link
Contributor

atitus commented Feb 17, 2020

Oh that's the same error message as when running the program in Windows. I will see if I can reimplement the functionality with threads instead of processes.

@SamTov
Copy link

SamTov commented Mar 21, 2021

Has there been any progress on this by chance?

It looks like one has to add a guard in the code e.g.

if __name__ == "__main__":
     run()

I can add this but I am unsure of where it should go and it would be easier if someone could let me know where to start looking rather than me going over everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants