question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting TypeError when trying to Webhook.find()

See original GitHub issue

Just updated to latest everything: py3.5 ShopifyAPI (2.1.5) pyactiveresource (2.1.2)

And the following code:

    if not shopify.Webhook.find(topic='orders/paid'):

Raise the following exception:

  File ".../venv/lib/python3.5/site-packages/pyactiveresource/activeresource.py", line 720, in _prefix_parameters
    for match in template.pattern.finditer(path):
TypeError: cannot use a string pattern on a bytes-like object

Some basic print debug shows the value of path at that point is b’'.

If I modify the offending code to use path.encode('utf-8') it succeeds, but fails later at:

  File ".../venv/lib/python3.5/site-packages/pyactiveresource/activeresource.py", line 737, in _prefix
    path = re.sub('/$', '', cls.prefix_source)
  File ".../venv/lib/python3.5/re.py", line 182, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object

So either this is byte/string failure in pyactiveresource, or ShopifyAPI isn’t setting values on its Webhook resource that the other lib needs.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
travis-stcommented, Sep 7, 2017

I had this issue when I did not activate the session prior to making the .find() call

shopify.ShopifyResource.activate_session(session)

0reactions
jamiemtdwyercommented, Sep 28, 2018

I’m not able to replicate this in Python 2.7.9 or 3.5.1. As suggested by the other commenter, make sure your session is initialized first.

If anyone is able to replicate this, please feel free to re-open it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when extracting data from JSON webhook - Stack Overflow
I am getting a Type Error for the json.loads(resp) ``` TypeError: the JSON object must be str, bytes or bytearray, not dict ```...
Read more >
Slack webhook in Zabbix
Hi, Recently upgraded to 5.2.0 on one of my installations. As we would like to have the notifications in Slack, I tried it...
Read more >
Errors - discord.js Guide
This error is caused by spawning a large number of event listeners, usually for the client. The most common cause of this is...
Read more >
PHP Fatal error: Uncaught TypeError: call_user_func_array()
Hello, My theme and woocommerce work great together until I update php from 7.4 to 8.0. I get this message from my hosting...
Read more >
Solved: application/x-www-form-urlencoded content type err...
I'm going to try to post a very quick summary of how I got this to work, with a Mailchimp webhook triggering a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found