Python Forum
SyntaxError: invalid character in identifier - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: SyntaxError: invalid character in identifier (/thread-20066.html)



SyntaxError: invalid character in identifier - ricardodepaula - Jul-25-2019

Hellos Guys! Wink

python is returning this error:


params = {
^
SyntaxError: invalid character in identifier


how can i solve this?

import requests
from requests_oauthlib import OAuth1
import json
from urllib.parse import urlparse

url_rest = "https://api.twitter.com/1.1/search/tweets.json" # rest API
url_streaming = "https://stream.twitter.com/1.1/statuses/sample.json" # streaming API



params = {
'app_key':'jvX0xAoOkjjhh776s5UzGCVg',
'app_secret':'3mBZi2pjTYBB65480098Uh0QUcyFR77AAp1vD5PhT4',
'oauth_token':'53726058-YRnRLOcLjkljkjk87TgiIMNkCHcHUhPGgG5GULAm3',
'oauth_token_secret':'NIZ2Jw8ARVH2iD465456kkHYo8M8GBKDHyRumqYQ1iEX'
}

auth = OAuth1(
params['app_key'],
params['app_secret'],
params['oauth_token'],
params['oauth_token_secret']
)



RE: SyntaxError: invalid character in identifier - ichabod801 - Jul-25-2019

It looks like there is a non-printing character before params. I put the cursor before the p in params, backspaced twice, and the error went away.


RE: SyntaxError: invalid character in identifier - ricardodepaula - Jul-25-2019

You're right!! Thank you man!!