Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'mrab': 0.05; 'output': 0.05; 'subject:file': 0.07; 'string': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'windows,': 0.09; 'python': 0.11; 'jan': 0.12; 'language.': 0.14; 'windows': 0.15; 'backslashes': 0.16; 'folder,': 0.16; 'literals': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'traceback.': 0.16; 'folder': 0.16; 'language': 0.16; 'wrote:': 0.18; 'thu,': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'post': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'network.': 0.30; 'especially': 0.30; "i'm": 0.30; 'code': 0.31; 'helpful.': 0.31; 'names.': 0.31; 'file': 0.32; 'another': 0.32; 'proceed': 0.33; 'raw': 0.33; 'but': 0.35; 'done': 0.36; 'server': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you've": 0.63; 'our': 0.64; 'forward': 0.65; 'charset:windows-1252': 0.65; 'skip:r 40': 0.68; "'local'": 0.84; '2015': 0.84; 'working,': 0.84; 'incredibly': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: write file to a server Date: Wed, 28 Jan 2015 18:05:27 +0000 References: <6b5943a2-ab9d-4949-bfbe-7671740bb9fb@googlegroups.com> <54C8E653.3070908@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-222-48.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422468354 news.xs4all.nl 2837 [2001:888:2000:d::a6]:54661 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84773 On 28/01/2015 14:12, Chris Angelico wrote: > On Thu, Jan 29, 2015 at 12:38 AM, MRAB 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 > Windows will accept forward slashes in path names. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence