dia-gov's picture
Create app.py
980878b verified
raw
history blame
789 Bytes
import os
def main():
try:
# Ensure the app module is correctly named
app_module = "app"
if not os.path.exists(f"{app_module}.py"):
raise ImportError(f"Module '{app_module}' not found.")
# Ensure there are no syntax errors
with open(f"{app_module}.py", "r") as file:
code = file.read()
compile(code, f"{app_module}.py", 'exec')
# Ensure there are no import errors
import app
print("App module is correctly named, has no syntax errors, and no import errors.")
except ImportError as e:
print(f"ImportError: {e}")
except SyntaxError as e:
print(f"SyntaxError: {e}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()