Discussion Feed
11-06-2018
02:58 AM
This is a simplified version of my script:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
wait = WebDriverWait(driver, 20)
driver.get(https://www.google.com")
assert "Page title – with strange hyphen" in driver.title
driver.quit
... View more
11-05-2018
07:14 AM
I have a synthetic script running on App Dynamics which asserts that the title of the page contains the non-Ascii character 'EN DASH'. The script runs fine on App Dynamics, but when I copy the script locally Python attempts to decode the character using Ascii and throws the following error:
SyntaxError: Non-ASCII character '\xe2' in file my-script.py on line 24, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
I've tried forcing Python to use UTF-8 encoding by including the following at the top of the script:
# coding=utf-8
...but I then see the following error.
File "scripts/halo-privacy-center.py", line 25, in <module>
assert "Tesco – Privacy Centre" in driver.title
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6: ordinal not in range(128)
Where can I find information on how the environment for Python is configured for App Dynamics so I can replicate that locally? Or in other words, how can I force Python to decode characters in the same way it does in App Dynamics?
... View more
Latest Activity
- Posted Re: Character encoding for synthetic Python scripts on Dynamic Languages (Node.JS, Python, PHP, C/C++, Webserver Agent). 11-06-2018 02:58 AM
- Posted Re: Character encoding for synthetic Python scripts on Dynamic Languages (Node.JS, Python, PHP, C/C++, Webserver Agent). 11-06-2018 01:59 AM
- Posted Character encoding for synthetic Python scripts on Dynamic Languages (Node.JS, Python, PHP, C/C++, Webserver Agent). 11-05-2018 07:14 AM
Community Stats
Date Registered | 11-05-2018 07:02 AM |
Date Last Visited | 06-26-2019 08:14 AM |
Total Messages Posted | 4 |