Python Forum
import module with syntax error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import module with syntax error
#4
Technically any exception can be raised on an import (including those that are in the standard library as well as custom exceptions). But if you look at the built-in Exceptions, the only two errors that call out being raised on import are ImportError and SyntaxError.

What is your intent with catching the SyntaxError? What do you want the program to do when the import fails?
buran likes this post
Reply


Messages In This Thread
import module with syntax error - by Skaperen - Jun-21-2021, 10:56 PM
RE: import module with syntax error - by bowlofred - Jun-21-2021, 11:41 PM
RE: import module with syntax error - by Skaperen - Jun-22-2021, 02:39 AM
RE: import module with syntax error - by bowlofred - Jun-22-2021, 03:42 AM
RE: import module with syntax error - by buran - Jun-22-2021, 04:50 AM
RE: import module with syntax error - by bowlofred - Jun-22-2021, 06:52 AM
RE: import module with syntax error - by Skaperen - Jun-22-2021, 10:35 AM
RE: import module with syntax error - by Skaperen - Jun-22-2021, 10:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  POST Syntax error amplay 0 657 Aug-07-2024, 02:43 PM
Last Post: amplay
  is this really a syntax error? Skaperen 4 1,651 May-25-2024, 07:31 AM
Last Post: snippsat
  World Clock syntax error OscarBoots 1 1,129 May-03-2024, 05:20 AM
Last Post: snippsat
  Syntax error for "root = Tk()" dlwaddel 15 6,642 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 1,343 Jan-19-2024, 01:20 PM
Last Post: rob101
  is import cointegration_analysis a recognized module mitcht33 1 1,141 Nov-06-2023, 09:29 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 10,298 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 1,380 Aug-06-2023, 01:09 AM
Last Post: aupres
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 20,145 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  Syntax error while executing the Python code in Linux DivAsh 8 5,102 Jul-19-2023, 06:27 PM
Last Post: Lahearle

Forum Jump:

User Panel Messages

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