Page 1 of 2

Removal of print?

Posted: Sat Oct 01, 2016 11:38 pm
by decompile
Hey Guys,

After todays Developement Status update, I updated to the latest built on oct 1st and fixed my plugins to the fixes and adjustments.

Weirdly I noticed that print is not working at all. I tested it with a new plugin and just inserted

Syntax: Select all

print("hello")


which should write hello, but it didnt.

I used a version from 14th september and it worked fine before.

EDIT: https://github.com/Source-Python-Dev-Te ... issues/151

Sorry for net checking github earlier

Re: Removal of print?

Posted: Sun Oct 02, 2016 12:14 am
by satoon101
I noticed this behavior yesterday when I compiled TF2 locally and could not use print. I mentioned it to Ayuto, which is why he started that issue. That was the first time I had seen that happen when using a dedicated server. It has always been the case when using "Create Server" or on single player games. I even checked, and CS:S, at the time still worked fine. However, today, I compiled CS:S locally, and noticed the same issue. The plan is still to change stdout to call the 'echo' server command (ie utilize echo_console), but I would like to figure out what happened to cause print to just stop working.

Re: Removal of print?

Posted: Wed Nov 02, 2016 4:40 pm
by decompile
Sorry for bumping older threads, but will print come back or do we need to use console_message now?

Re: Removal of print?

Posted: Thu Nov 03, 2016 6:45 am
by L'In20Cible
https://github.com/Source-Python-Dev-Te ... issues/151

However, print works just fine on my side.

Syntax: Select all

# ../testing/testing.py

print('Hello!')

testing.PNG
testing.PNG (3.17 KiB) Viewed 11225 times

Re: Removal of print?

Posted: Thu Nov 03, 2016 2:11 pm
by decompile
Really weird, tried it on CS:S/Win10 and nothing gets printed into the console. Updated to the latest version.

Re: Removal of print?

Posted: Thu Nov 03, 2016 2:36 pm
by L'In20Cible
Do you run Python on the same machine as the server you tested on? If so, what version?

Re: Removal of print?

Posted: Thu Nov 03, 2016 3:42 pm
by decompile
No, I dont.

(Im running the CS:S Server via SteamCMD, Its NO LAN server)

Re: Removal of print?

Posted: Thu Nov 03, 2016 3:56 pm
by L'In20Cible
What is your launch cmdline?

Re: Removal of print?

Posted: Thu Nov 03, 2016 5:57 pm
by decompile

Code: Select all

E:\GameServer\css\srcds.exe -game cstrike -console +map de_dust2 +sv_lan 0 -port 27015 -tickrate 100

Re: Removal of print?

Posted: Thu Nov 03, 2016 6:45 pm
by L'In20Cible
Still work for me, running out of ideas...

Re: Removal of print?

Posted: Thu Nov 03, 2016 6:53 pm
by L'In20Cible
What is the output you get using the following?

Syntax: Select all

import sys
from core import console_message

console_message(str(sys.stdout))
for x in dir(sys.stdout):
console_message(x + ' = ' + str(getattr(sys.stdout, x)) + '\n')

Re: Removal of print?

Posted: Thu Nov 03, 2016 6:54 pm
by Kill
L'In20Cible wrote:What is the output you get using the following?

Syntax: Select all

import sys
from core import console_message

console_message(str(sys.stdout))
for x in dir(sys.stdout):
console_message(x + ' = ' + str(getattr(sys.stdout, x)) + '\n')

It never worked for me on Windows 10 and CSS.

Re: Removal of print?

Posted: Thu Nov 03, 2016 7:09 pm
by L'In20Cible
My point here is that it work fine for me on same config: Windows 10 and CS:S.

Re: Removal of print?

Posted: Thu Nov 03, 2016 7:17 pm
by iPlayer
Works for me on CS:S SRCDS and Windows 7. For reference,

Code: Select all

<_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp866'>_CHUNK_SIZE = 8192
__class__ = <class '_io.TextIOWrapper'>
__del__ = <method-wrapper '__del__' of _io.TextIOWrapper object at 0x006195B0>
__delattr__ = <method-wrapper '__delattr__' of _io.TextIOWrapper object at 0x006195B0>
__dict__ = {'mode': 'w'}
__dir__ = <built-in method __dir__ of _io.TextIOWrapper object at 0x006195B0>
__doc__ = Character and line based layer over a BufferedIOBase object, buffer.

