[issue46574] itertools.count should work with non-number types
New submission from Mital Ashok : There's no reason that `count('', 'a')` for `'', 'a', 'aa', ...` or `count((), (1,))` for `(), (1,), (1, 1), ...` shouldn't work. count(a, b) should be equivalent to accumulate(chain((a,), repeat(b))) The docs don't strongly suggest that it won't work (it says *start* is a number, but the "roughly equivalent to" generator would work for str/tuple/etc) -- components: Library (Lib) messages: 412095 nosy: Mital Ashok priority: normal severity: normal status: open title: itertools.count should work with non-number types type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue46574> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: zpifile.py error - no crc 32 attribute
Test this in the interpreter:- import zlib zlib.__file__ It will return the location of zlib module. On 8/22/18, jacob m wrote: > Hi, > " Is there perhaps a different zlib on > your path, hiding the real zlib?" - I'm unsure of that. > > "sudo apt-get install zlib1g-dev > Reading package lists... Done > Building dependency tree > Reading state information... Done > zlib1g-dev is already the newest version. > 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." > Regards > > > On 22 August 2018 at 13:12, jacob m wrote: > >> Hi guys, >> I have a problem with zipfile and zlib module, and hope to get some help. >> >> That's my error: >> "import zipfile >> File "/home/lib/python3.7/lib/python3.7/zipfile.py", line 19, in >> >> crc32 = zlib.crc32 >> AttributeError: module 'zlib' has no attribute 'crc32' " >> >> I have no idea what to do with that :/ I use this version of zipfile: >> https://github.com/python/cpython/blob/3.7/Lib/zipfile.py >> >> Somebody knows how to solve it? >> Regards >> >> > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Changes by Ashok Bakthavathsalam <lifebala...@gmail.com>: -- type: behavior -> enhancement ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: @Storchaka, You say `5` is related to the substring. Pray, explain how 5 is related to a null substring? Also, from https://bugs.python.org/msg243710, as per the great Hettinger: Though this is closed as not a bug, feel free to add an example or a mention in the documentation. Keep it short though. That's all I am asking to be included. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: Look at my suggested changes. It doesn't add noise, IMHO. All I am saying is that the explicit behaviour needs to be documented. I unnecessarily wasted at least 3-4 hours on this "undocumented" behavior. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: How about "abcde"[5] Traceback (most recent call last): File "python", line 1, in IndexError: string index out of range -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: I am not saying that there is a bug. As Martin points out, "it is worth making the documentation explicit." -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Changes by Ashok Bakthavathsalam <lifebala...@gmail.com>: -- keywords: +patch pull_requests: +3637 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: The documentation (https://docs.python.org/3/library/stdtypes.html#str.find) does not describe what will be the behaviour if the substring is "". And by the way, as per https://docs.python.org/3/reference/expressions.html#membership-test-operations, Empty strings are always considered to be a substring of any other string, so "" in "abc" will return True. Returning an invalid index value, although confusing, should at least be documented in some form. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: string.find() also exhibits the same behaviour. "abcde".find("") -> 5 which also is not documented anywhere. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Ashok Bakthavathsalam added the comment: Also, "".rindex("") returns 0 -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
Changes by Ashok Bakthavathsalam <lifebala...@gmail.com>: -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31021] Clarify programming faq.
Ashok Bakthavathsalam added the comment: So, what is the resolution on this? -- nosy: +kgashok ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31021> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31504] Documentation for return value for string.rindex is missing when search string is empty
New submission from Ashok Bakthavathsalam: "abcde".rindex("") returns 5 "a".rindex("") returns 1 This is not documented anywhere in the Python documentation. -- components: Library (Lib) messages: 302418 nosy: kgashok priority: normal severity: normal status: open title: Documentation for return value for string.rindex is missing when search string is empty type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31504> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31021] Clarify programming faq.
Changes by Ashok Bakthavathsalam <lifebala...@gmail.com>: -- pull_requests: +2904 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31021> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30955] \\N in f-string causes next { to be literal if not escaped
New submission from Mital Ashok: Take this format python code: import unicodedata c = chr(0x012345) To print that character as a string literal, you would expect to do: print(f"'\\N{{{unicodedata.name(c)}}}'") Which should print a literal quote (`'`), a backwards slash (`\\` -> `\`), an `N`, and the two `{{` should escape and print `{`, followed by the f-expression `unicodedata.name(c)`, then the `}}` would print one `}`, and then another literal quote (`'`). However, this raises a `SyntaxError: f-string: single '}' is not allowed`. The way to do this without a syntax error is like so: print(f"'\\N{{unicodedata.name(c)}}}'") Which prints the expected: '\N{CUNEIFORM SIGN URU TIMES KI}' The shortest way to reproduce this is: f'\\N{' Which works, and: f'\\N{{' which raises an error, even though the first one should raise an error (`SyntaxError: f-string: expecting '}'`). -- messages: 298563 nosy: Mital Ashok priority: normal severity: normal status: open title: \\N in f-string causes next { to be literal if not escaped versions: Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30955> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24327] yield unpacking
New submission from Mital Ashok: (This is more of a feature request than a bug, but https://www.python.org/dev/peps/pep-0042/ said to post it here) My request is to have syntax like this: yield *iterable to lazily return the iterable's items, not much unlike: # ... for i in iterable: yield i # ... This is because I constantly find myself yielding all the values in, say, a list, then modifying it and yielding it in a loop. -- messages: 244397 nosy: Mital Ashok priority: normal severity: normal status: open title: yield unpacking type: enhancement versions: Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24327 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Regular expression issue
Hi, The following is a sample of my problem. I get input from user and store it in variable 'b'. I want to match the user input with the contents of another variable 'a'. However I m not able to get the exact match. Could someone help? print a c c+ b 'c+' re.search(b,a).group() 'c' In the above example I want re to find the string 'c+' instead of 'c'. I want a solution without escaping the '+' symbol with backslash because it is given by the user. Thanks, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Repost: Read a running process output
Hi, I very badly need this to work. I have been googling out for a week with no significant solution. I open a process p1 which does keeps running for 4+ hours. It gives some output in stdout now and then. I open this process with subprocess.Popen and redirect the stdout to PIPE. However when I read the output with readline it blocks waiting forever. I need to read from p1.stdout till what it has in the PIPE. Can someone help me out with the exact code change that can accomplish the task. from subprocess import * p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True) while 1: line=p1.stdout.readline() print line Thanks in advance, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Re: Repost: Read a running process output
On Feb 5, 5:12 pm, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Ashok Prabhu ashokprab...@gmail.com writes: from subprocess import * p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True) Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell. -- Alain. Hi Alain, Thanks for the response. However it throws an error. Please find below. from subprocess import * p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE) Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/subprocess.py, line 543, in __init__ errread, errwrite) File /usr/lib/python2.4/subprocess.py, line 975, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory Thanks, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Re: Repost: Read a running process output
On Feb 5, 5:58 pm, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Ashok Prabhu ashokprab...@gmail.com writes: p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True) Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell. -- Alain. Thanks for the response. However it throws an error. Please find below. from subprocess import * p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE) You forgot to change the monolithic command into a list of words. Since you don't use the shell anymore you have to give Popen a pre-parsed command line. -- Alain. Here is the error again p1=Popen('/usr/sunvts/bin/64/vtsk','-d',stdout=PIPE) Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/subprocess.py, line 494, in __init__ raise TypeError(bufsize must be an integer) TypeError: bufsize must be an integer ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Re: Repost: Read a running process output
On Feb 5, 6:33 pm, Ashok Prabhu ashokprab...@gmail.com wrote: On Feb 5, 5:58 pm, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Ashok Prabhu ashokprab...@gmail.com writes: p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True) Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell. -- Alain. Thanks for the response. However it throws an error. Please find below. from subprocess import * p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE) You forgot to change the monolithic command into a list of words. Since you don't use the shell anymore you have to give Popen a pre-parsed command line. -- Alain. Here is the error again p1=Popen('/usr/sunvts/bin/64/vtsk','-d',stdout=PIPE) Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/subprocess.py, line 494, in __init__ raise TypeError(bufsize must be an integer) TypeError: bufsize must be an integer ~Ashok. Oops i missed the braces. But still no output. p1=Popen(['/usr/sunvts/bin/64/vtsk','-d'],stdout=PIPE) while 1: ... a=p1.stdout.readline() ... print a ... -- http://mail.python.org/mailman/listinfo/python-list
read a process output with subprocess.Popen
Hi, I m trying a read the output of a process which is running continuously with subprocess.Popen. However the readline() method hangs for the process to finish. Please let me know if the following code can be made to work with subprocess.Popen with threads or queues. I tried a lot of methods but to no avail. It would be great if someone can make it work. import subprocess p1 = subprocess.Popen('tail -f /var/log/ messages',stdout=subprocess.PIPE,shell=True) p2 = subprocess.Popen('grep something',stdin=p1.stdout,stdout=subprocess.PIPE,shell=True) while 1: line = p2.stdout.readline() print line Thanks, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Unable to import package over NFS in solaris
Hi, I have sqlalchemy package installed on the server. However I want to run a script on the client that uses the sqlalchemy package. Hence I shared the directory containing the sqlalchemy unsing NFS. Then I added the NFS pathname to the sqlalchemy packege in the client program. Now when I import sqlalchemy in the client program it throws the following error. Traceback (most recent call last): File /net/sqlhost/ashok/send.py, line 9, in ? from sqlalchemy import * ImportError: No module named sqlalchemy I have added the NFS path to the PYTHONPATH as folllows in my program. #!/usr/bin/python import os,commands,sys os.environ['PYTHONPATH']='/net/sqlhost/usr/lib/python2.4/site-packages/ SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy' sys.path.append('/net/sqlhost/usr/lib/python2.4/site-packages/ SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy') from sqlalchemy import * Contents of the directory shared under NFS in Solaris. bash-3.00# ls /usr/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/ __init__.py engine ext log.py pool.py queue.pycsql topological.pyc util.py __init__.pyc exc.py interfaces.pylog.pyc pool.pyc schema.pytest types.py util.pyc databasesexc.pyc interfaces.pyc orm queue.py schema.pyc topological.py types.pyc Please let me know what went wrong? thx, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list
Re: [HELP] SMTPlib not sending my mail
i checked it after your mail.. it is giving the following warning: no entropy for TLS key generation: disabling TLS support which was addressed here http://www.howtoforge.com/forums/showthread.php?t=781; after adding the line tlsmgr unix - - n 1000? 1 tlsmgr to /etc/postfix/master.cf it started working. Thank you. On 1/29/08, Lars Johansen [EMAIL PROTECTED] wrote: have you checked your mail server logs ? tir, 29.01.2008 kl. 00.24 -0800, skrev ashok.raavi: Hi, I am also facing the same problem, smtplib used to send mail a while back but it stopped sending mails. when i run this in interpreter import smtplib s = smtplib.SMTP(localhost) s.sendmail(from, to, message) {} though it is not giving any error, it is not sending mail. Any help is appreciated. ornto wrote: Hi, I'm trying to create an application which checks a dynamic web site and on certain events sends an email to me. My problem though is with the email task. By now I made this simple test code: #prova invio email smtpserver = smtplib.SMTP(mailserver) messaggio= Messaggio di prova print mail print messaggio smtpresult=smtpserver.sendmail(Watcher,mail,messaggio) if smtpresult: print smtpresult smtpserver.quit() mailserver and mail values are loaded from a ini file and they're correct. The call to smtpserver gives back no errors (smtpresult remains empty). The running enviroment gives no error. So, it looks like that the program works alloright, sending the mail- BUT, I receive no mail! I've tried to change the smtp server with another one which still works with my isp, with no luck. If I try a smtp which doesn't give me access, I correctly receive an error from the program. What might be the problem? -- ashok raavi -- http://mail.python.org/mailman/listinfo/python-list
get message form ie
Hi, Is there any way i can get a message form internet explorer into my python script when internet explorer completes loading a page? _ ashok -- http://mail.python.org/mailman/listinfo/python-list
override PyBitmapDataObject
hi, I am new to python and am trying my experimenting with python and wxpython. I want to use wx.PyBitmapDataObject to get bitmap data form clipboard. The wx documentation says that 'to be able to provide bitmap data on demand, derive from this class and overload GetBitmap'. How do i overload GetBitmap? Thanks in adavance for any help. _ ashok -- http://mail.python.org/mailman/listinfo/python-list
scaling
hi, IDL language contains a function called BYTSCL to scale all values of Array that lie in the range (Min £ x £ Max) into the range (0 £ x £ Top). Is there a similar function available in python? I need this to scale the pixel values of an image using PIL. thanks in advance for any help AGK -- http://mail.python.org/mailman/listinfo/python-list
problem in running python on winnt
hello, I have built a standalone gui application using py2exe which works fine in my WinXp SP2 machine and another WinXp machine. When i try to run it in a Win NT SP6 machine, I get the following error. Traceback (most recent call last): File auto.py, line 4, in ? File zipextimporter.pyo, line 82, in load_module File wx\_init_.pyo, line 45, in? File zipextimporter.pyo, line 82, in load_module File wx\_init_.pyo, line 4, in? File zipextimporter.pyo, line 98, in load_module ImportError : MemoryLoadLibrary failed loading wx\_core_.pyd I use python 2.4.2, wxpython 2.8, py2exe 0.6.6 for development can anybody come up with a solution? thanks in advance AGK -- http://mail.python.org/mailman/listinfo/python-list
python gui using boa
hi, i am trying to develop a small gui app using boa constructor. say this app has one frame which has one static text control. i want the frame to resize itself to the width of the text contrl when i change the label of the text control via SetLabel(). how can i do this in boa constructor? can anybody guide me to a good source for learning the use of sizers in boa? thanks -- http://mail.python.org/mailman/listinfo/python-list
sizers in boa constructors
hi, I am trying to build a small gui program in python using boa constructor. i have a few problems. i would be grateful if anyone can help me in this regard. 1. i have four static text controls positioned one below the other. what i want to do is when i change the content of the upper static text control, the lower ones should reposition themselves, with a constant seperation, say 25px from the upper ones. I am not able to do this. when i change the label of upper static text, the text overlaps on the lower ones. 2. i am not able to implement sizers in general using boa. if anyone can suggest some resources where i can get information, i would be grateful thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: how to associate files with application
Thanks Lasse, that was really helpful -- http://mail.python.org/mailman/listinfo/python-list
how to associate files with application
hi, i want to know how to make a specific type of file open in an application i developed in python when the user clicks on the file.(in windows) for eg. a .txt file when clicked opens in notepad, a .doc file when clicked opens in MS-word. In the same way i want to make a .xyz file open in the application i developed when clicked. thanks in advance for any advice. -- http://mail.python.org/mailman/listinfo/python-list
OT: World's largest Python caught!:)
Hi Can I please get some information on this python? I saw a brief news clip last year am very keen to know more. Thanks Ashok Rajasingh 21 Cumberland street New Plymouth New Zealand +646 7575698 (home) 7599592 (work) Attention:The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies.Please note that the views or opinions expressed in this message may be those of the individual and not necessarily those of Tegel Foods Ltd. This e-mail message has been scanned and cleared by NetIQ MailMarshal -- http://mail.python.org/mailman/listinfo/python-list