Bug #2280

GUI: consecutive import of sample from several python scripts is affected by previous imports

Added by pospelov 9 months ago. Updated 3 months ago.

Status:BacklogStart date:11 Jan 2019
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Bug appears on consecutive import of sample from different Python scripts.

Suppose you have script1.py with the method get_sample1(), and script2.py with the method get_sample2().
If you import script1.py to GUI, widget will correctly show existence of get_sample1() function and will successfully import sample from it.
If you when import script2.py, the list of function will show existence of two functions, get_sample1() from first script, and get_sample2() from current script.
Strangely enough, import of both functions is working.

It seems that embedded Python interpreter remembers everything which happened to him during GUI session.

Steps to reproduce:
  • Use scripts from the attachment, and try to import sample from first and second script one after another.

script1.py Magnifier (1.46 KB) pospelov, 11 Jan 2019 10:33

script2.py Magnifier (1.46 KB) pospelov, 11 Jan 2019 10:34

History

#1 Updated by herck 8 months ago

  • Target version changed from Sprint 40 to Sprint 41

#2 Updated by wuttke 6 months ago

  • Subject changed from GUI: consequitive import of sample from several python scripts is affected by previous imports to GUI: consecutive import of sample from several python scripts is affected by previous imports

#3 Updated by dmitry 3 months ago

  • Assignee set to dmitry

#4 Updated by dmitry 3 months ago

  • Assignee deleted (dmitry)
  • Target version changed from Sprint 41 to v2.0

The bug is related to creating a python interpreter and not cleaning it up.
Seemingly it is possible to run an independent sub-interpreter (see Py_NewInterpreter in python documentation) on each new task.
However, I did not manage to work it properly and got application crash at consecutive interpreter's creation/usage.

#5 Updated by pospelov 3 months ago

  • Status changed from Sprint to Backlog
  • Target version deleted (v2.0)

Also available in: Atom PDF