Re: Funny code

2019-09-26 Thread Christian Gollwitzer
Am 26.09.19 um 08:34 schrieb ast: Hello A line of code which produce itself when executed >>> s='s=%r;print(s%%s)';print(s%s) s='s=%r;print(s%%s)';print(s%s) Thats funny ! This is called a "quine" and there exist several methods how to do this. https://en.wikipedia.org/wiki/Quine_(computin

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-26 Thread Spencer Du
Hi How do I publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value. Thanks # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'laser.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this fi

NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
I have some sample/demo python code for scrolling and outputting text onto a 16x2 lcd display. I would like to put my own message or text outputting to the lcd on 2 lines. I have tried using lcd.message('my message',1) and lcd.message('my message', 2), but the output says: TypeError: message

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread DL Neil via Python-list
On 26/09/19 9:14 PM, RobH wrote: I have some sample/demo python code for scrolling and outputting text onto a 16x2 lcd display. I would like to put my own message or text outputting to the lcd on 2 lines. I have tried using lcd.message('my message',1) and lcd.message('my message', 2), but the

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
On 26/09/2019 11:08, DL Neil wrote: On 26/09/19 9:14 PM, RobH wrote: I have some sample/demo python code for scrolling and outputting text onto a 16x2 lcd display. I would like to put my own message or text outputting to the lcd on 2 lines. I have tried using lcd.message('my message',1) and

Re: Funny code

2019-09-26 Thread Albert-Jan Roskam
On 26 Sep 2019 10:28, Christian Gollwitzer wrote: Am 26.09.19 um 08:34 schrieb ast: > Hello > > A line of code which produce itself when executed > > >>> s='s=%r;print(s%%s)';print(s%s) > s='s=%r;print(s%%s)';print(s%s) > > Thats funny ! ==> Also impressive, a 128-language quine: https://git

__init__ is not invoked

2019-09-26 Thread ast
Hello In the following code found here: https://www.pythonsheets.com/notes/python-object.html __init__ is not invoked when we create an object with "o = ClassB("Hello")". I don't understand why. I know the correct way to define __new__ is to write "return object.__new__(cls, arg)" and not "retur

Re: __init__ is not invoked

2019-09-26 Thread Rhodri James
On 26/09/2019 13:20, ast wrote: Hello In the following code found here: https://www.pythonsheets.com/notes/python-object.html __init__ is not invoked when we create an object with "o = ClassB("Hello")". I don't understand why. I know the correct way to define __new__ is to write "return object.

Re: __init__ is not invoked

2019-09-26 Thread ast
Le 26/09/2019 à 14:20, ast a écrit : Hello In the following code found here: https://www.pythonsheets.com/notes/python-object.html __init__ is not invoked when we create an object with "o = ClassB("Hello")". I don't understand why. I know the correct way to define __new__ is to write "return ob

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread Rhodri James
On 26/09/2019 11:58, RobH wrote: Thanks, but was is Python REPR. DL was referring to the interactive program you get when you type "python" at a Linux or Windows command prompt. Here's an example, copied from my Linux box: rhodri@scrote:~$ python Python 2.7.15+ (default, Jul 9 2019, 16:51

Re: __init__ is not invoked

2019-09-26 Thread Peter Otten
ast wrote: > Hello > > In the following code found here: > https://www.pythonsheets.com/notes/python-object.html > > __init__ is not invoked when we create an object > with "o = ClassB("Hello")". I don't understand why. > I know the correct way to define __new__ is to write > "return object.__ne

PIP question

2019-09-26 Thread Gisle Vanem
Hello list. This little program should print the location of all my installed Python packages: -- 8< -- 8< --- import pip try: packages = pip.get_installed_distributions (local_only=False, skip=()) except AttributeError: import pkg_resources # Python3 packages = pkg_

Pysmnp : setCmd doesn't modify the object value

