Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get exception message

try:
    with open(filepath,'rb') as f:
        con.storbinary('STOR '+ filepath, f)
    logger.info('File successfully uploaded to '+ FTPADDR)
except Exception as e: # work on python 3.x
    logger.error('Failed to upload to ftp: '+ str(e))
Comment

python get exception message

try:
  # do something
  pass
except:
  # this will print the message "An exception occurred and the traceback" 
  # you can't have to explicitly give the message
  logger.exception("An exception occurred")
Comment

how to print python exception message

print(repr(e)) # Returns both the message and type of exception
Comment

python get message exception

str(your_exception)
Comment

PREVIOUS NEXT
Code Example
Python :: Python Iterating Through an Iterator 
Python :: load list from file python 
Python :: queue peek python 
Python :: df mask 
Python :: random number generator python 
Python :: reversing in python 
Python :: python dictionary print key value ascending order 
Python :: reload class module python 
Python :: time zone in python 
Python :: odoo model 
Python :: can list hold different data types in python 
Python :: convert rgb image to binary in pillow 
Python :: python increment 
Python :: literal_eval in python 
Python :: keras.callbacks.History 
Python :: python output text 
Python :: call javascript function flask 
Python :: python numpy array subtract 
Python :: closures in python 
Python :: randint 
Python :: python sort a list using defined order 
Python :: python qr scanner 
Python :: argparse type 
Python :: python singleton class 
Python :: for loop python 
Python :: python print bytes 
Python :: programação funcional python - lambda 
Python :: python get file ending 
Python :: how to create a new dataframe in python 
Python :: keys function in python 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =