[request] IDE: want a reset feature to get import repeated --- workaround

Bug #704981 reported by RaiMan
40
This bug affects 6 people
Affects Status Importance Assigned to Milestone
SikuliX
Won't Fix
Medium
RaiMan

Bug Description

workaround: use reload() (see docs)
----------------------------------------------------------

With the new feature "import other .sikuli", you always have to restart the IDE, if something is changed in an imported script. This might be inconvenient, if some tabs are open.

A button like the run-button would be helpful, that internally resets the IDE, so that imports are done again.

Tags: idererun
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Wishlist
RaiMan (raimund-hocke)
summary: - [request] want a reset feature for IDE
+ [request] IDE: want a reset feature to get import repeated
Revision history for this message
Michael K (klepikov) wrote : Re: [request] IDE: want a reset feature to get import repeated

Yeah this is really annoying. Import of other .sikuli is very useful for anything more than a toy example, and it's a pain to have to restart the IDE every time the imported .sikuli is changed.

A workaround is to edit the scripts in a separate IDE instance where I never run them, and run them from command line with "sikuli_ide.sh -s -r ...", but that defeats the "I" in the "IDE".

Import should just work automatically on every run. For reference, the boilerplate that I'm using for import:

bundle_path = os.path.dirname(getBundlePath())
if not bundle_path in sys.path: sys.path.append(bundle_path)

import my_utility_sikuli_module

Revision history for this message
RaiMan (raimund-hocke) wrote :

thanks, pls. click "This bug affects you" in the top area of bug report to boost it up a little.

Revision history for this message
Emil Börjesson (emil-borjesson) wrote :

We are currently using Sikuli in a course at Chalmers University of Technology, to let the students get used to this technology, in an application they are building for the Android phone. A lot of complaints were aimed at this particular bug, since they are using this import function to build suites of tests.

If you are interested I can possibly provide you with further feedback from the students. Might be valuable in the future development of the tool.

Best regards.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Thanks for the valuable information.

I will try to get the developers attention on this matter.

Changed in sikuli:
importance: Wishlist → High
assignee: nobody → Tsung-Hsiang Chang (vgod)
Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

A workaround to this bug is using the reload function of Python after import.
For example,

import a_module
reload(a_module)

would force the IDE to reload the a_module every time.

Changed in sikuli:
status: New → Triaged
Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

I just realized it's hard to fix this issue shortly. This issue involves with a bug of Jython that I reported long time ago but got no response. As a result, Sikuli IDE has to recycle the same Python interpreter to run scripts every time. Under this condition, the only solution I can come up with now is to monitor what modules are imported by users and delete them from sys.modules before running the user's scripts. (See the following workaround.)

If you have a list of the modules needed to be reload, you can put the following code in front of the main script to reload all of them without writing many reloads.

for m in["mod1", "mod2", "mod3", ...]:
    if m in sys.modules:
        del sys.modules[m]

import mod1, mod2, mod3

RaiMan (raimund-hocke)
Changed in sikuli:
status: Triaged → In Progress
milestone: none → x1.0
RaiMan (raimund-hocke)
Changed in sikuli:
assignee: Tsung-Hsiang Chang (vgod) → RaiMan (raimund-hocke)
importance: High → Medium
tags: added: idererun
RaiMan (raimund-hocke)
Changed in sikuli:
milestone: x1.0 → none
status: In Progress → Won't Fix
description: updated
summary: - [request] IDE: want a reset feature to get import repeated
+ [request] IDE: want a reset feature to get import repeated ---
+ workaround
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.