Linked Questions

326 votes
7 answers
469k views

"SyntaxError: Non-ASCII character ..." or "SyntaxError: Non-UTF-8 code starting with ..." trying to use non-ASCII text in a Python script

I tried this code in Python 2: def NewFunction(): return '£' But I get an error message that says: SyntaxError: Non-ASCII character '\xa3' in file '...' but no encoding declared; see http://www....
SNIFFER_dog's user avatar
  • 3,313
452 votes
17 answers
378k views

How do I grep for all non-ASCII characters?

I have several very large XML files and I'm trying to find the lines that contain non-ASCII characters. I've tried the following: grep -e "[\x{00FF}-\x{FFFF}]" file.xml But this returns ...
pconrey's user avatar
  • 6,103
40 votes
5 answers
48k views

Remove non-ASCII characters in a file [duplicate]

How do I remove non-ASCII characters from a file?
janar's user avatar
  • 713
33 votes
5 answers
26k views

Approximately converting unicode string to ascii string in python

don't know wether this is trivial or not, but I'd need to convert an unicode string to ascii string, and I wouldn't like to have all those escape chars around. I mean, is it possible to have an "...
Marco Moschettini's user avatar
2 votes
3 answers
5k views

Regex for prices with euros pounds and dollars

I am using python regex to find all prices in a string. Thus far I am only having trouble managing the symbols correctly. This code, with the input: 'happy$37.54000happy$34$3454$3333€27.80€3.00.33.2£...
Rorschach's user avatar
  • 3,812
3 votes
1 answer
8k views

Conda install: Packages missing in current channels

I think something has gone wrong with my Conda. I am trying to install the package 'coding' and I get the following error: (but also other packages like tarfile I get a similar message like below). ...
Trgovec's user avatar
  • 575
2 votes
3 answers
3k views

Add count objects in Django Rest Framework Viewset

I have a question with adding Count Objects in Django Rest Framework Viewset: This is my curren API: [ { "id": 1, "created": "2017-12-25T10:29:13.055000Z" }, { "id"...
KitKit's user avatar
  • 9,653
2 votes
2 answers
4k views

Python - Using Qt5 to build a simple web browser

I was trying to build this example: https://www.linuxvoice.com/build-a-web-browser-with-20-lines-of-python/ I'll just repost it here for completeness: from PyQt5.QtCore import QUrl from PyQt5....
Qubix's user avatar
  • 4,373
3 votes
2 answers
4k views

Meld not launching in Ubuntu

I just installed meld in Ubuntu 20.04. Upon trying to launch meld, I got the following error message: Traceback (most recent call last): File "/usr/bin/meld", line 79, in <module> ...
SKPS's user avatar
  • 5,858
0 votes
1 answer
3k views

python syntax error : non-ascii character [duplicate]

Hi I'm trying understand why I'm getting this error. when I deploy my project on google appengine, getting error like below SyntaxError: Non-ASCII character '\xea' in file /base/data/home/apps/s~...
user3917240's user avatar
0 votes
2 answers
4k views

Remove column names from spark dataframe while storing it as textfile

My dataframe output is as below, DF.show(2) +--------------+ |col1|col2|col3| +--------------+ | 10| 20| 30| | 11| 21| 31| +--------------+ after saving it as textfile - DF.rdd....
user491's user avatar
  • 175
0 votes
1 answer
639 views

I'm getting"Invalid syntax" on an 'if' query

That is my code: filename = raw_input('Filename? --> ') ‪if filename != 'q':‬ ‪ my_socket.send(filename)‬ ‪ data = my_socket.recv(1024)‬ when I run - I get this: File "temp.py", line 51 ‪ ...
Yair Haber's user avatar
1 vote
2 answers
693 views

Usage of proxy server in a perl script

I have tried to add a proxy server to the following perl script: #!/usr/bin/perl TO='list of email adresses here'; require "/usr/local/SCRIPTS/www-tools/service-name/jcode.pl"; use LWP::UserAgent; $...
i716's user avatar
  • 67
0 votes
2 answers
539 views

Python Selenium find_elements_by_class_name Error

I am scraping a google page that has returned links to Linkedin profiles. I want to collect the links on a page and put them in a python list. Problem is I can't seem to properly extract them from ...
Windstorm1981's user avatar
-1 votes
1 answer
660 views

VIM with youcomplete me

I've been coding for a while and moving from IDE to IDE is a real pain when what I need most is just ctag and code completion. I finally decided to go to vim, well neovim in this case but that's ...
user1610950's user avatar
  • 1,927

15 30 50 per page