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: 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; '")': 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 Date: Mon, 18 Aug 2014 11:48:45 +0200 Subject: Re: error with files To: ngangsia akumbo 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --089e0117679dad29df0500e4486d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 : > 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 > file.write(file1) > TypeError: function takes exactly 1 argument (0 given) > > > > import os.path > > save_here =3D '/home/yems/newfile/' > file_name =3D raw_input("Enter file name: ") > filesname =3D os.path.join(save_here, file_name+".txt") > > file1 =3D open(filesname, 'w') > > file_data =3D raw_input('write in data: ') > > file.write(file1) > > file1.close() > -- > https://mail.python.org/mailman/listinfo/python-list > --=20 Miguel Garc=C3=ADa 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 =C3=A9l. --089e0117679dad29df0500e4486d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You are trying to write the open file (file1) in the file = type.

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

fi= le1.write(file_data)=C2=A0=C2=A0 # instead of file.write(file1)


2014-08-18 11:41 GMT+02:00 ngangsia akum= bo <ngangsia@gmail.com>:
error

yems ~ # nano testfile1
yems ~ # python=C2=A0 testfile1
Enter file name: g
write in data:=C2=A0 g
Traceback (most recent call last):
=C2=A0 File "testfile1", line 11, in <module>
=C2=A0 =C2=A0 file.write(file1)
TypeError: function takes exactly 1 argument (0 given)



import os.path

save_here =3D '/home/yems/newfile/'
file_name =3D raw_input("Enter file name: ")
filesname =3D os.path.join(save_here, file_name+".txt")

file1 =3D open(filesname, 'w')

file_data =3D raw_input('write in data:=C2=A0 ')

file.write(file1)

file1.close()
--
https://mail.python.org/mailman/listinfo/python-list



--
Miguel Garc=C3= =ADa Lafuente - Rock Neurotiko

Do it, the devil is in the detail= s.
The quieter you are, t= he more you are able to hear.
Happy Coding. Code with Passion, Decode with Pat= ience.=
If we make consistent = effort, based on proper education, we can change the world.

El contenido de este e-mail es pr= ivado, no se permite la revelacion del contenido de este e-mail a gente aje= na a =C3=A9l.
--089e0117679dad29df0500e4486d--