Closed implicitall closed 4 years ago
Hi, that's interesting, do you have a link to this workaround? From the error message, it looks like your sys.argv
before the workaround is empty?
I need to look into it a bit more, since I don't necessarily want to modify sys.argv for everyone.
Here is the link: https://github.com/ninia/jep/issues/187
Thanks, according to the link sys.argv
is not set for embedded Python. I'm still undecided, if argv should be set by the user or in forpy_initialize. I will think about it.
Setting sys.argv = ['']
in forpy_initialize to fix this. Apparently this is also what Python 3.8 does.
See https://bugs.python.org/issue32573
Thank you very much for bringing this to my attention!
Hello, I get the following error with the matplotlib example:
Traceback (most recent call last): File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2811, in plot return gca().plot( File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 935, in gca return gcf().gca(kwargs) File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 578, in gcf return figure() File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 525, in figure kwargs) File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3218, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) File "/home/abest/.local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 1008, in new_figure_manager_given_figure window = Tk.Tk(className="matplotlib") File "/usr/lib64/python3.7/tkinter/init.py", line 2018, in init baseName = os.path.basename(sys.argv[0]) IndexError: list index out of range
After searching a little online, I have found that a workaround is this: ierror = run_string("import sys;sys.argv.append('')");
Perhaps you could add that code to forpy_initialize.