encoding gives the name of the encoding that the stream will be
decoded or encoded with. It defaults to locale.getpreferredencoding(False).

errors determines the strictness of encoding and decoding (see
help(codecs.Codec) or the documentation for codecs.register) and
defaults to "strict".

newline controls how line endings are handled. It can be None, '',
'\n', '\r', and '\r\n'.  It works as follows:

* On input, if newline is None, universal newlines mode is
  enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
  these are translated into '\n' before being returned to the
  caller. If it is '', universal newline mode is enabled, but line
  endings are returned to the caller untranslated. If it has any of
  the other legal values, input lines are only terminated by the given
  string, and the line ending is returned to the caller untranslated.

* On output, if newline is None, any '\n' characters written are
  translated to the system default line separator, os.linesep. If
  newline is '' or '\n', no translation takes place. If newline is any
  of the other legal values, any '\n' characters written are translated
  to the given string.

If line_buffering is True, a call to flush is implied when a call to
write contains a newline character.
__enter__ = <built-in method __enter__ of _io.TextIOWrapper object at 0x006195B0>
__eq__ = <method-wrapper '__eq__' of _io.TextIOWrapper object at 0x006195B0>
__exit__ = <built-in method __exit__ of _io.TextIOWrapper object at 0x006195B0>
__format__ = <built-in method __format__ of _io.TextIOWrapper object at 0x006195B0>
__ge__ = <method-wrapper '__ge__' of _io.TextIOWrapper object at 0x006195B0>
__getattribute__ = <method-wrapper '__getattribute__' of _io.TextIOWrapper object at 0x006195B0>
__getstate__ = <built-in method __getstate__ of _io.TextIOWrapper object at 0x006195B0>
__gt__ = <method-wrapper '__gt__' of _io.TextIOWrapper object at 0x006195B0>
__hash__ = <method-wrapper '__hash__' of _io.TextIOWrapper object at 0x006195B0>
__init__ = <method-wrapper '__init__' of _io.TextIOWrapper object at 0x006195B0>
__iter__ = <method-wrapper '__iter__' of _io.TextIOWrapper object at 0x006195B0>
__le__ = <method-wrapper '__le__' of _io.TextIOWrapper object at 0x006195B0>
__lt__ = <method-wrapper '__lt__' of _io.TextIOWrapper object at 0x006195B0>
__ne__ = <method-wrapper '__ne__' of _io.TextIOWrapper object at 0x006195B0>
__new__ = <built-in method __new__ of type object at 0x5FA32688>
__next__ = <method-wrapper '__next__' of _io.TextIOWrapper object at 0x006195B0>
__reduce__ = <built-in method __reduce__ of _io.TextIOWrapper object at 0x006195B0>
__reduce_ex__ = <built-in method __reduce_ex__ of _io.TextIOWrapper object at 0x006195B0>
__repr__ = <method-wrapper '__repr__' of _io.TextIOWrapper object at 0x006195B0>
__setattr__ = <method-wrapper '__setattr__' of _io.TextIOWrapper object at 0x006195B0>
__sizeof__ = <built-in method __sizeof__ of _io.TextIOWrapper object at 0x006195B0>
__str__ = <method-wrapper '__str__' of _io.TextIOWrapper object at 0x006195B0>
__subclasshook__ = <built-in method __subclasshook__ of type object at 0x5FA32688>
_checkClosed = <built-in method _checkClosed of _io.TextIOWrapper object at 0x006195B0>
_checkReadable = <built-in method _checkReadable of _io.TextIOWrapper object at 0x006195B0>
_checkSeekable = <built-in method _checkSeekable of _io.TextIOWrapper object at 0x006195B0>
_checkWritable = <built-in method _checkWritable of _io.TextIOWrapper object at 0x006195B0>
_finalizing = False
buffer = <_io.BufferedWriter name='<stdout>'>
close = <built-in method close of _io.TextIOWrapper object at 0x006195B0>
closed = False
detach = <built-in method detach of _io.TextIOWrapper object at 0x006195B0>
encoding = cp866
errors = surrogateescape
fileno = <built-in method fileno of _io.TextIOWrapper object at 0x006195B0>
flush = <built-in method flush of _io.TextIOWrapper object at 0x006195B0>
isatty = <built-in method isatty of _io.TextIOWrapper object at 0x006195B0>
line_buffering = True
mode = w
name = <stdout>
newlines = None
read = <built-in method read of _io.TextIOWrapper object at 0x006195B0>
readable = <built-in method readable of _io.TextIOWrapper object at 0x006195B0>
readline = <built-in method readline of _io.TextIOWrapper object at 0x006195B0>
readlines = <built-in method readlines of _io.TextIOWrapper object at 0x006195B0>
seek = <built-in method seek of _io.TextIOWrapper object at 0x006195B0>
seekable = <built-in method seekable of _io.TextIOWrapper object at 0x006195B0>
tell = <built-in method tell of _io.TextIOWrapper object at 0x006195B0>
truncate = <built-in method truncate of _io.TextIOWrapper object at 0x006195B0>
writable = <built-in method writable of _io.TextIOWrapper object at 0x006195B0>
write = <built-in method write of _io.TextIOWrapper object at 0x006195B0>
writelines = <built-in method writelines of _io.TextIOWrapper object at 0x006195B0>


