perryhuynh / kcauto

kcauto, the successor to kancolle-auto, a Kantai Collection (Kancolle) bot/automation tool
GNU General Public License v3.0
68 stars 22 forks source link

OCR timer error #377

Closed Kiras756 closed 4 years ago

Kiras756 commented 5 years ago

Environment details

Issue variability

Is the issue consistent (can be reproduced consistently) or is it intermittent (only happens sometimes)?: consistent

Issue

Sometimes, when KCauto trying to send expedition... well, you can see from log. This interrupt the script and even with wscript bot can't run properly (because KCauto for unknown reasons scroll web page down before exit with error). ps I changed L182 to 'rank_symbol)', like you recommended me in past thread, because without this change expedition module does not work for me at all.

Log

[2019-08-26 14:09:18] Initializing config module.
[2019-08-26 14:09:18] Reading config.
[2019-08-26 14:09:18] Starting kcauto!
[log] App.focus:  [2120:Opera]
[2019-08-26 14:09:26] At home
[2019-08-26 14:09:26] Refreshing home.
[log] CLICK on L(325,373)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(123,539)@S(0)[0,0 1280x1024] (515 msec)
[log] App.focus:  [2120:Opera]
[2019-08-26 14:09:42] At home
[2019-08-26 14:09:42] Navigating to expedition screen.
[log] CLICK on L(347,532)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(1129,555)@S(0)[0,0 1280x1024] (515 msec)
[2019-08-26 14:09:47] Sortieing fleet 2 to expedition 2
[log] CLICK on L(253,843)@S(0)[0,0 1280x1024] (516 msec)
[2019-08-26 14:09:53] Click position 547,467.
[2019-08-26 14:09:56] Got valid timer (00:04)!
[2019-08-26 14:09:56] Expedition is already running. Return time: 2019-08-26 14:12:56
[2019-08-26 14:09:56] Sortieing fleet 3 to expedition 37
[log] CLICK on L(521,833)@S(0)[0,0 1280x1024] (515 msec)
[2019-08-26 14:10:04] Click position 276,594.
[2019-08-26 14:10:07] Got valid timer (01:48)!
[2019-08-26 14:10:07] Expedition is already running. Return time: 2019-08-26 15:57:07
[2019-08-26 14:10:07] End of cycle 1
[2019-08-26 14:10:07] Fleet 2: Expedition returns at 2019-08-26 14:12:56
[2019-08-26 14:10:07] Fleet 3: Expedition returns at 2019-08-26 15:57:07
[2019-08-26 14:10:07] Expeditions sent: 0 / received: 0
[2019-08-26 14:10:07] Resupplies: 0 || Fairy resupplies: 0
[2019-08-26 14:10:07] Recoveries done: 0
[2019-08-26 14:10:07] kcauto has been running for 0 hours 0 minutes (started on 2019-08-26 14:09:18)
[2019-08-26 14:13:06] At side menu
[2019-08-26 14:13:06] Going home.
[log] CLICK on L(155,496)@S(0)[0,0 1280x1024] (515 msec)
[log] App.focus:  [2120:Opera]
[2019-08-26 14:13:19] At home
[2019-08-26 14:13:19] Navigating to expedition screen.
[log] CLICK on L(306,570)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(1118,420)@S(0)[0,0 1280x1024] (516 msec)
[2019-08-26 14:13:24] Sortieing fleet 2 to expedition 2
[log] CLICK on L(227,845)@S(0)[0,0 1280x1024] (515 msec)
[2019-08-26 14:13:31] Click position 684,462.
[2019-08-26 14:13:34] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:34] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:35] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:35] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:35] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:36] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:36] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:36] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:37] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:37] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:37] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:38] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:38] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:38] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:39] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:39] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:39] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:40] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:40] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:40] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:41] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:41] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:41] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:42] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:42] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:42] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:43] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:43] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:43] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:43] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:44] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:44] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:44] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:45] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:45] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:45] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:46] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:46] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:46] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:47] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:47] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:47] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:48] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:48] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:48] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:49] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:49] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:49] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:50] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:50] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:50] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:51] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:51] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:51] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:52] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:52] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:52] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:52] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:53] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:53] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:53] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:54] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:54] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:54] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:55] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:55] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:55] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:56] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:56] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:56] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:57] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:57] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:57] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:58] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:58] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:58] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:59] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:59] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:13:59] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:00] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:00] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:00] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:01] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:01] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:01] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:01] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:02] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:02] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:02] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:03] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:03] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:03] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:04] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:04] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:04] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:05] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:05] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:05] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:06] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:06] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:06] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:07] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:07] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:07] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:08] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:08] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:08] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:09] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:09] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:09] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:10] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:10] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:10] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:10] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:11] Got invalid timer (00:0C)... trying again!
[2019-08-26 14:14:11] Got invalid timer ("1ikiu0u.)... trying again!
[2019-08-26 14:14:12] FindFailed: expedition_timer.png: (48x13) seen at (1154, 705) with 0,85 in R[630,509 600x360]@S(0) E:Y, T:1,0
  Line 2761, in file Region.java

[2019-08-26 14:14:12] ** FindFailed error occurred; attempting basic recovery. **
[log] App.focus:  [2120:Opera]
[log]  TYPE "#ESC."
[log]  TYPE " "
[log]  TYPE "#F10."
[2019-08-26 14:15:54] ** Irrecoverable crash. **
FindFailed: expedition_timer.png: (48x13) seen at (1154, 705) with 0,85 in R[630,509 600x360]@S(0) E:Y, T:1,0
  Line 2761, in file Region.java

[error] script [ C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last):
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\kcauto.py", line 84, in <module>
    Recovery.recover(kcauto, config, e)
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\kcauto.py", line 62, in <module>
    kcauto.run_expedition_cycle()
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\main.py", line 255, in run_expedition_cycle
    self.modules['expedition'].sortie_expedition(fleet)
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\expedition.sikuli\expedition.py", line 109, in sortie_expedition
    expedition_timer = Util.read_short_timer(
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\util.sikuli\util.py", line 244, in read_short_timer
    timer = cls.read_ocr_number_text(
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\util.sikuli\util.py", line 147, in read_ocr_number_text
    text = cls.read_ocr_text(kc_region, text_ref, rdir, dist)
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\util.sikuli\util.py", line 112, in read_ocr_text
    text = kc_region.find(text_ref).below(dist).text().encode(
  Line 2761, in file Region.java

    at org.sikuli.script.Region.wait(Region.java:2761)
    at org.sikuli.script.Region.find(Region.java:2326)
    at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
org.sikuli.script.FindFailed: FindFailed: expedition_timer.png: (48x13) seen at (1154, 705) with 0,85 in R[630,509 600x360]@S(0) E:Y, T:1,0
  Line 2761, in file Region.java
stackhanovets commented 5 years ago

I'm also facing the issue from time to time. By the way, it usually resolves itself: I've mocked the main launching command into the while true; do ...; done statement. Not helpful at all but working.

Kiras756 commented 5 years ago

hmm Really, sometimes script runs with no one error and sometimes with nonstop errors... Maybe some fonts or assets on expedition screen loads not properly from time to time?

mrmin123 commented 5 years ago

What does the timer actually ready? 00:00?

As always it's difficult to debug and account for every way that TesseractOCR can go. The next iteration of kcauto should, however, eliminate most of these issues...

And could you jog my memory, what was the change on L182 again?

Kiras756 commented 5 years ago

about L182 https://github.com/mrmin123/kcauto/issues/371#issuecomment-513433077

Kiras756 commented 5 years ago

What does the timer actually ready? 00:00? no, it can be when KCauto just check running expedition after start or when KCauto start the expedition

Kiras756 commented 4 years ago

welp, KCauto doesn't see expedition 11 at all... awaiting for update...

Kiras756 commented 4 years ago
[2019-09-23 12:05:04] Sortieing fleet 4 to expedition 11
[log] CLICK on L(271,845)@S(0)[0,0 1280x1024] (516 msec)
‘l‘|
‘I2
[2019-09-23 12:05:10] Could not find desired expedition (11). Please make sure it is unlocked.
[info] Exit code: 1

OCR troubles

mrmin123 commented 4 years ago

As 100% of my time on kcauto is on the next iteration (complete re-write) of the program, this issue is unfortunately in the will-not-fix category. You'll have to avoid these problematic expeditions for the time being.

mrmin123 commented 4 years ago

As of v8.0.0-rc1 kcauto no longer relies on OCR.