Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84757

Re: write file to a server

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; 'output': 0.05; 'subject:file': 0.07; 'string': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'windows': 0.15; 'backslashes': 0.16; 'folder,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literals': 0.16; 'traceback.': 0.16; 'folder': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'post': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'network.': 0.30; 'especially': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'helpful.': 0.31; 'file': 0.32; 'another': 0.32; 'proceed': 0.33; 'raw': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'server': 0.38; 'how': 0.40; "you've": 0.63; 'skip:r 40': 0.68; "'local'": 0.84; '2015': 0.84; 'working,': 0.84; 'to:none': 0.92; 'incredibly': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=C5YhbubeHVfk30VS/EOXUdzacRO0GN/zKWOb6tXBa5c=; b=oJ9MbxeUXx/ahbDKhqdljzc0nJ+cdG4xT6J/ar/fTDRDdhgnmPWjeNFSD3/T1ob7ep J2U11/MQI636hu7xGvRlCs7xcQeXhbK6amLW8EwAG53VHrJw/f1ZJ+lE1pwHSupmIYVU yxgLFd0cl4PNU4HKVFSc9CsFYKSgZgMTA6OctshMQ8JpEEz/BcWnXhOx2NHGaAYfmaHp LkKaIU8ZwkqYEwTyhjR0OWkQm4AxZacX3HQtnKl/lgey3CukaBF+LfHswI9enKdIWQTm 67c4bWGGxMpUFZpHhl/nxUokrzUDax/YL75iS5vgOqBHhh1cn/mEIU0n8cFQRMpVVFRr xL2A==
MIME-Version 1.0
X-Received by 10.42.52.200 with SMTP id k8mr3401525icg.26.1422454335758; Wed, 28 Jan 2015 06:12:15 -0800 (PST)
In-Reply-To <54C8E653.3070908@mrabarnett.plus.com>
References <6b5943a2-ab9d-4949-bfbe-7671740bb9fb@googlegroups.com> <54C8E653.3070908@mrabarnett.plus.com>
Date Thu, 29 Jan 2015 01:12:15 +1100
Subject Re: write file to a server
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18219.1422454345.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422454345 news.xs4all.nl 2917 [2001:888:2000:d::a6]:41803
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84757

Show key headers only | View raw


On Thu, Jan 29, 2015 at 12:38 AM, MRAB <python@mrabarnett.plus.com> wrote:
> On 2015-01-28 13:22, luca72 wrote:
>>
>> Hello i'm under windows, i have to write a file from my computer to a
>> local server like taht "\\DOCUMENTALE\my_folder\".
>> How i have to proceed ?
>>
> That's a path to a folder that just happens to be on another computer on
> your network. Treat it the same way you would for a 'local' folder,
> eg "C:\my_folder".

And if you've done that and it isn't working, one likely cause is that
Windows uses backslashes in path names, but Python string literals
treat backslashes specially. Use a raw string literal:

path = r"\\DOCUMENTALE\my_folder\some_file_name"
with open(path, "wb") as f:
    ... write to file ...

If you have other problems, the best thing to do is to post your code
and the exact output it produces, especially if that's a traceback.
Those are incredibly helpful.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

write file to a server luca72 <lucaberto@libero.it> - 2015-01-28 05:22 -0800
  Re: write file to a server MRAB <python@mrabarnett.plus.com> - 2015-01-28 13:38 +0000
  Re: write file to a server Chris Angelico <rosuav@gmail.com> - 2015-01-29 01:12 +1100
  Re: write file to a server Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-28 18:05 +0000
  Re: write file to a server Chris Angelico <rosuav@gmail.com> - 2015-01-29 08:38 +1100
  Re: write file to a server luca72 <lucaberto@libero.it> - 2015-01-28 23:44 -0800

csiph-web