Is there a way to make Exceptions.Exceptions to Exceptions? I am using python

Question:

I’ve already tried to do:

import Exceptions.Exceptions

This still doesn’t work, I’ve also tried but this has given me a SyntaxError:

from . import Exceptions.Exceptions

This is a package if you need to know.

Asked By: Panda

||

Answers:

I assume you want to import from a file Exceptions.py the class Exceptions. First you need to make sure that Exceptions.py is in your search path. The folder that you start your script in is usually in your search path.

Then you can do

from Exceptions import Exceptions

Afterwards you can use just Exceptions and it refers to the class.

Answered By: Chris
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.