Skip to content

BUG: Race condition when use PrintoutReport? #23

@damianbobrowski

Description

@damianbobrowski

Describe the bug

PS E:\debug\printout_report> python .\example.py
Connecting to server...
Traceback (most recent call last):
  File "E:\debug\printout_report\example.py", line 17, in <module>
    PrintoutReport.exportToPDF(2, PDF_REPORTS_DIR / f"2.pdf")
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\RSTAB\Reports\printoutReport.py", line 29, in exportToPDF
    model.clientModel.service.export_printout_report_to_pdf(report_id, target_file_path)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 559, in __call__
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 658, in send
    result = self.succeeded(binding, reply.message)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 696, in succeeded
    reply, result = binding.get_reply(self.method, reply)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\bindings\binding.py", line 152, in get_reply
    self.detect_fault(soapbody)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\bindings\binding.py", line 183, in detect_fault      
    raise WebFault(p, fault)
suds.WebFault: b"Server raised fault: 'Failed to export a report with the following error: Cannot export data to the printout report 'C:/Users/Administrator/AppData/Local/Dlubal/RSTAB9_9.02/instanceV2_7040_133324233331675213/cxemodel_rs9_0/content/reports/Demo2_2.rpr', because export process is already in progress.'"

To Reproduce
Happens randomly when want to export multiple reports. Assuming connected model has defined printout reports with id 1, 2, then sometimes it is possible to meet error with script

from pathlib import Path
from RSTAB.initModel import Model
from RSTAB.Reports.printoutReport import PrintoutReport

BASE_DIR = Path(__file__).resolve().parent
PRINTOUT_REPORTS_DEDICATED_DIR = BASE_DIR / "printout_reports"
PDF_REPORTS_DIR = PRINTOUT_REPORTS_DEDICATED_DIR / "pdf"
PDF_REPORTS_DIR.mkdir(parents=True, exist_ok=True)
HTML_REPORTS_DIR = PRINTOUT_REPORTS_DEDICATED_DIR / "html"
HTML_REPORTS_DIR.mkdir(parents=True, exist_ok=True)

Model(False,'cxe-model')

# loop is intentional to create error
for i in range(6):
    PrintoutReport.exportToPDF(1, PDF_REPORTS_DIR / f"1.pdf")
    PrintoutReport.exportToPDF(2, PDF_REPORTS_DIR / f"2.pdf")
    
    PrintoutReport.exportToHTML(1, HTML_REPORTS_DIR / f"1.html")
    PrintoutReport.exportToHTML(2, HTML_REPORTS_DIR / f"2.html")

Expected behavior
_
Screenshots
_

Desktop (please complete the following information):

  • Version of WIN10 OS: [WIN 10 ]
  • Version of RSTAB9
  • Version of tool [e.g. 1.7]

Additional context
_

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions