Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106400
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Michael Selik <michael.selik@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: [Beginner] - Hanging in the code, can't figure out what's wrong |
| Date | Sun, 03 Apr 2016 19:46:49 +0000 |
| Lines | 79 |
| Message-ID | <mailman.410.1459713208.28225.python-list@python.org> (permalink) |
| References | <66afb6f1-ca2b-4f9b-a1ec-ed255fa3030f@googlegroups.com> <ndpfno$fdh$1@dont-email.me> <e2cbbcf8-86f4-4c14-989e-1d8046d4215c@googlegroups.com> <ndpgql$im4$1@dont-email.me> <03c7da56-c752-460f-98b1-84b7166a2cc3@googlegroups.com> <ndpmuo$4sq$1@dont-email.me> <32c7ba6b-b61d-45fb-89a8-dd62aa09fe78@googlegroups.com> <ndrbl5$u2r$1@dont-email.me> <860f0703-08a1-4721-86c9-67ddc129cdc6@googlegroups.com> <99671ed7-7a89-4116-917d-3c9151847237@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 5DmBwg9rx69GXuiSDhaiwwjkrvMBxyyo0ltTeUJ9I1JA== |
| Return-Path | <michael.selik@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'paths': 0.05; 'sys': 0.05; 'except:': 0.07; 'subject:code': 0.07; 'python.': 0.11; 'def': 0.13; '>>>': 0.15; 'file,': 0.15; '2016': 0.16; '8:40': 0.16; 'file")': 0.16; 'file.close()': 0.16; 'file?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sys.exit(0)': 0.16; 'time).': 0.16; 'wrote:': 0.16; 'nested': 0.18; 'try:': 0.18; 'typing': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; '>>>': 0.20; 'suggested': 0.20; 'posted': 0.21; 'to:2**1': 0.21; 'trying': 0.22; 'tried': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'error': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'have,': 0.27; 'see,': 0.27; 'subject:what': 0.29; "i'm": 0.30; 'print': 0.30; 'that.': 0.30; 'url:mailman': 0.30; 'work.': 0.30; 'code': 0.30; 'error.': 0.31; 'url:python': 0.33; "i'll": 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'worked': 0.34; 'that,': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'done': 0.35; '8bit%:4': 0.35; 'exist': 0.35; 'generic': 0.35; 'path': 0.35; 'skip:p 30': 0.35; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; "won't": 0.38; 'received:209': 0.38; 'mean': 0.38; 'received:209.85.220': 0.38; 'google': 0.39; 'does': 0.39; 'subject:the': 0.39; "didn't": 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'hang': 0.60; 'your': 0.60; 'press': 0.61; 'internet,': 0.61; 'more': 0.63; 'skip:\xc2 10': 0.67; 'person.': 0.70; 'skip:n 40': 0.72; 'tone': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=lkWr///AEG/hE6s4GSYO7TdbJ3YNJ9HHBBArz7Xshx4=; b=B+VBCoPOU+pOgYriaKex2SxDY6Sur1VXQV62GSwcQ4WKekbMwCn9VLQuFVA4C4myUr WEVoYUndfFWU/Wx9M2rFND76k0Td6MBIwFuKHhPKJ8hYKqr7/YDvhFgwdqK+3SX8noB6 liuf8yfv9h4y+oz5xhCRUqNBxhFkv1ItuHLax05Z9LNWIvmy8hfePY5fUX+o82IGiwLd RBUBXY7YF/i9PkGGoGWzgHfT34i5UhHXMX+U5WDY5NHQBv5AKxCBQs/mhGzsqYmwcIu5 OatREK3dews5/ONLpOURN14/n+JDtJj48mNdwDUXvYP3jdhusQdNqFWjaca6y+umtQSJ eZ5w== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=lkWr///AEG/hE6s4GSYO7TdbJ3YNJ9HHBBArz7Xshx4=; b=hhYLODBk3yMdL/WRTCX9QFZYyxKDMlovex81+Y8BoCBiXG+C8RCkfAkPWeoVtm6Dg0 Sknd+vOP2rRp6C76Mq8a43qCfvIQtm3qD5AILZ6ZfZLAW1hzf3t5qbKmYZ2FU3X1P3SE SVILeZ3lCdXJ8b42mfFCoWSQBEzbTARQzkJdnPLxvipCS/paO/E2emH70VZx4383dPT/ PobKJuMFIDVUwIjkphMWOsySnDttZqkgbbr/J2OnNtihTrL1m89dP2PtC8MgKJR//Dt3 VRbGT+QIuIqKQKgq6bvSSZ99MjadVoaHnv5bdjhigPSL9+Oe6ywuZVasXwyyIDLKksXV zIHA== |
| X-Gm-Message-State | AD7BkJKjAB0vaLuQj/fuDdb/bo22AXFB3sUC9RttCq/2X03tHyAMdPhspKLVNs2Tli3ZHVBTw2Ksb+69kVl2Yg== |
| X-Received | by 10.55.24.208 with SMTP id 77mr30798064qky.45.1459712819257; Sun, 03 Apr 2016 12:46:59 -0700 (PDT) |
| In-Reply-To | <99671ed7-7a89-4116-917d-3c9151847237@googlegroups.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| 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> |
| Xref | csiph.com comp.lang.python:106400 |
Show key headers only | View raw
How do you know when you're done typing the name of the file?
It's hard to get tone right on the internet, so I'll clarify: this is not a
rhetorical question and I mean you, LoopIO, not a generic person.
On Sun, Apr 3, 2016, 8:40 PM Loop.IO <thisisink01@gmail.com> wrote:
> On Sunday, April 3, 2016 at 8:32:06 PM UTC+1, Loop.IO wrote:
> > On Sunday, April 3, 2016 at 4:11:49 PM UTC+1, BartC wrote:
> > > On 03/04/2016 15:41, Loop.IO wrote:
> > > > On Sunday, April 3, 2016 at 1:12:23 AM UTC+1, BartC wrote:
> > > >> On 02/04/2016 23:31, Loop.IO wrote:
> > > >>
> > > >>> Oh i see, so the code prompts for a name.. so i'm more lost than i
> thought, what do I need to change to make it just create the file with the
> chosen name Launch2.bat without the prompt?
> > > >>
> > > >> If you don't want the user to enter anything, then I explained how
> > > >> before, just use:
> > > >>
> > > >> name='C:\\Documents\\PythonCoding\\launch2.bat'
> > > >>
> > > >> if that's the file name you need.
> > > >>
> > > >> --
> > > >> Bartc
> > > >
> > > > Hi Bartc, i tried that, didn't work
> > >
> > > You mean it gave an error when you tried to create that file?
> > >
> > > Does that path already exist on your machine? If not then trying to
> > > create a file in a non-existent path won't work.
> > >
> > > You can create the path manually outside of Python. Or look up the docs
> > > to find out how to do that. A quick google suggested using os.makedirs
> > > (to create multiple nested paths at the same time).
> > >
> > > The following code worked on my machine:
> > >
> > > import sys
> > > import os
> > >
> > > def create():
> > > print("creating new file")
> > >
> > > path="c:/Documents/PythonCoding/"
> > > name=path+"launch2.bat"
> > >
> > > try:
> > > os.stat(path)
> > > except:
> > > os.makedirs(path)
> > >
> > > print (name)
> > >
> > > try:
> > > file=open(name,'w')
> > > file.close()
> > > except:
> > > print("error occured")
> > > sys.exit(0)
> > >
> > > create()
> > >
> > > --
> > > Bartc
> >
> > The issue is that it hangs, there is no error. its like it pauses until
> i press enter, ill try what you've posted one moment
>
> Ok the Bartc code gives me an error.
>
> What is it that makes the code hang with what I have, you said it was that
> it's prompting for a name for the file, so how do I bypass that and force
> it to create the file with the name I've provided?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-02 14:59 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-02 23:08 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Ned Batchelder <ned@nedbatchelder.com> - 2016-04-02 15:16 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-02 23:27 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-02 15:31 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-03 01:12 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-03 01:38 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 12:52 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 07:41 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-03 16:11 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Rustom Mody <rustompmody@gmail.com> - 2016-04-03 08:25 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-03 17:04 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 12:31 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 12:36 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Michael Selik <michael.selik@gmail.com> - 2016-04-03 19:46 +0000
Re: [Beginner] - Hanging in the code, can't figure out what's wrong BartC <bc@freeuk.com> - 2016-04-03 21:21 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 14:07 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Erik <python@lucidity.plus.com> - 2016-04-03 20:46 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 12:54 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Erik <python@lucidity.plus.com> - 2016-04-03 21:15 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 13:25 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Erik <python@lucidity.plus.com> - 2016-04-03 22:26 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 14:49 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Erik <python@lucidity.plus.com> - 2016-04-03 23:07 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Ben Finney <ben+python@benfinney.id.au> - 2016-04-05 06:49 +1000
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Michael Selik <michael.selik@gmail.com> - 2016-04-02 22:37 +0000
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-03 01:11 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-02 15:23 -0700
Re: [Beginner] - Hanging in the code, can't figure out what's wrong Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-03 01:08 +0100
Re: [Beginner] - Hanging in the code, can't figure out what's wrong "Loop.IO" <thisisink01@gmail.com> - 2016-04-03 07:45 -0700
csiph-web