Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103301
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | can try expect have if else. |
| Date | Sun, 21 Feb 2016 21:42:18 +0530 |
| Lines | 30 |
| Message-ID | <mailman.11.1456071141.20994.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 7p0KmZSJaciN8YBa1bk+GAj54x8F1IN2RDv9NoVnZ1tg== |
| Return-Path | <ganesh1pal@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; '"""': 0.05; 'python': 0.10; 'exception': 0.13; 'def': 0.13; 'received:io': 0.16; 'received:psf.io': 0.16; 'try:': 0.18; 'team,': 0.18; 'input': 0.18; 'to:name:python-list@python.org': 0.20; 'code.': 0.23; 'message-id:@mail.gmail.com': 0.27; '2.6': 0.27; 'raise': 0.29; 'code': 0.30; 'except': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'received:209': 0.38; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'improved': 0.63; 'subject:have': 0.80; 'subject:try': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=VyPgjmsPh3zqzwD7rs350FjKo+zNCmCdQcn7zmulXYw=; b=RYuQuakTYRrlR/DrnIx8jhfbBGXYXcePQpHhU0NM5XMC28rOjncAg2Bpq9gd7yY6h3 RvAEMXMV4Kg892CWcSQMkE2j9245XWLUU0rxMgiDbutmmV0b68LzkAESb2E6g6y40krg MgYzT4JFrhh9S6AsWReFc2tJ6/WTyN9IZbQya8cGlMoMS6YVjJ5EVSHWorudUkYvLRtw a9i9Z/7Ja/bhhDj5EKp+2mD6lsMibNfdzHgtPAP6uOkH6I8ECI8hyXUM0x7QPVigdIzc Y0AZfWmL26A5UsUmDPeK0n/u8jMn/hrMPoNNNI/YtyzNwNNLRN17bGcMpVCRr3mvzhIO ZAfA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=VyPgjmsPh3zqzwD7rs350FjKo+zNCmCdQcn7zmulXYw=; b=Nxk5kIVlkJDZN5QJ9SnyOaThbb3U4Mh4d9uX44weHpwbl6u3ov5GFlLqmMvJ44EK+i uwCNOCU8V/Dc1cHCS9d5NFbvYL46LhtVWVkRtvzAIidOCEEZDAJ2bLHOUHng46K9xMKD cnNA4o8x1oCmz5AIr3Lqw3a+g68CT71JrGawC8QH9cju9IjMLWoWYde3g9rDMc/DWiIN KfUHAiwicbMUoNIlmCAKoh2v7BNNIblHPaxyWLTpGhGF1VPnlV4d1ZDrlcBT0KZUhf5W 1/CuWzW4yebHMNOG+xkZWNNlc9BJ7XoHKAQgXMov3453hxNFpwAFzSF9DS1gqWTCG5PP OF8A== |
| X-Gm-Message-State | AG10YOQrO9K2xkZjnfwb/KnFK4JwXV5ANTk9wS+AhAKjCia7AXf3m6HWFwOX2NE0Z7abCZX/rtpIcsPbSGpVzw== |
| X-Received | by 10.25.152.135 with SMTP id a129mr7260729lfe.40.1456071138991; Sun, 21 Feb 2016 08:12:18 -0800 (PST) |
| 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:103301 |
Show key headers only | View raw
Hi Team,
Iam on python 2.6 , need input on the below piece of code.
EXIT_STATUS_ERROR=1
def create_dataset():
"""
"""
logging.info("Dataset create.....Started !!!")
try:
if os.path.ismount("/nfs_mount"):
touch_file("inode_fixcrc.txt")
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
2. How can the above code be improved
Regards,
Ganesh
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
can try expect have if else. Ganesh Pal <ganesh1pal@gmail.com> - 2016-02-21 21:42 +0530 Re: can try expect have if else. Steven D'Aprano <steve@pearwood.info> - 2016-02-22 21:36 +1100
csiph-web