Removal of print?

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Removal of print?

Postby decompile » Sat Oct 01, 2016 11:38 pm

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Removal of print?

Postby satoon101 » Sun Oct 02, 2016 12:14 am

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.
Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Wed Nov 02, 2016 4:40 pm

Sorry for bumping older threads, but will print come back or do we need to use console_message now?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 6:45 am

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 11119 times
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Thu Nov 03, 2016 2:11 pm

Really weird, tried it on CS:S/Win10 and nothing gets printed into the console. Updated to the latest version.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 2:36 pm

Do you run Python on the same machine as the server you tested on? If so, what version?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Thu Nov 03, 2016 3:42 pm

No, I dont.

(Im running the CS:S Server via SteamCMD, Its NO LAN server)
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 3:56 pm

What is your launch cmdline?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Thu Nov 03, 2016 5:57 pm

Code: Select all

E:\GameServer\css\srcds.exe -game cstrike -console +map de_dust2 +sv_lan 0 -port 27015 -tickrate 100
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 6:45 pm

Still work for me, running out of ideas...
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 6:53 pm

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')
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: Removal of print?

Postby Kill » Thu Nov 03, 2016 6:54 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 7:09 pm

My point here is that it work fine for me on same config: Windows 10 and CS:S.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Removal of print?

Postby iPlayer » Thu Nov 03, 2016 7:17 pm

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?
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Removal of print?

Postby iPlayer » Thu Nov 03, 2016 7:23 pm

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?
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Thu Nov 03, 2016 8:34 pm

We will know more once they replied with result of the code above
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Thu Nov 03, 2016 10:27 pm

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'.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Fri Nov 04, 2016 6:59 am

Your stdout is None, normal it doesn't write anything... I have no idea how this can happens...
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Removal of print?

Postby decompile » Fri Nov 04, 2016 12:27 pm

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..
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Removal of print?

Postby L'In20Cible » Fri Nov 04, 2016 12:28 pm

And what version are you currently running?

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 25 guests