# Completed URL giving Python syntax error

**URL:** <https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695>\
**Category:** Online experiments\
**Created:** [November 2, 2022, 8:06pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695 "2022-11-02T20:06:10Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [November 2, 2022, 8:06pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/1 "2022-11-02T20:06:10Z")

</div>

I’m following this guide: [PsychoPy (Pavlovia) Help Page · Sona Systems](https://www.sona-systems.com/help/psychopy/)

But when I try and add the completed URL to my Pavlovia study in builder I am getting notice of an error.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/9/e92d05ebe21a3f3dc234c02f102ba2587fd07c89.png)

Edit: Per a previous post, I switched to “straight quotes” and it now works. I’m leaving this up in case there is some other issue with the guide I posted.

---

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [November 2, 2022, 8:27pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/2 "2022-11-02T20:27:30Z")

</div>

Hmm, everything is working, except when I test the experiment, clicking in SONA on the “Sample Link with embedded URL” the survey runs fine, saves my data, but then just hangs on a grey screen instead of going back to SONA. Any idea what might be causing that?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 2, 2022, 8:28pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/3 "2022-11-02T20:28:41Z")

</div>

Please could you show your Completed URL?

---

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [November 2, 2022, 8:31pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/4 "2022-11-02T20:31:13Z")

</div>

You got it:

`$"https://carleton.sona-systems.com/webstudy_credit.aspx?experiment_id=2513&credit_token=69748ad551ee43618190e6fea6af6469&survey_code=" + expInfo['participant']`

And here is a screenshot in case it is helpful:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/0/4032703e28d3dbca2500a5c85753cc3c4c678bbb.jpeg)

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 2, 2022, 8:37pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/5 "2022-11-02T20:37:21Z")

</div>

I can’t see an error in that, though I notice that you are still using html as an Output path. Do double-check that all of the single and double quotes are `"`dumb`"` not “smart”.

Though I now see that you’ve maybe fixed it

---

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [November 2, 2022, 8:38pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/6 "2022-11-02T20:38:38Z")

</div>

Thanks for taking a look.

Is there something I should use instead of Output Path = html?

---

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [November 2, 2022, 8:49pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/7 "2022-11-02T20:49:28Z")

</div>

Ah if I leave output path blank it works!

---

<div class="post-metadata">

**Author:** ![Tarro](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tarro](https://discourse.psychopy.org/u/Tarro)\
**Post date:** [April 26, 2023, 6:03pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/9 "2023-04-26T18:03:57Z")

</div>

Hi David, I was just wondering how did you manage to fix this problem in the end? I didn’t get what you mean by “switched to straight quotes”…  
The problem I’m facing now is exactly the same as yours, and when I put $" before the URL that I copied from SONA in the “completed URL” box, I will have an error saying that "Python syntax error in field ‘Completed URL’ ".  
Please can you give me some suggestions?  
Thanks!

---

<div class="post-metadata">

**Author:** ![David\_Sidhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_sidhu/32/14484_2.png) [@David\_Sidhu](https://discourse.psychopy.org/u/David_Sidhu)\
**Post date:** [April 26, 2023, 6:41pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/10 "2023-04-26T18:41:09Z")

</div>

Hello Tarro!

I managed to get it to work by clearing “html” from the Output path.

By straight quotes I meant " instead of ”.

Hope it helps!  
Dave

---

<div class="post-metadata">

**Author:** ![Tarro](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tarro](https://discourse.psychopy.org/u/Tarro)\
**Post date:** [April 26, 2023, 7:00pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/12 "2023-04-26T19:00:08Z")

</div>

Ahhh, I see. Thank you for your reply David! But in my case the output path is already in blank and if I add $” before the URL, then the error will appear.

If I didn’t put $” and test it, I can run the study and save my data, and then there’s a grey black window but cannot redirect back to SONA…

I need to let participants go to Pavlovia first then to Qualtrics. I’ve followed instructions on SONA’s helping system but didn’t work. Don’t have any clue what the problem is.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 26, 2023, 10:41pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/13 "2023-04-26T22:41:09Z")

</div>

Please show exactly what URL syntax you are using (preferably with both a screenshot and pasted text).

---

<div class="post-metadata">

**Author:** ![Tarro](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tarro](https://discourse.psychopy.org/u/Tarro)\
**Post date:** [April 26, 2023, 11:00pm UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/15 "2023-04-26T23:00:14Z")

</div>

Hi, here is the syntax I’m using

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/e/4e6d2a391a078227b5b037eef472d3b4810cbbda.png)

And here is a screenshot of the error. Hope it is helpful.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/1/7/17cd400542f89f16667dcc86b21e3dc0b7335e6a.png)

Thanks

---

<div class="post-metadata">

**Author:** ![Tarro](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tarro](https://discourse.psychopy.org/u/Tarro)\
**Post date:** [April 27, 2023, 9:05am UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/16 "2023-04-27T09:05:34Z")

</div>

And by the way, the version of my PsychoPy is v2022.1.3, just in case it can help.  
Thank you

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 27, 2023, 10:36am UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/17 "2023-04-27T10:36:42Z")

</div>

It looks like you have smart quotes round participant. Try deleting them and retyping them.

---

<div class="post-metadata">

**Author:** ![Tarro](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tarro](https://discourse.psychopy.org/u/Tarro)\
**Post date:** [April 27, 2023, 11:12am UTC](https://discourse.psychopy.org/t/completed-url-giving-python-syntax-error/31695/18 "2023-04-27T11:12:10Z")

</div>

Thanks a lot! Problem solved!
