I have a chunk of Python code that is supposed to create MySQL schemas when executed. The issue is that whenever I run it, I get an error saying Raise Exception(e). Exception: [Error 2] the system cannot find the file specified
Below is my code:
from test.db.db import DB
from test.config import loggingSetup
loggingSetup.initializeLogging("createTest.py")
import logging
def createSports(db):
sqlFile = "..\\sql\\createSchema.sql"
db.run(sqlFile)
def create():
db=DB()
createSports(db)
def Main():
create()
if__name__=='__main__':
try:
main()
except Exception, e:
logging.info(e.message)
raise Exception(e)
Now I will admit, this code isn't entirely mine. I found this online, and I'm trying to rework it so it will fit my needs. My experience with python is minimal at best, but you have to start somewhere. On a basic level I under stand that the if statement is saying if __name__=='__main__' then try main()
, but i guess I'm fuzzy as to why this exception is being thrown. I know this chunk of code has worked for others who have used it for similar projects, is there something wrong with my syntax that is throwing this off?