[Python] Is there a way to get Revit Python Shell not to buffer the print statement?

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a way to get Revit Python Shell not to buffer the print statement?

    For example, with this code, it is clear to see that RPS will not show anything on the screen until after the loop has finished. Which I am assuming is the result of RPS buffering the output of the print statement.

    for i in range(1, 100):
    print i
    time.sleep(1)


    While this OK for most things I work on, this behavior will not work for this project...

    Here is a quick overview of the project code:

    Start ACC (AcCoreConsole) program using popen
    for file in filelist:
    send file name to ACC for processing via the input Pipe (a file)
    read results from ACC via the output Pipe (a file).
    (the above steps are working ok)
    print results to Revit Python Shell's screen.
    Close ACC


    Again nothing shows on the RPS's screen until after the loop is done.

    If I can not shut down or reduce the buffering, perhaps there is a different approach I could use? Maybe something other than "print"? Or perhaps, a dedicated output window?

    Sincerely; Michelle

    Continue reading...

Compartilhe esta Página