0

This is my opening a new question after having one of my questions marked as a duplicate (Unicode characters in the Python CLI). If you came from my previous question, after reading everything at this link: Python, Unicode, and the Windows console :my question is still unanswered. I don't need a command line script, I think. The chosen answer at that link isn't suited for my problem, nor did I find anything pertaining to my problem in the other answers. The other answers contained information I would find useful if I were trying to enable unicode characters on the command line on my own computer.

I am trying to learn as much about coding as I possibly can. So I wrote a few small programs, and wanted to allow my mother to use them on her computer, which does not have Python, of course. So in order to do that, I have been using the cx_Freeze module to make it to where these little programs of mine will work on her computer, with her having nothing to do but extract a .rar and move the shortcut to her desktop.

This is what the programs look like when the .exe's are run.

enter image description here

This is the loop I am using containing the instructions for what to do if help is asked for.

valid_help_string_list = ['\'help\'',
                          '\'HELP\'',
                            'help',
                            'HELP',
                           '"help"',
                           '"HELP"']
while True:
    weight_entry = input('Please enter your weight or type \'help\' for the pictogram legend.\nPlease round decimal numbers to the nearest tenth: ')
    if weight_entry in valid_help_string_list:
        print('\nLegend:\n□ = 10 lbs\n▪ =  5 lbs\n▫ =  1 lb\n∙ = .1 lbs\n')
    else:
        weight_entry = validate_entry(weight_entry)
        if weight_entry:
            break

This is what it should look like when anything in the help list is input.

enter image description here

This is what I am getting. Whenever anything in valid_help_string_list is typed, the program crashes because of the unicode characters.

enter image description here

Is there any actual Python code that can handle something like this? I want to be able to make this happen on other people's computers locally during runtime (the change to the encoding of the command line, if that's what needs to happen).

Community
  • 1
  • 1
Ryan Prince
  • 27
  • 2
  • 7
  • Can you do something useful besides link me to an outdated question with answers that don't apply to my problem? I read that entire page and all the links on it, and didn't learn anything related to exactly what I intend to do. – Ryan Prince Jan 24 '14 at 09:47
  • Then *tell us what you don't understand* from that information. – Martijn Pieters Jan 24 '14 at 09:52
  • The problem is entirely with your console. Python detects what codec your console supports, and it cannot print the characters you are trying to print. – Martijn Pieters Jan 24 '14 at 09:52
  • I understand that much. I was just wondering if there was any way to make the encoding on another persons console change just for the duration of the program, in actual Python code, so that if someone types help, the console will be able to understand, print the legend, and not crash. I understand everything I found on that page, it all makes sense, I just don't think I can change a file on someone else's computer without them getting upset, or just type in a console command to change the encoding when it's not directly on my computer. – Ryan Prince Jan 24 '14 at 09:59
  • No, there is not. You *can* change the output encoding to replace anything you cannot print with a question mark, but that's hardly what you want here, I think. – Martijn Pieters Jan 24 '14 at 10:00
  • Thank you. Sorry if I came off poorly. I was just frustrated. – Ryan Prince Jan 24 '14 at 10:05

0 Answers0