0

Why is that when I run this script do I get the error "cannot import name requests"

I have already run "pip install requests"

from bzrlib import branch,requests, json

def x:

        url = myURL
        data = json.dumps({"one": "two"})
        r = requests.post(url, data)

        print r.json
1
  • You have a syntax error here; def x: needs to have an argument list (can be empty). Commented May 31, 2014 at 15:35

1 Answer 1

6

You are trying to import bzrlib.requests, not the top-level package requests. The same applies to json here.

Move the imports to separate lines:

from bzrlib import branch
import requests
import json
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.