Better REPL

Bug #1655800 reported by Perkins on 2017-01-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I have found the Sikuli interactive interpreter to be a powerful tool, both for experimenting with code snippets as I am building scripts and as a testing tool in its own right. That said, it's often rather... primitive... It could be much better.

Something like would be quite awesome. I have tried loading it in and, once all the dependencies were made available, it almost works (I think.)

It ends up choking when it tries to import termios and can't find it. Which I find to be a bit confusing since when I check the jython docs, it's supposed to include a termios module... So either I'm misreading something, or maybe the jython bundle included with Sikuli just needs to have that bit included. Regardless, if someone who knows more about Java and Jython than I do can spare a few minutes to look at it, it might just work.

Alternatively, there are a few other improved Python REPLs that might drop in and function. Something that handles history and completion a bit better would take the interactive interpreter from a mildly useful debugging and small-test tool to a pretty good interactive script development environment.

RaiMan (raimund-hocke) on 2017-01-12
Changed in sikuli:
status: New → Won't Fix
assignee: nobody → RaiMan (raimund-hocke)
RaiMan (raimund-hocke) wrote :

The "Sikuli interactive interpreter" is only the standard Jython prompt with some imports already done.

So if you use standard Jython having sikulixapi.jar on classpath, you only have to issue the standard imports needed for SikuliX and you are there.

With the SikuliX IDE you can do the same:
- enter a line of code
- run the script
- enter next line
- run the script
- ...

though currently you do not have auto-complete.

In any case, if you need more, I recommend PyCharm.

RaiMan (raimund-hocke) wrote :

BTW: in your case it might be a problem of Jython version:
- Sikuli before 1.1.1 uses 2.5
- 1.1.1+ use 2.7

Perkins (lperkins) wrote :

The IDE resets almost all of its state between runs (which is a good thing for it to do) so it's not much use for interactive stuff. And I'm currently using a 1.1.1 build from October.

I didn't realise that it was just a standard Jython prompt with some imports though. I'll attack it from that end and let you know what I come up with.

RaiMan (raimund-hocke) wrote :

--- The IDE resets almost all of its state between runs
... not really (see comment below), but the script is always run from beginning and hence the state before the newest line added is created again.

So I admit, that it is not really a REPL, but more some incremental scripting support ;-)

On the other hand:
On the wishlist for the IDE there is a feature, to run only portions of a script. This can be augmented in your direction, in that there is an option to run the selected code (the new line added in your case) without resetting anything.

comment on "The IDE resets almost all of its state between runs":
On rerun in fact nothing (e.g. variable contents defined) in the script is reset, only some SikuliX environment settings and with version 1.1.1 imports of SikuliX scripts are refreshed now (to avoid this ugly reload()).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers