Hi,
I use the R-TextMate Bundle and just recently run into problems when executing code via 'Run Selection in R'.
After some loop-iterations I get the following error message and have to start the calculations all over again:
/Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157:in `write': Invalid argument (Errno::EINVAL) from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157:in `print' from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157 from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:144:in `each' from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:144
There seems to be no inherent problem with the code. Sometime the script runs till the end, sometimes I get these error-messages ...
Can someone explain these error messages to me?
thanks in advance!
On 03-02-2012, at 17:50, Martin Batholdy wrote:
Hi,
I use the R-TextMate Bundle and just recently run into problems when executing code via 'Run Selection in R'.
After some loop-iterations I get the following error message and have to start the calculations all over again:
/Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157:in `write': Invalid argument (Errno::EINVAL) from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157:in `print' from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:157 from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:144:in `each' from /Library/Application Support/TextMate/Bundles/R.tmbundle/Support/tmR.rb:144
There seems to be no inherent problem with the code. Sometime the script runs till the end, sometimes I get these error-messages ...
Can someone explain these error messages to me?
Which version of OS X are you using?
I have had these messages intermittently for quite some time now. Hans Jörg Bibiko, author of the R bundle, has not been able to find a cause.
The error message means (quoting from email from Bibiko): The error "Invalid argument (Errno::EINVAL)" is related to an issue that something couldn't be read or written to a file handle (incl. pipes).
It may be possible that the ruby script has to wait too long for the io pipe to deliver something (I'm guessing)
It would certainly be interesting to hear f more R and TextMate users are experiencing this issue.
Berend
Hi,
yes, as Berend said, this issue is a bit weird to me.
Would it be possible to post a piece of R code which causes this? I tried to reproduce it but up to now without success.
Berend just wrapped the line in question by an exception catcher which should solve that effect but not the actual reason.
Thus for the time being you can change in tmR.rb in the following way:
from:
elsif io == stdout print hideStartMessageJS
to:
elsif io == stdout begin print hideStartMessageJS rescue end
[It seems to me that one should rewrite the code by using another scripting language - private opinion :) ]
I'm working now on a new version which will run with TM2.
Regards, --Hans
On 03-02-2012, at 19:13, Hans-Jörg Bibiko wrote:
Hi,
yes, as Berend said, this issue is a bit weird to me.
Would it be possible to post a piece of R code which causes this? I tried to reproduce it but up to now without success.
Berend just wrapped the line in question by an exception catcher which should solve that effect but not the actual reason.
Thus for the time being you can change in tmR.rb in the following way:
from:
elsif io == stdout print hideStartMessageJS
to:
elsif io == stdout begin print hideStartMessageJS rescue end
[It seems to me that one should rewrite the code by using another scripting language - private opinion :) ]
Our R code or the R bundle? :-)
But I have also found that it doesn't completely solve the issue. I have now done this
elsif io == stdout begin str.each_line do |line| .... .... end rescue sleep(0.1) end end
(I've attached my version of tmR.rb)
I have wrapped the large block of code earlier on in tmR.rb in a begin/rescue/end block. But now the R bundle sometimes skips R output. The sleep(0.1) may be too long.
It's a mystery. It started sometime ago (maybe an OS update?)
Berend
strange :(. Unfortunately, adding the rescue statement didn't solve the problem for me.
I now send the code directly to the R.app (instead of 'run selection in R'). Hope that works.
I run Mac OS X 10.7.2.
P.S.: I execute the code four times (for four different data-sets). So I get four R instances calculating in parallel. Has it something to do with this?
I can send you the code of course. But I don't think it would help you, since it heavily relies on the data.sets. It is basically a support vector machine cross validation algorithm with three nested loops.
best, martin
On 03.02.2012, at 19:13, Hans-Jörg Bibiko wrote:
Hi,
yes, as Berend said, this issue is a bit weird to me.
Would it be possible to post a piece of R code which causes this? I tried to reproduce it but up to now without success.
Berend just wrapped the line in question by an exception catcher which should solve that effect but not the actual reason.
Thus for the time being you can change in tmR.rb in the following way:
from:
elsif io == stdout print hideStartMessageJS
to:
elsif io == stdout begin print hideStartMessageJS rescue end
[It seems to me that one should rewrite the code by using another scripting language - private opinion :) ]
I'm working now on a new version which will run with TM2.
Regards, --Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 04-02-2012, at 12:54, Martin Batholdy wrote:
strange :(. Unfortunately, adding the rescue statement didn't solve the problem for me.
Pity.
I now send the code directly to the R.app (instead of 'run selection in R'). Hope that works. ...... P.S.: I execute the code four times (for four different data-sets). So I get four R instances calculating in parallel. Has it something to do with this?
I doubt it since I never ran multiple instances of R to see the problem.
Berend
Hi,
at least one "good" news. Now I can reproduce that issue in having the message `write': Invalid argument (Errno::EINVAL) :) and now I can start to try to find a solution :)
[... and I meant that the R.bundle should be written in another scripting language ;) ]
Het beste, --Hans
On 04-02-2012, at 14:11, Hans-Jörg Bibiko wrote:
Hi,
at least one "good" news. Now I can reproduce that issue in having the message `write': Invalid argument (Errno::EINVAL) :) and now I can start to try to find a solution :)
That is very good news:-)
[... and I meant that the R.bundle should be written in another scripting language ;) ]
Of course!
Vergeet niet om ook nog even door de sneeuw te wandelen.
Berend