1

I am trying to use sqlite3 in a gui (Tkinter) here, and when I try to compile the code using geany, its return this error

File "/home/armando/Documents/curso/python_projects/sqlite3.py", line 3
SyntaxError: Non-ASCII character '\xc3' in file /home/armando/Documents/curso/python_projects/sqlite3.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

How I can solve this?

Thanks

Light and peace!

1
  • 1
    It will be better if you add your code's problematic part by editing your question. Commented Apr 21, 2014 at 15:49

1 Answer 1

1

See pep 263 - http://legacy.python.org/dev/peps/pep-0263/

You have to declare your encoding at the top of your source module:

#!/usr/bin/python
# -*- coding: utf-8 -*-

Replace utf-8 with whatever encoding you've saved the file with.

Sign up to request clarification or add additional context in comments.

5 Comments

hi @jaime, I solved this problem I simple change the order of my import evocation before was "from Tkinter import * import sqlite3" then I put the "import sqlite3" in the first line and its compile properlly thank you!
Glad you worked that out! It's strange that reordering the imports fixed it. Take care!
why? what can happen?
It means that one module is affecting the other. If that particular module ever changes in such a way that it no longer fixes your problem, then you don't know why / what happened.
I have reinstaled the sqlite and sqlite-devel before, but when I change the import order the problem desapear and before this, it dont occur more, so I dont know how the problem get right, so if this occur, how I can solve this? thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.