Class file not updating?

Asked by Tom Hinds

I've been playing with Sikuli for about 6 months and haven't run into this problem before.

One of my scripts populate a list of data. An older version of my script created three items (like One, Two, Three); I updated the code to populate the list with different items (like Apple, Banana, Cherry). When I run the script, it still is using the original items.

Outside of Sikuli, I can see the source of the .py file shows my changes, but the .class file shows a date of last week and I can see the old code in it.

- I've stopped and started Sikuli.
- I've edited the script more, including comments to see if that will update the class file
- I've deleted the Class file, but on running the script that older code runs, and the Class file returns with the older date and the incorrect code
- I've copied the files to another workstation and the same thing happens

Any idea what's going on here? All my other Sikuli files (there are quite a few of them) update and run properly.

Thanks for your help,
- Tom

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Tom Hinds
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

How do you run your scripts?

Must be Jython directly, since the normal Sikuli methods to run scripts do not produce class files from the .py files.

You can try: delete the class file, it will be regenerated from the .py

Revision history for this message
Tom Hinds (thinds66) said :
#2

Hi RaiMan,

Thanks for the reply.
I always run the scripts from the IDE.
I have a master script the calls all other scripts (there are over 30 of them).

I hadn't paid much attention to the class files before yesterday; each sikuli script has an associated class file, usually the same date as the py file. When this started acting up yesterday, I noticed the class file was a week older than the py file.

I'm logging into my workstations as I always do.
I deleted the class file in question.
I rebooted my machine.
I ran my script. It's still running the old code. The class file does not get recreated.
I have no idea where it's reading that code; it doesn't exist.

I'm sure I can save the script with a different name and change my main script to point at the new one, but I'd like to track down what's going on in case it happens again.

Is there a cache or temp files somewhere that I should be clearing?

Thanks for your help,
- Tom

Revision history for this message
RaiMan (raimund-hocke) said :
#3

-- I have a master script the calls all other scripts (there are over 30 of them).
exactly this is what I am asking for: how do you do that?

Revision history for this message
Tom Hinds (thinds66) said :
#4

The main file imports the other files:
 ex: import createCategories
so I've got about 30 imports in a row

Then the main file calls the other files:
 ex: createCategories.Create_Categories()
so I've got a bunch of calls to the other files
I comment them out when I don't want them to run.
So, of the 30 scripts, the main file is currently only running two of them: one that sets up some global variables and the createCategories script.

Each individual script file starts with:
 from sikuli import *

Revision history for this message
RaiMan (raimund-hocke) said :
#5

I suppose createCategories is a createCategories.sikuli folder in the same folder as the main script.

Or are you using another folder and modify sys.path?

At beginning of the main script, after all changes to sys.path and before any import:

for e in sys.path: print e

check, wether one of the listed folders contains the old stuff.

If you are working with the IDE to run the main script, then you should stop and restart the IDE after modifications to the imported scripts or you use reload() for every import (see: http://doc.sikuli.org/globals.html#importing-other-sikuli-scripts-reuse-code-and-images)

Revision history for this message
Tom Hinds (thinds66) said :
#6

> for e in sys.path: print e
> check, wether one of the listed folders contains the old stuff.

Great suggestion and troubleshooting tool.
Thank you for preserving some of my sanity. ;-)

I found an old copy of the py in a folder it shouldn't have been in.
My guess is that I did a Save As at one point to save myself some typing when creating a similar script. I killed it and all is well.
Thanks for your time.
- Tom