Re: Problem while copying a file from a remote filer

2009-03-25 Thread Aahz
In article mailman.1957.1237182478.11746.python-l...@python.org,
Chris Rebert  c...@rebertia.com wrote:
On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com
venutaurus...@gmail.com wrote:
 Hi all,
 I have to write an application which does a move and
copy of a
 file from a remote machine to the local machine. I tried something
 like:

 file =3D urvenuwin2008\\C\\4Folders\\Folder02\\Folder002\
 \TextFile_06.txt

The 'r' prefix on the string makes it a raw string, meaning you don't
have do double-up the backslashes, but you did so anyway, so your path
has many extra backslashes, making it invalid. Dropping the 'r' prefix
should fix the problem.

Alternatively, and I think better practice, undouble the backslashes
instead of removing the 'r' prefix.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

At Resolver we've found it useful to short-circuit any doubt and just
refer to comments in code as 'lies'. :-)
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-3-22
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem while copying a file from a remote filer

2009-03-17 Thread Jorgen Grahn
On Sun, 15 Mar 2009 22:47:54 -0700, Chris Rebert c...@rebertia.com wrote:
 On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com
 venutaurus...@gmail.com wrote:
 Hi all,
      I have to write an application which does a move and copy of a
 file from a remote machine to the local machine. I tried something
 like:

 file = urvenuwin2008\\C\\4Folders\\Folder02\\Folder002\
 \TextFile_06.txt

 The 'r' prefix on the string makes it a raw string, meaning you don't
 have do double-up the backslashes, but you did so anyway, so your path
 has many extra backslashes, making it invalid. Dropping the 'r' prefix
 should fix the problem.

Also, the file isn't really remote if you can use the normal local
file system calls to read it.

/Jorgen

-- 
  // Jorgen Grahn grahn@Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se  R'lyeh wgah'nagl fhtagn!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem while copying a file from a remote filer

2009-03-17 Thread Tim Golden

Jorgen Grahn wrote:

On Sun, 15 Mar 2009 22:47:54 -0700, Chris Rebert c...@rebertia.com wrote:

On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com
venutaurus...@gmail.com wrote:

Hi all,
 I have to write an application which does a move and copy of a
file from a remote machine to the local machine. I tried something
like:

file = urvenuwin2008\\C\\4Folders\\Folder02\\Folder002\
\TextFile_06.txt

The 'r' prefix on the string makes it a raw string, meaning you don't
have do double-up the backslashes, but you did so anyway, so your path
has many extra backslashes, making it invalid. Dropping the 'r' prefix
should fix the problem.


Also, the file isn't really remote if you can use the normal local
file system calls to read it.


That's a slightly strange position to take. 
When *is* it remote, then?


TJG
--
http://mail.python.org/mailman/listinfo/python-list


Problem while copying a file from a remote filer

2009-03-15 Thread venutaurus...@gmail.com
Hi all,
  I have to write an application which does a move and copy of a
file from a remote machine to the local machine. I tried something
like:

file = urvenuwin2008\\C\\4Folders\\Folder02\\Folder002\
\TextFile_06.txt
dest = C:\\test
shutil.copy(file,dest)

But it is throwing an error:

Traceback (most recent call last):
  File E:\venu\Testing Team\test.py, line 22, in module
shutil.copy(file,dest)
  File C:\Python26\lib\shutil.py, line 88, in copy
copyfile(src, dst)
  File C:\Python26\lib\shutil.py, line 52, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 22] invalid mode ('rb') or filename: u'\\\
\venuwin2008C4FoldersFolder02Folder002\\\
\TextFile_06.txt'

Can some one please help me in this regard.

Thank you
Venu madhav
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem while copying a file from a remote filer

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com
venutaurus...@gmail.com wrote:
 Hi all,
      I have to write an application which does a move and copy of a
 file from a remote machine to the local machine. I tried something
 like:

 file = urvenuwin2008\\C\\4Folders\\Folder02\\Folder002\
 \TextFile_06.txt

The 'r' prefix on the string makes it a raw string, meaning you don't
have do double-up the backslashes, but you did so anyway, so your path
has many extra backslashes, making it invalid. Dropping the 'r' prefix
should fix the problem.

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list