Re: copy error



jtbutlerhvb@xxxxxxxxxxx wrote:
> When I try to copy a file I get the message 'No such file or
> directory'. I know the file is there and I know the path is correct
> because in fact the file does copy. However some of my files are not
> copying correctly and I am trying to figure out why so I am logging
> everything.
>
> #here is my code
> for () {
> ...
>
> $BAK->logMsg( "Copying $today\\$move_cube_name[4] to
> $yesterday\\$move_cube_name[4]" .
> copy("$today\\$move_cube_name[4]","$yesterday\\$move_cube_name[4]") .
> $!) ;
> #reset $! each time through loop
> $! = '';

You are inspecting $! unconditionally. The contents of $! only make sense
if the call actually failed. So what you are seeing is that somewhere
along the line, something that "copy" does is failing with that message,
but the "copy" itself does not fail, presumably because it successfully
recovers from the error.


> The above code is logged and it produces this output but the file is
> copied. It also returns a '1' which I dont not understand since it
> copied. Shouldnt it be '0'?

Have you read the documentation for the module you are using? What did
it say about the return value of "copy".

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: SendObhect method not working
    ... Sendobject called in a loop is known to fail: ... so why is it failing now? ...
    (microsoft.public.access.formscoding)
  • Re: Both headlights failing at the same time???
    ... Blue lights are crap. ... having both fail at exactly the same time was a bit of a coincidence. ... and shouldn't be failing together. ... blowing, not the high beam, because I rarely use the high beam. ...
    (rec.autos.makers.honda)
  • Re: File Closing Problem in 2.3 and 2.4, Not in 2.5
    ... It is very unlikely that there is a bug in Python where it would fail to ... you can use Sysinternal's process explorer. ... Put a print statement in the block that is supposed to close ... they may be out of "the loop" you thought that they were in. ...
    (comp.lang.python)
  • Re: On "TDD theory"
    ... about the notion of starting out with a *failing* test, and I confess that I have only a tenuous grasp of what this really means. ... public void testWhoopee() throws Exception { ... Another good reason for having the test first and having it fail first, because we haven't implemented the necessary code, is to help safe guard ourselves against dodgy tests or unexpected successes. ...
    (comp.object)
  • Re: Random numer generation without repetition
    ... if I'd use randperm it'll blow my memory ... redo the few that fail. ... loop will essentially never terminate. ...
    (comp.soft-sys.matlab)