Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > File.utime returns Invalid argument on Windows (winXP, ruby 1.8.5/1.8.6).

Reply
Thread Tools

File.utime returns Invalid argument on Windows (winXP, ruby 1.8.5/1.8.6).

 
 
Matt Scilipoti
Guest
Posts: n/a
 
      06-05-2007
I am receiving an "Invalid argument" error from File.utime.

irb> testfile = 'd:/temp/2007/06/test.txt'
=> "d:/temp/2007/06/test.txt"
irb> File.utime(0, Time.now, testfile)
Errno::EINVAL: Invalid argument - d:/temp/2007/06/test.txt
from (irb):4:in `utime'
from (irb):4
irb> File.exist?(testfile)
=> true
irb> File.writable?(testfile)
=> true

My local user group suggested:
irb> require 'time'
=> false

False?

I tried this on two computers:
| WinXP SP2 | WinXP SP2 |
| Ruby 1.8.6 | 1.8.5 |
| NTFS | FAT32 |

A friend has these same specs, but it works for him.
Google for 'ruby, windows, File.utime, "Invalid Argument"' (and various versions
of this) doesn't help. It does appear in a nice Ruby poetry jam.

Any ideas?

 
Reply With Quote
 
 
 
 
Daniel Berger
Guest
Posts: n/a
 
      06-06-2007
On Jun 5, 11:55 am, "Matt Scilipoti" <(E-Mail Removed)>
wrote:
> I am receiving an "Invalid argument" error from File.utime.
>
> irb> testfile = 'd:/temp/2007/06/test.txt'
> => "d:/temp/2007/06/test.txt"
> irb> File.utime(0, Time.now, testfile)
> Errno::EINVAL: Invalid argument - d:/temp/2007/06/test.txt
> from (irb):4:in `utime'
> from (irb):4
> irb> File.exist?(testfile)
> => true
> irb> File.writable?(testfile)
> => true


Is D: a hard disk? Or is it a CDROM, usb drive, etc? Hey, gotta ask.

> My local user group suggested:
> irb> require 'time'
> => false
>
> False?


Unrelated. It means it was already loaded, probably by rubygems. An
actual failure would raise an error.

Regards,

Dan


 
Reply With Quote
 
 
 
 
Matt Scilipoti
Guest
Posts: n/a
 
      06-06-2007
Solved (mostly), thanks to:

Nicholas Evans, who suggested that Windows may not accept a date of 0
(the first param sets access time). It doesn't. I knew that. Bad
brain. Thanks for asking an "is it plugged in" type of question.

Daniel Berger, for reminding me that "require 'x' -> false" doesn't
mean "we can't find 'x'" - it just means that it is ALREADY required.
I knew that too. Funny how, in this context, I easily accepted an
incorrect translation of the results, because it was corroborating
evidence - exactly what I was looking for. And thanks for another "is
it plugged in?" question. Yes, D: drive is a hard drive.

Why "mostly"? This code is derived from a battery of tests for a
project in a User Group. These tests pass for another Windows user.
We will investigate next meeting.

Thanks to all,
Matt

On 6/6/07, Daniel Berger <(E-Mail Removed)> wrote:
> On Jun 5, 11:55 am, "Matt Scilipoti" <(E-Mail Removed)>
> wrote:
> > I am receiving an "Invalid argument" error from File.utime.
> >
> > irb> testfile = 'd:/temp/2007/06/test.txt'
> > => "d:/temp/2007/06/test.txt"
> > irb> File.utime(0, Time.now, testfile)
> > Errno::EINVAL: Invalid argument - d:/temp/2007/06/test.txt
> > from (irb):4:in `utime'
> > from (irb):4
> > irb> File.exist?(testfile)
> > => true
> > irb> File.writable?(testfile)
> > => true

>
> Is D: a hard disk? Or is it a CDROM, usb drive, etc? Hey, gotta ask.
>
> > My local user group suggested:
> > irb> require 'time'
> > => false
> >
> > False?

>
> Unrelated. It means it was already loaded, probably by rubygems. An
> actual failure would raise an error.
>
> Regards,
>
> Dan
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted Returns List and Reversed Returns Iterator ++imanshu Python 7 08-23-2008 04:25 AM
createImage sometime returns null and sometime returns non-null. vizlab Java 3 10-17-2007 11:21 AM
How do fix: "Wrong number of arguments" / "invalid propert assignment"/ "Invalid argument" Java Guy Javascript 1 10-15-2006 08:41 PM
How do fix: "Wrong number of arguments" / "invalid propert assignment"/ "Invalid argument" Java Guy Java 1 10-15-2006 08:31 PM
block returns and hash element returns Trans Ruby 2 11-06-2005 12:15 PM



Advertisments