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.
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.
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.
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.