Python Forum
Letters with Accents Not Inputting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Letters with Accents Not Inputting
#1
LETTERS WITH ACCENTS NOT INPUTTING

How do I let the user input at the (Mac) Terminal words with letters with accents?

(As in the related thread "Letters with Accents Not Displaying" this is about Python 2.7.10 code in MacOS 10.14.5. Letters display with accents in both my text file (in TextEdit) of Portuguese words and my (Mac) Terminal, both of which are encoded in Unicode (UTF-8).)

1. The simplest try:

y = input("Your answer: ")
followed by equal comparison with a Unicode list entry results in:

Error:
UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
2. The try:

y = input("Your answer ",encoding="utf-8")
results in:

Error:
TypeError: input() takes no keyword arguments
3. The codecs try (matching the solution in thread "Letters with Accents Not Displaying"):

input codecs
y = codecs.input("Your answer ",encoding="utf-8")
results in:

Error:
AttributeError: 'module' object has no attribute 'input'
4. In Python 2 there is another input method raw_input. It fails in the same ways, for example:

input codecs
y = codecs.raw_input("Your answer ",encoding="utf-8")
results in:

Error:
AttributeError: 'module' object has no attribute 'input'
Can anyone point me in the direction of how to let the user input at a (Mac) Terminal words with letters with accents please?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Windows] Fails reading strings with accents Winfried 1 824 Apr-23-2023, 05:27 PM
Last Post: Larz60+
  Unable to understand how given code takes a fixed input value, without inputting. jahuja73 4 2,694 Jan-28-2021, 05:22 PM
Last Post: snippsat
  Argparse error when inputting values tqader 2 2,874 Sep-11-2020, 07:42 PM
Last Post: buran
  Letters with Accents Not Displaying Phylus 5 5,513 Jun-12-2019, 05:43 AM
Last Post: Phylus
  Inputting a varible BlathaBlather 3 3,579 Apr-05-2017, 08:09 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020