I'm making a React app with a Python/Flask back end. The user enters some information, this is sent to a python script that enters it into a crystal report, the report is generated & saved as a PDF on the server, and then the PDF is sent back to the user.
This exact script has worked on a different machine with an HTML front end, so the code itself should be solid. When I try to use it with my app, it gets stuck on this line:
app2=Dispatch('CrystalRuntime.Application')
And I get this error:
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
My understanding is that this means that Python thinks Crystal Reports isn't installed. It definitely is installed. I've tried uninstalling and reinstalling a few different versions to see if that resolved the issue, but it hasn't. I've made sure that both Python and Crystal Reports are both 64 bit. Why can't they talk to each other?
More of my script:
import os
import sys
import pythoncom
pythoncom.CoInitialize ()
from win32com.client import Dispatch
import win32com.client
import pyodbc
import pandas as pd
def Generate_Final_Report(self,Batch, PerDiem):
pythoncom.CoInitialize()
app2=Dispatch('CrystalRuntime.Application') #it never gets past here