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


Groups > comp.lang.python > #76469

Re: error with files

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <miguelglafuente@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; 'subject:error': 0.03; 'argument': 0.05; '&quot;)': 0.09; 'data:': 0.09; 'gente': 0.09; 'os.path': 0.09; 'subject:files': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "'w')": 0.16; 'devil': 0.16; 'file1': 0.16; 'file_name': 0.16; 'given)': 0.16; 'typeerror:': 0.16; 'trying': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'file': 0.32; 'open': 0.33; 'url:python': 0.33; '(most': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'consistent': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'skip:o 20': 0.38; 'skip:& 10': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'url:mail': 0.40; 'details.': 0.61; 'name:': 0.61; 'world.': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'este': 0.70; 'education,': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=dzhEX3XGBEE6kXBBTttR/0FyAOxgArGSkrJogHxFEz4=; b=F/OGRF0wMTxRPNSLQkT5PvMwLKAjyPqQl6SmT0SL3J51H3Ak48VlB7xibAdBRyv3/X DhHuA3L4LYiy/6wAhTpDg0mwiavb3g07gUiNvpibWqmfAubxXBmEEGtshmpN7aU03VHk SDk7Tg862+m5Am6UR0vGgalO5BkQpQ0Fk1CYmAQG6bIMXsntu45bC47jlhTZGouVrHvu aGV+Wx9sr/4vewgImwgGeFrjlvripr1TMfkEVCddjfwRp862JM7ntLucZbd/7ZAXdyc/ 0TSszSnU7E7els9GGZNZmadxws5B8ecjVEVSR7Fb+55qqhN7SdinlLGKJ0TdvedaV/Nq BqfA==
X-Received by 10.152.170.196 with SMTP id ao4mr28163187lac.44.1408355355403; Mon, 18 Aug 2014 02:49:15 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <77b81003-3a5d-4a54-b609-e0f0b6f1d0de@googlegroups.com>
References <77b81003-3a5d-4a54-b609-e0f0b6f1d0de@googlegroups.com>
From Rock Neurotiko <miguelglafuente@gmail.com>
Date Mon, 18 Aug 2014 11:48:45 +0200
Subject Re: error with files
To ngangsia akumbo <ngangsia@gmail.com>
Content-Type multipart/alternative; boundary=089e0117679dad29df0500e4486d
X-Mailman-Approved-At Mon, 18 Aug 2014 12:45:19 +0200
Cc python-list@python.org
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.13094.1408358720.18130.python-list@python.org> (permalink)
Lines 137
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408358720 news.xs4all.nl 2935 [2001:888:2000:d::a6]:35732
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76469

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

You are trying to write the open file (file1) in the file type.

I think that you wanted to write in file1, the data:

file1.write(file_data)   # instead of file.write(file1)


2014-08-18 11:41 GMT+02:00 ngangsia akumbo <ngangsia@gmail.com>:

> error
>
> yems ~ # nano testfile1
> yems ~ # python  testfile1
> Enter file name: g
> write in data:  g
> Traceback (most recent call last):
>   File "testfile1", line 11, in <module>
>     file.write(file1)
> TypeError: function takes exactly 1 argument (0 given)
>
>
>
> import os.path
>
> save_here = '/home/yems/newfile/'
> file_name = raw_input("Enter file name: ")
> filesname = os.path.join(save_here, file_name+".txt")
>
> file1 = open(filesname, 'w')
>
> file_data = raw_input('write in data:  ')
>
> file.write(file1)
>
> file1.close()
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Miguel García Lafuente - Rock Neurotiko

Do it, the devil is in the details.
The quieter you are, the more you are able to hear.
Happy Coding. Code with Passion, Decode with Patience.
If we make consistent effort, based on proper education, we can change the
world.

El contenido de este e-mail es privado, no se permite la revelacion del
contenido de este e-mail a gente ajena a él.

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


Thread

error with files ngangsia akumbo <ngangsia@gmail.com> - 2014-08-18 02:41 -0700
  Re: error with files Paul Wiseman <poalman@gmail.com> - 2014-08-18 11:07 +0100
    Re: error with files ngangsia akumbo <ngangsia@gmail.com> - 2014-08-18 03:34 -0700
  Re: error with files Peter Otten <__peter__@web.de> - 2014-08-18 12:09 +0200
  Re: error with files Rock Neurotiko <miguelglafuente@gmail.com> - 2014-08-18 11:48 +0200

csiph-web