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
  World Clock syntax error OscarBoots 1 165 May-03-2024, 05:20 AM
Last Post: snippsat
  Syntax error for "root = Tk()" dlwaddel 15 1,289 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 437 Jan-19-2024, 01:20 PM
Last Post: rob101
  is import cointegration_analysis a recognized module mitcht33 1 461 Nov-06-2023, 09:29 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 1,511 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 741 Aug-06-2023, 01:09 AM
Last Post: aupres
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 7,027 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  Syntax error while executing the Python code in Linux DivAsh 8 1,687 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Code is returning the incorrect values. syntax error 007sonic 6 1,269 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,368 Feb-03-2023, 05:10 PM
Last Post: mgallotti

Forum Jump:

User Panel Messages

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