Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103316 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2016-02-21 12:22 -0700 |
| Last post | 2016-02-21 12:22 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: can try expect have if else. Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-21 12:22 -0700
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2016-02-21 12:22 -0700 |
| Subject | Re: can try expect have if else. |
| Message-ID | <mailman.23.1456082530.20994.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web