EOF error on read line

390 views
Skip to first unread message

Kevin

unread,
Jan 28, 2011, 12:29:43 AM1/28/11
to Tasker
I have setup a task that reads lines of a file but it seems every
other time it reads the lines it gives a EOF error. I have created
variables such as %ONE to 1, as line numbers but it still does this.
How do I fix this or have Tasker re-read the lines if they give an EOF
error? I know that the lines exists and the file gets downloaded
(redownloaded) prior to the read tasks and I even put a wait 2 seconds
command to see if that helps but it didn't seem to.

Pent

unread,
Jan 28, 2011, 4:24:00 AM1/28/11
to Tasker
If it gives EOF it doesn't mean 'error', it means 'end of file'.
Tasker can't see another line in the file.
Are you sure your file format is text with standard carriage return
characters ? Perhaps the first 'line' is actually slurping up the
whole file.

Pent

Frederick Giasson

unread,
Jan 28, 2011, 9:36:59 AM1/28/11
to tas...@googlegroups.com
Hi!

> I have setup a task that reads lines of a file but it seems every
> other time it reads the lines it gives a EOF error.  I have created
> variables such as %ONE to 1, as line numbers but it still does this.
> How do I fix this or have Tasker re-read the lines if they give an EOF
> error?  I know that the lines exists and the file gets downloaded
> (redownloaded) prior to the read tasks and I even put a wait 2 seconds
> command to see if that helps but it didn't seem to.


I had this issue as well, here is how I fixed it:

-> Read Line [file] to %FOO
-> Goto Action [previous task's number] If %FOO doesn't match EOF

That way you force the task to re-read the file until it gets something. In my case it is a HTTP Get action that write into the file. I don't know why I have to do this, but it is the only way I found so that it works. The problem is that it can incurs an infinite loop if the file is indeed empty :)

Pent: I tested multiple things here too (different line ending, Paragraph Read and such; and I always ended with that result too. It is a post on this group that shown me this "trick").

Hope it helps!

Fred

Adamx

unread,
Apr 5, 2011, 1:08:27 PM4/5/11
to tas...@googlegroups.com
Is this a bug? I'm seeing Tasker return EOF for every other read on a file.

I have a task that looks like this:
Execute @cat /proc/loadavg > /sdcard/Tasker/load.txt
Read Line Tasker/load.txt to %CPULOAD
then sets Zoom Element Text to %CPULOAD

Then i set up a button on a Zoom widget to run the task. Every other time I click the button, it comes up EOF. 

gm

unread,
Apr 6, 2011, 4:33:34 PM4/6/11
to Tasker
> I have a task that looks like this:
> Execute @cat /proc/loadavg > /sdcard/Tasker/load.txt
> Read Line Tasker/load.txt to %CPULOAD
> then sets Zoom Element Text to %CPULOAD

Try adding a wait in between the execute & read line tasks.

I think theres a bit of a race condidtion at work there, what seems to
happen is that tasker continues immediately after triggering the
execute plugin which hasn't finished by the time tasker tries to read
the file.

HTH

Myth384

unread,
Apr 26, 2012, 8:17:50 AM4/26/12
to tas...@googlegroups.com
I had the same issues with a comparable task. When explicitly setting the line to read to 1, the EOF values where a thing of the past.

It seems this is small bug within the Read Line action.



Op dinsdag 5 april 2011 19:08:27 UTC+2 schreef Adamx het volgende:
Message has been deleted

Pent

unread,
Apr 26, 2012, 9:15:10 AM4/26/12
to Tasker
> I had the same issues

It's a different issue. The one above is related to Tasker not knowing
when a plugin is finished so it can't wait for it. Using the Run Shell
action is the solution.

> with a comparable task. When explicitly setting the
> line to read to 1, the EOF values where a thing of the past.
>
> It seems this is small bug within the Read Line action.

No, EOF means End Of File, it's not an error condition (read the
action help). If you don't specify a line number, it starts reading at
the last file line. If you file only has one line it will alternate
between line1-EOF-line1-EOF...

Pent

Myth384

unread,
Apr 26, 2012, 9:24:09 AM4/26/12
to tas...@googlegroups.com
Ah, of course... I understand now. It is designed to easily cycle through a file. My bad. Thanks for you explanation.

Op donderdag 26 april 2012 15:15:10 UTC+2 schreef Pent het volgende:
Reply all
Reply to author
Forward
0 new messages