Python Forum
log.exception() without arguments in old Python versions?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
log.exception() without arguments in old Python versions?
#1
Question 
I have inherited some very old Python code:

import logging
_log = logging.getLogger('blah')
and later:

try:
   <snip>
except:
   _log.exception()
This call to exception() without arguments fails on Python 2.7 (the oldest version I have available to me) and 3.10 (which I'm targeting).

Was this syntax supported in a really old version of Python? If so, with what should I replace it now to get the same semantics?
Reply


Messages In This Thread
log.exception() without arguments in old Python versions? - by cthart - Nov-18-2022, 09:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 875 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 504 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  How do I handle escape character in parameter arguments in Python? JKR 6 1,618 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  Python versions with libexpat fixes raghupcr 5 2,835 Feb-24-2022, 06:26 PM
Last Post: raghupcr
  Installed versions of Python SamHobbs 5 2,761 Sep-02-2021, 02:28 PM
Last Post: jefsummers
  Different versions of Python3 and Python Led_Zeppelin 2 2,467 Jun-16-2021, 05:31 AM
Last Post: snippsat
  Python Versions ThatTamyBot 2 2,842 Mar-11-2021, 11:27 AM
Last Post: ThatTamyBot
  I seem to have two versions of python 3.7.9 installed miner_tom 7 4,803 Nov-22-2020, 06:42 PM
Last Post: miner_tom
  code with exception arguments doen't work MaartenRo 1 2,042 Aug-09-2020, 06:06 AM
Last Post: Gribouillis
  Exception handling in regex using python ShruthiLS 1 2,464 May-04-2020, 08:12 AM
Last Post: anbu23

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020