2019-09-26 Thread cdoare.ext
Hello, I tried to set a value from setCmd. Execution doesn't return any error but the snmp request is not sent ! g = setCmd(SnmpEngine() , CommunityData('public', mpModel=1) , UdpTransportTarget(('x.x.x.x', 161)) , ContextData() , ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.7.364904448'), int('1'

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread Chris Angelico
On Thu, Sep 26, 2019 at 9:01 PM RobH wrote: > > import Adafruit_CharLCD as LCD > > > # Raspberry Pi pin configuration: Ah, it's an RPi with Adafruit. That's the same library that my brother uses. I don't know much of the details, but in case it's helpful, here's the code that currently runs his s

Re: __init__ is not invoked

2019-09-26 Thread Oscar Benjamin
On Thu, 26 Sep 2019 at 14:19, Peter Otten <__pete...@web.de> wrote: > > __init__ is called only if __new__ returns an instance of ClassB: > > """ > /* If the returned object is not an instance of type, >it won't be initialized. */ > if (!PyType_IsSubtype(Py_TYPE(obj), type)) >

Re: __init__ is not invoked

2019-09-26 Thread Oscar Benjamin
On Thu, 26 Sep 2019 at 13:39, Rhodri James wrote: > > On 26/09/2019 13:20, ast wrote: > > > > >>> class ClassB(object): > > ... def __new__(cls, arg): > > ... print('__new__ ' + arg) > > ... return object > > ... def __init__(self, arg): > > ... print('__init__ ' +

Re: __init__ is not invoked

2019-09-26 Thread Rhodri James
On 26/09/2019 15:35, Oscar Benjamin wrote: On Thu, 26 Sep 2019 at 13:39, Rhodri James wrote: You have returned the class object, not an instance of anything, Well object is an instance of object as well as of type: Fair point. I keep forgetting that. -- Rhodri James *-* Kynesim Ltd -- http

Re: __init__ is not invoked

2019-09-26 Thread ast
Le 26/09/2019 à 15:17, Peter Otten a écrit : ast wrote: __init__ is called only if __new__ returns an instance of ClassB: I was ignoring that. thank you -- https://mail.python.org/mailman/listinfo/python-list

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
On 26/09/2019 12:55, Rhodri James wrote: On 26/09/2019 11:58, RobH wrote: Thanks, but was is Python REPR. DL was referring to the interactive program you get when you type "python" at a Linux or Windows command prompt.  Here's an example, copied from my Linux box: rhodri@scrote:~$ python P

Re: CSV reader ignore brackets

2019-09-26 Thread Piet van Oostrum
Skip Montanaro writes: > How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's > line reading method? (I think I have the re syntax approximately right.) > The csv reader will "just work". Again, nesting parens not allowed. > > Skip here is some working code: def PReader(csvfi

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
On 26/09/2019 15:22, Chris Angelico wrote: On Thu, Sep 26, 2019 at 9:01 PM RobH wrote: import Adafruit_CharLCD as LCD # Raspberry Pi pin configuration: Ah, it's an RPi with Adafruit. That's the same library that my brother uses. I don't know much of the details, but in case it's helpful, h

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
On 26/09/2019 17:51, Dennis Lee Bieber wrote: On Thu, 26 Sep 2019 11:58:15 +0100, RobH declaimed the following: import Adafruit_CharLCD as LCD FYI: from Adafruit's download site: https://github.com/adafruit/Adafruit_Python_CharLCD """ DEPRECATED LIBRARY. Adafruit Python CharLCD T

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread RobH
On 26/09/2019 20:21, RobH wrote: On 26/09/2019 17:51, Dennis Lee Bieber wrote: On Thu, 26 Sep 2019 11:58:15 +0100, RobH declaimed the following: import Adafruit_CharLCD as LCD FYI: from Adafruit's download site: https://github.com/adafruit/Adafruit_Python_CharLCD """ DEPRECATED LIBR

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread DL Neil via Python-list
On 27/09/19 7:21 AM, RobH wrote: On 26/09/2019 17:51, Dennis Lee Bieber wrote: On Thu, 26 Sep 2019 11:58:15 +0100, RobH declaimed the following: ... Check out this guide for info on using character LCDs with the CircuitPython library: https://learn.adafruit.com/character-lcds/python-circuit

NameError: name 'msvcrt' is not defined

2019-09-26 Thread Hongyi Zhao
Hi, I use python on Debian, when running some python codes, I meet the following error: --- input_username.py", line 18, in read_input if msvcrt.kbhit(): NameError: name 'msvcrt' is not defined How to solve this issue? -- https://mail.python.org/mailman/listinfo/pyt

Re: NameError: name 'msvcrt' is not defined

2019-09-26 Thread MRAB
On 2019-09-27 03:14, Hongyi Zhao wrote: Hi, I use python on Debian, when running some python codes, I meet the following error: --- input_username.py", line 18, in read_input if msvcrt.kbhit(): NameError: name 'msvcrt' is not defined How to solve this issue? That

Re: PIP question

2019-09-26 Thread dieter
Gisle Vanem writes: > ... pip list ... > But for my Python 3.6 installation, it claims I have > an '-ip' package: > -ip-> f:\programfiler\python36\lib\site-packages > > I fail to find one, but I do have a: > f:\programfiler\python36\lib\site-packages\~ip-19.1.1.dist-info > > directory wi