(Minor) error running X8 tutorial

Hello! Excellent work with SF and PL.

I just started playing around with SF and tried the X8 tutorial: (https://strawberryfields.ai/photonics/demos/tutorial_X8.html)

When I ran it, I got the following error message:

Traceback (most recent call last):

  File "C:\Users\dpope\Documents\personal\QML\strawberryFields\most recently downloaded\tutorial_X8.py", line 349, in <module>
    result = job.result

  File "C:\Users\dpope\Anaconda3\lib\site-packages\strawberryfields\api\job.py", line 119, in result
    raise AttributeError(

AttributeError: The result is undefined for jobs that are not completed (current status: open)

Just curious but is this what I should be getting? I’m using SF 0.19

It’s totally not a problem as I can just comment out the following two lines & then everything works OK:

result = job.result

(Or change the code to:

if job.status=="complete":
    result = job.result

    print("Job has not been completed."))

It’s just that I got the impression from the documentation that I should be getting something slightly different. Specifically, reading the “Job management” section of the X8 tutorial.

Anyway, many thanks!


Hi @Damian_Pope, it’s great to see you here in the forum!

According to the Demo, if the job isn’t complete you should get an InvalidJobOperationError. It is a different error type to what you’re getting, but the explanation of the error is exactly what we expect.

We should probably update the demo, adding the change you suggested. Would you like to open a pull-request with this change? If not just let me know.

Thank you for bringing this up!

1 Like

Hi @CatalinaAlbornoz , great to see you here too! Thanks for your informative reply. Yes, I’d love to open a pull request. I’m just not sure exactly where to do it :slight_smile: I searched the strawberryfields repository on GitHub but couldn’t find the file “tutorial_X8.py”. Maybe I’m missing something???

Thanks again!

Hi @Damian_Pope, the repo is private :see_no_evil: sorry! That’s why you couldn’t find it. I will create the issue in the repo.

Thank you again for pointing this out!

1 Like

Thanks! That’s very helpful.

1 Like