Yes it is possible to do it like that. I often do so, it is cleaner that hardcoding the SQL in your code.
Can you add the SQL to your post? there's probably a messed up character somewhere.
I do it like that (with pyodbc):
with open('%smysql.sql' % SQL_DIR) as f:
sql = f.read() % params # Don't do that with untrusted inputs
cursor.execute(sql)
cursor.commit()
cursor.close()
EDIT: Remove all the GO it's not an real SQL statement.
Check this answer: Using "GO" within a transactionUsing "GO" within a transaction.
Then it should be fine.