File open causes crash

Just trying to open a file which worked in my MRI based project

basically:

File.open(path,“w”){|file| .}

so besides the initial question of why can’t I open a file and how can I
fix it. My second question is am I being naive in hoping that I can run
an MRI based project with little modification over JRuby ? Is there a
compatability write up ?

thanks

here’s the stack:

Errno::EACCES: Permission denied -
S:/Apps/IdeaProjects/Jruby/DataUploader/src/test/output/jeff_to_tb_upload_format.txt2012-11-12T21:23:05-05:00
initialize at org/jruby/RubyFile.java:315
open at org/jruby/RubyIO.java:1176
write_to_output at
S:/Apps/IdeaProjects/Jruby/DataUploader/src/specs/…/…/src/lib/feed_management.rb:552
process_source at
S:/Apps/IdeaProjects/Jruby/DataUploader/src/specs/…/…/src/lib/feed_management.rb:482
each at org/jruby/RubyArray.java:1612
process_source at
S:/Apps/IdeaProjects/Jruby/DataUploader/src/specs/…/…/src/lib/feed_management.rb:465
(root) at
S:/Apps/IdeaProjects/Jruby/DataUploader/src/specs/test_jefferies_load.rb:4
load at org/jruby/RubyKernel.java:1045
(root) at -e:1

Process finished with exit code 1

Charles M.
[email protected]

Charles,

On 11/12/12 9:36 PM, Charles M. wrote:

thanks

here’s the stack:

Errno::EACCES: Permission denied -

That’s an indication that the file permissions are likely wrong. Are you
running your JRuby program as the same user as your MRI ruby program? Is
it the same directory? Does the directory exist? Does it have write
permission for the user running the program?

  • George
        (root) at

Charles M.
[email protected] mailto:[email protected]


Charles -

+1 for George’s comments.

Also, your filespec has a timestamp after the .txt extension. Is that
intentional? It looks like you’re running in Windows. I believe colons
are not permitted in Windows filespecs except when following drive
letters, as in the “S:”.

You might want to try playing around in JRuby’s jirb…you might be able
to narrow down the problem there.

  • Keith

Keith R. Bennett

Keith:

thanks.

I go back and forth between my Mac and Win tablet. I’l admit that I
probably recently added the timestamp string while I was on the Mac
session. What threw me off was the access error from Jruby. MRI gave me
an invalid argument error which made sense and I went ahead and cleaned
out the timestamp string to be vanilla safe. So as it stands on my
Windows tablet / notebook and on my Mac OS X mini tests prove true for
same code base and on same jruby sdk.

However, that is still not the case with my Windows PC which I have just
added into the mix. Why? Long story but superstorm Sandy has forced me
to work from home and the Win PC is far more comfortable to use than my
Win tablet (ASUS EP-121) which I have a setup a work to hook up to.

One of my issues going forward will simply be that I’'m just not used to
Java / Jruby error messages. Also I have to re-familiarize myself with
Java setups. My debugging will necessarily be slower until I get passed
this initial learning curve.

Charles M.
[email protected]

I’m afraid that the issue is more complicated that that.

Things work on my Mac OS X instance running under MRI 1.9.3 and Jruby
1.7 but they don’t one one of my Win installations where I’m also
encountering other strange issues I’ll share in another post.

On my Win notebook I encountered the same issue but I noticed that under
MRI I got an invalid argument error instead of the access error that
Jruby was spitting out. I narrowed it down to an issue with the format
of the file name I was using which it hadn’t care about before.

There’s obviously some issue with underlying Java setups and perhaps
upgrades of gems etc. I have not kept up with my Java so I’m probably
not setting things up properly.

Currently I’m trying to set all of my dev environments in the same exact
way as much as is possible to have a more controlled environment.

Charles M.
[email protected]

Charles,

EACCES is an operating system error number.

  • George

On 11/13/12 9:37 PM, Charles M. wrote:

Charles,

an MRI based project with little modification over JRuby ? Is there a
That’s an indication that the file permissions are likely wrong. Are you
running your JRuby program as the same user as your MRI ruby program? Is it the
same directory? Does the directory exist? Does it have write permission for the
user running the program?
each at org/jruby/RubyArray.java:1612

 http://xircles.codehaus.org/manage_email