1

I'm getting a very strange error w/ the requests library. When I run:

>>> import requests

in the console it works fine, but when I run the script:

import requests
print('done')

I get an error that it can't find a related module, utils (believe its email.utils)

ImportError: No module named utils

All other modules work load normally. Also, it's just in pycharm where the error occurs - things work fine in sublime text. Any thoughts?

user770
  • 11
  • 2

1 Answers1

2

You're probably using a different version of python to run the script than you're using for the console. Look at the top of the script. If there's a #/path/to/python, that's the python that will be used when you run the script. You can force it to use the same python as your console by doing python script.py, assuming python is what you normally run to open a console.

anderspitman
  • 9,230
  • 10
  • 40
  • 61