Might be flushing problem?

Re: Removal of print?

Posted: Thu Nov 03, 2016 7:23 pm
by iPlayer
Update: just tested

Syntax: Select all

print("Hey there", end='')

and it didn't print anything.

Doing

Syntax: Select all

print("Hey there2")

after that printed
Hey thereHey there2

Maybe their sys.stdout.line_buffering attribute is set to False?

Re: Removal of print?

Posted: Thu Nov 03, 2016 8:34 pm
by L'In20Cible
We will know more once they replied with result of the code above

Re: Removal of print?

Posted: Thu Nov 03, 2016 10:27 pm
by decompile

Code: Select all

sp plugin load test
[SP] Loading plugin 'test'...
None__bool__ = <method-wrapper '__bool__' of NoneType object at 0x1E076998>
__class__ = <class 'NoneType'>
__delattr__ = <method-wrapper '__delattr__' of NoneType object at 0x1E076998>
__dir__ = <built-in method __dir__ of NoneType object at 0x1E076998>
__doc__ = None
__eq__ = <method-wrapper '__eq__' of NoneType object at 0x1E076998>
__format__ = <built-in method __format__ of NoneType object at 0x1E076998>
__ge__ = <method-wrapper '__ge__' of NoneType object at 0x1E076998>
__getattribute__ = <method-wrapper '__getattribute__' of NoneType object at 0x1E076998>
__gt__ = <method-wrapper '__gt__' of NoneType object at 0x1E076998>
__hash__ = <method-wrapper '__hash__' of NoneType object at 0x1E076998>
__init__ = <method-wrapper '__init__' of NoneType object at 0x1E076998>
__le__ = <method-wrapper '__le__' of NoneType object at 0x1E076998>
__lt__ = <method-wrapper '__lt__' of NoneType object at 0x1E076998>
__ne__ = <method-wrapper '__ne__' of NoneType object at 0x1E076998>
__new__ = <built-in method __new__ of type object at 0x1E076A88>
__reduce__ = <built-in method __reduce__ of NoneType object at 0x1E076998>
__reduce_ex__ = <built-in method __reduce_ex__ of NoneType object at 0x1E076998>
__repr__ = <method-wrapper '__repr__' of NoneType object at 0x1E076998>
__setattr__ = <method-wrapper '__setattr__' of NoneType object at 0x1E076998>
__sizeof__ = <built-in method __sizeof__ of NoneType object at 0x1E076998>
__str__ = <method-wrapper '__str__' of NoneType object at 0x1E076998>
__subclasshook__ = <built-in method __subclasshook__ of type object at 0x1E076A88>
[SP] Successfully loaded plugin 'test'.


Tested it with:

Syntax: Select all

#plugins/test/test.py
print("Hello")


Code: Select all

sp plugin load test
[SP] Loading plugin 'test'...
[SP] Successfully loaded plugin 'test'.

Re: Removal of print?

Posted: Fri Nov 04, 2016 6:59 am
by L'In20Cible
Your stdout is None, normal it doesn't write anything... I have no idea how this can happens...

Re: Removal of print?

Posted: Fri Nov 04, 2016 12:27 pm
by decompile
All I can say is when I updated to the version before this thread has been created, It worked. Just out of nowhere it didnt work..

Re: Removal of print?

Posted: Fri Nov 04, 2016 12:28 pm
by L'In20Cible
And what version are you currently running?