1

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

1 Answer 1

-1
  • Did you install the Crystal Reports Runtime (not Crystal Reports Designer)?

  • Did you make sure that the Service Pack (SP) level of the runtime matches the SP level used to develop the application?

Sign up to request clarification or add additional context in comments.

2 Comments

I have tried installing Crystal Reports Runtime, yes.
However, I'm not sure if the Runtime SP level matches my app. I can see all the different runtime downloads on SAP's site and they list SPXX. When you mention SP level, are you talking about the Windows Service Pack on my machine, or something else? I'm looking in my PC and can see that I've got Windows 10, version 22H2, OS build 19045.6332, but nothing mentioning any service packs. I'm sorry if this is a dumb question; I'm a self-taught in programmer and this is the first time I've run into anything like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.