Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103316
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: can try expect have if else. |
| Date | Sun, 21 Feb 2016 12:22:02 -0700 |
| Lines | 43 |
| Message-ID | <mailman.23.1456082530.20994.python-list@python.org> (permalink) |
| References | <CACT3xuWMtxjC+6idsj_RfWVXLS-QCzQSdGaj2Kk4g4_EH9_wPA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de yoPGJhMSaq8ixtn3bCPW6gqYv9c/Cgj0lm9I3/frIvhw== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; '"""': 0.05; '21,': 0.07; 'cc:addr:python-list': 0.09; 'python': 0.10; 'exception': 0.13; 'def': 0.13; "hasn't": 0.15; '2.7?': 0.16; '2016': 0.16; '9:13': 0.16; 'cc:name:python': 0.16; 'docstring': 0.16; 'exclamation': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'try:': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'team,': 0.18; 'input': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'meant': 0.22; 'am,': 0.23; 'code.': 0.23; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'supported': 0.27; 'skip:t 40': 0.27; 'message- id:@mail.gmail.com': 0.27; '2.6': 0.27; 'raise': 0.29; 'supposed': 0.31; 'skip:s 30': 0.31; 'directory,': 0.33; 'file': 0.34; 'except': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'there': 0.36; 'created': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'skip:& 10': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'log': 0.38; 'skip:e 20': 0.39; 'course.': 0.67; 'url:info': 0.71; 'upgrading': 0.72; 'subject:have': 0.80; 'subject:try': 0.84; 'to:none': 0.91; 'preventing': 0.91; '2013.': 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; bh=hPBuOOrsf3K4/OdKTPiQuOE2W+ybK8iFGn1P04zuqN0=; b=lmmBweV6nXlMRq4TRMmxelFbikau9M/WAXMgktI3b7ucqsnIdhI/APCC5LiatZfPJ6 okVHXurYLwMvqLBFP1MFjQeu2jI2mQqMpLIcBJf94OsqJnyPymzmOnXLHq0QtdOVJxr1 WAbxr24C1/8w1RuOuWMNP1CvXuwVrSAS6vxNw4ngIeHRoZn+8tUUYjuQ9f8nS2sfjxFv T+KNtv5gr/VuOvfQdqsG1hpo2hPb2uS50Bnlkp5FumzYd+eWCp34g7EMk7YCV8bYes5s HXw4Thj9ycBQdyJzV/XG7l5bvUWm8qJhKgkaveQZUX1IZyAk2/NKlvzRSd/ammPVnJk1 qpLA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=hPBuOOrsf3K4/OdKTPiQuOE2W+ybK8iFGn1P04zuqN0=; b=i0DhBRrwTJZ0+eiDPJPsBo6BMdURGdBog+kv6d7PHDudpxDH+pQIOYB0ev9wcMDupu o1oQaPaXCjkoShOSXR8ACKAnEJtWkl9usR2Fa29bjriwY5HZlaB3eMURZ/dJBETsjEwj zkVMMfU89G7U37NdrVM8NBXFucuiP5z5TpJf5ZjEbAZQ/a4s/Ch8OrmX8mtpLiBdHfWP D96Yge082RpEaS+KHM8L43g6cPgrMQIuZy0LBfSdeWt/70+B5sxLFJr1VPzhb7McYsbU R4u9URq++gGRwDANC43GT1Z0p8al7lzoQa2nLD/VLNrLhfG0/atcQeHD+RRthIt6Dnt7 TMsg== |
| X-Gm-Message-State | AG10YOTbOJNPeNCAL6PQuOxuR7Q+PZXh5rMD1C/JBLFObMcRkVknvU1teNTWxErIWLJXhOZ+kZ68vgxy0e4ZZQ== |
| X-Received | by 10.50.138.76 with SMTP id qo12mr7720763igb.85.1456082522684; Sun, 21 Feb 2016 11:22:02 -0800 (PST) |
| In-Reply-To | <CACT3xuWMtxjC+6idsj_RfWVXLS-QCzQSdGaj2Kk4g4_EH9_wPA@mail.gmail.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21rc2 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| 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:103316 |
Show key headers only | View raw
On Feb 21, 2016 9:13 AM, "Ganesh Pal" <ganesh1pal@gmail.com> wrote:
>
> Hi Team,
>
> Iam on python 2.6 , need input on the below piece of code.
Python 2.6 isn't supported and hasn't been since October 2013. Is there
something preventing you from upgrading to 2.7?
> EXIT_STATUS_ERROR=1
>
> def create_dataset():
> """
> """
Empty docstring is pointless.
> logging.info("Dataset create.....Started !!!")
This is just a pet peeve of mine, but do info-level log messages really
need triple exclamation marks?
> try:
> if os.path.ismount("/nfs_mount"):
> touch_file("inode_fixcrc.txt")
Is this file really meant to be created in the current working directory,
or is it supposed to be inside the /nfs_mount?
> logging.info("Dataset create.....Done !!!")
> else:
> raise Exception("/nfs_mount is not mounted. Dataset create
> failed !!!")
> return False
> except Exception as e:
> logging.error(e)
> sys.stderr.write("Dataset create failed...Exiting !!!")
> sys.exit(EXIT_STATUS_ERROR)
> return True
>
> 1. Can we have if else with in a try except block
Yes, of course.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: can try expect have if else. Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-21 12:22 -0700
csiph-web