Python Forum
I'm afraid it is a question of copyright
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm afraid it is a question of copyright
#9
(Sep-22-2017, 12:54 PM)metulburr Wrote: Does PyCharm require this?

No it is not required by pycharm. Pycharm does have an option as to what type of encoding you want to use to 'save' and 'read' a file.

@Larz60+
Quote:as the very first line of your code

I'm taking a guess that sylas is using Linux, in which case, his first line should be the 'shebang' line followed by the 'encoding' line.

To be honest, with all the changes Python has made (including those for Windows) with utf-8, I'm not sure that line is even useful anymore. I'd have to check the latest docs.

I'll be honest, I have not read the code, but I presume a change has been made to one of the files either in directory 'pong' or directory 'ping'.

EDIT: O.K., since Python 3.0 +, the default is UTF-8, so line is only required if you wish to deviate from that. Version 2.x still requires it.

From 3.6.2 docs
Quote:You can use a different encoding from UTF-8 by putting a specially-formatted comment as the first or second line of the source code:

# -*- coding: <encoding name> -*-

From the 2.7 doc:
Quote:If you don’t include such a comment, the default encoding used will be ASCII. Versions of Python before 2.4 were Euro-centric and assumed Latin-1 as a default encoding for string literals; in Python 2.4, characters greater than 127 still work but result in a warning. Version 2.5 and higher result in a Syntax error.

Apologies Larz, depending on the Python version Sylas is running, it may just indeed be required.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
I'm afraid it is a question of copyright - by sylas - Sep-22-2017, 06:52 AM
RE: I'm afraid it is a question of copyright - by sparkz_alot - Sep-22-2017, 01:13 PM

Forum Jump:

User Panel Messages

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