From redstone-cold at 163.com Wed Jun 5 10:46:04 2013 From: redstone-cold at 163.com (iMath) Date: Wed, 5 Jun 2013 07:46:04 -0700 (PDT) Subject: how to detect the character encoding in a web page ? In-Reply-To: References: Message-ID: ? 2012?12?24????UTC+8??8?34?47??iMath??? > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ I found PyQt?s QtextStream can very accurately detect the character encoding in a web page . even for this bad page chardet and beautiful soup failed ,but QtextStream can get the right result . here is my code from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtNetwork import * import sys def slotSourceDownloaded(reply): redirctLocation=reply.header(QNetworkRequest.LocationHeader) redirctLocationUrl=reply.url() if not redirctLocation else redirctLocation print(redirctLocationUrl) if (reply.error()!= QNetworkReply.NoError): print('11111111', reply.errorString()) return content=QTextStream(reply).readAll() if content=='': print('---------', 'cannot find any resource !') return print(content) reply.deleteLater() qApp.quit() if __name__ == '__main__': app =QCoreApplication(sys.argv) manager=QNetworkAccessManager () url =input('input url :') request=QNetworkRequest (QUrl.fromEncoded(QUrl.fromUserInput(url).toEncoded())) request.setRawHeader("User-Agent" ,'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0') manager.get(request) manager.finished.connect(slotSourceDownloaded) sys.exit(app.exec_()) From redstone-cold at 163.com Wed Jun 5 11:10:16 2013 From: redstone-cold at 163.com (iMath) Date: Wed, 5 Jun 2013 08:10:16 -0700 (PDT) Subject: how to detect the character encoding in a web page ? In-Reply-To: References: Message-ID: ? 2012?12?24????UTC+8??8?34?47??iMath??? > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ I found PyQt?s QtextStream can very accurately detect the character encoding in a web page . even for this bad page http://www.qnwz.cn/html/yinlegushihui/magazine/2013/0524/425731.html chardet and beautiful soup failed ,but QtextStream can get the right result . here is my code from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtNetwork import * import sys def slotSourceDownloaded(reply): redirctLocation=reply.header(QNetworkRequest.LocationHeader) redirctLocationUrl=reply.url() if not redirctLocation else redirctLocation print(redirctLocationUrl) if (reply.error()!= QNetworkReply.NoError): print('11111111', reply.errorString()) return content=QTextStream(reply).readAll() if content=='': print('---------', 'cannot find any resource !') return print(content) reply.deleteLater() qApp.quit() if __name__ == '__main__': app =QCoreApplication(sys.argv) manager=QNetworkAccessManager () url =input('input url :') request=QNetworkRequest (QUrl.fromEncoded(QUrl.fromUserInput(url).toEncoded())) request.setRawHeader("User-Agent" ,'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0') manager.get(request) manager.finished.connect(slotSourceDownloaded) sys.exit(app.exec_()) From redstone-cold at 163.com Wed Jun 5 11:14:34 2013 From: redstone-cold at 163.com (iMath) Date: Wed, 5 Jun 2013 08:14:34 -0700 (PDT) Subject: how to detect the character encoding in a web page ? In-Reply-To: References: Message-ID: <29a6b839-1e3d-42ba-acf3-a58a5fcb9f5c@googlegroups.com> ? 2012?12?24????UTC+8??8?34?47??iMath??? > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ by the way ,we cannot get character encoding programmatically from the mate data without knowing the character encoding ahead ! From rosuav at gmail.com Wed Jun 5 13:55:11 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 03:55:11 +1000 Subject: how to detect the character encoding in a web page ? In-Reply-To: <29a6b839-1e3d-42ba-acf3-a58a5fcb9f5c@googlegroups.com> References: <29a6b839-1e3d-42ba-acf3-a58a5fcb9f5c@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 1:14 AM, iMath wrote: > ? 2012?12?24????UTC+8??8?34?47??iMath??? >> how to detect the character encoding in a web page ? >> >> such as this page >> >> >> >> http://python.org/ > > by the way ,we cannot get character encoding programmatically from the mate data without knowing the character encoding ahead ! The rules for web pages are (massively oversimplified): 1) HTTP header 2) ASCII-compatible encoding and meta tag The HTTP header is completely out of band. This is the best way to transmit encoding information. Otherwise, you assume 7-bit ASCII and start parsing. Once you find a meta tag, you stop parsing and go back to the top, decoding in the new way. "ASCII-compatible" covers a huge number of encodings, so it's not actually much of a problem to do this. ChrisA From nobody at nowhere.com Thu Jun 6 02:22:37 2013 From: nobody at nowhere.com (Nobody) Date: Thu, 06 Jun 2013 07:22:37 +0100 Subject: how to detect the character encoding in a web page ? References: <29a6b839-1e3d-42ba-acf3-a58a5fcb9f5c@googlegroups.com> Message-ID: On Thu, 06 Jun 2013 03:55:11 +1000, Chris Angelico wrote: > The HTTP header is completely out of band. This is the best way to > transmit encoding information. Otherwise, you assume 7-bit ASCII and start > parsing. Once you find a meta tag, you stop parsing and go back to the > top, decoding in the new way. Provided that the meta tag indicates an ASCII-compatible encoding, and you haven't encountered any decode errors due to 8-bit characters, then there's no need to go back to the top. > "ASCII-compatible" covers a huge number of > encodings, so it's not actually much of a problem to do this. With slight modifications, you can also handle some almost-ASCII-compatible encodings such as shift-JIS. Personally, I'd start by assuming ISO-8859-1, keep track of which bytes have actually been seen, and only re-start parsing from the top if the encoding change actually affects the interpretation of any of those bytes. And if the encoding isn't even remotely ASCII-compatible, you aren't going to be able to recognise the meta tag in the first place. But I don't think I've ever seen a web page encoded in UTF-16 or EBCDIC. Tools like chardet are meant for the situation where either no encoding is specified or the specified encoding can't be trusted (which is rather common; why else would web browsers have a menu to allow the user to select the encoding?). From rosuav at gmail.com Thu Jun 6 03:14:06 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 17:14:06 +1000 Subject: how to detect the character encoding in a web page ? In-Reply-To: References: <29a6b839-1e3d-42ba-acf3-a58a5fcb9f5c@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:22 PM, Nobody wrote: > On Thu, 06 Jun 2013 03:55:11 +1000, Chris Angelico wrote: > >> The HTTP header is completely out of band. This is the best way to >> transmit encoding information. Otherwise, you assume 7-bit ASCII and start >> parsing. Once you find a meta tag, you stop parsing and go back to the >> top, decoding in the new way. > > Provided that the meta tag indicates an ASCII-compatible encoding, and you > haven't encountered any decode errors due to 8-bit characters, then > there's no need to go back to the top. Technically and conceptually, you go back to the start and re-parse. Sure, you might optimize that if you can, but not every parser will, hence it's advisable to put the content-type as early as possible. >> "ASCII-compatible" covers a huge number of >> encodings, so it's not actually much of a problem to do this. > > With slight modifications, you can also handle some > almost-ASCII-compatible encodings such as shift-JIS. > > Personally, I'd start by assuming ISO-8859-1, keep track of which bytes > have actually been seen, and only re-start parsing from the top if the > encoding change actually affects the interpretation of any of those bytes. Hrm, it'd be equally valid to guess UTF-8. But as long as you're prepared to re-parse after finding the content-type, that's just a choice of optimization and has no real impact. ChrisA From redstone-cold at 163.com Sun Jun 9 07:47:02 2013 From: redstone-cold at 163.com (iMath) Date: Sun, 9 Jun 2013 04:47:02 -0700 (PDT) Subject: how to detect the character encoding in a web page ? In-Reply-To: References: Message-ID: <9ad413cd-bdfe-4b24-b4aa-468292a75963@googlegroups.com> ? 2012?12?24????UTC+8??8?34?47??iMath??? > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ Finally ,I found by using PyQt?s QtextStream , QTextCodec and chardet ,we can get a web page code more securely even for this bad page http://www.qnwz.cn/html/yinlegushihui/magazine/2013/0524/425731.html this script http://www.flvxz.com/getFlv.php?url=aHR0cDojI3d3dy41Ni5jb20vdTk1L3ZfT1RFM05UYzBNakEuaHRtbA== and this page without chardet in its source code http://msdn.microsoft.com/en-us/library/bb802962(v=office.12).aspx from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtNetwork import * import sys import chardet def slotSourceDownloaded(reply): redirctLocation=reply.header(QNetworkRequest.LocationHeader) redirctLocationUrl=reply.url() if not redirctLocation else redirctLocation #print(redirctLocationUrl,reply.header(QNetworkRequest.ContentTypeHeader)) if (reply.error()!= QNetworkReply.NoError): print('11111111', reply.errorString()) return pageCode=reply.readAll() charCodecInfo=chardet.detect(pageCode.data()) textStream=QTextStream(pageCode) codec=QTextCodec.codecForHtml(pageCode,QTextCodec.codecForName(charCodecInfo['encoding'] )) textStream.setCodec(codec) content=textStream.readAll() print(content) if content=='': print('---------', 'cannot find any resource !') return reply.deleteLater() qApp.quit() if __name__ == '__main__': app =QCoreApplication(sys.argv) manager=QNetworkAccessManager () url =input('input url :') request=QNetworkRequest (QUrl.fromEncoded(QUrl.fromUserInput(url).toEncoded())) request.setRawHeader("User-Agent" ,'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0') manager.get(request) manager.finished.connect(slotSourceDownloaded) sys.exit(app.exec_()) From carlosnepomuceno at outlook.com Sun Jun 9 17:35:55 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Mon, 10 Jun 2013 00:35:55 +0300 Subject: how to detect the character encoding in a web page ? In-Reply-To: <9ad413cd-bdfe-4b24-b4aa-468292a75963@googlegroups.com> References: , <9ad413cd-bdfe-4b24-b4aa-468292a75963@googlegroups.com> Message-ID: Try this: ### get_charset.py ### import re import urllib2 def get_charset(url): resp = urllib2.urlopen(url) #retrieve charset from header headers = ''.join(resp.headers.headers) charset_from_header_list = re.findall('charset=(.*)', headers) charset_from_header = charset_from_header_list[-1] if charset_from_header_list else '' #retrieve charset from html html = resp.read() charset_from_html_list = re.findall('Content-Type.*charset=["\']?(.*)["\']', html) charset_from_html = charset_from_html_list[-1] if charset_from_html_list else '' return charset_from_html if charset_from_html else charset_from_header > Date: Sun, 9 Jun 2013 04:47:02 -0700 > Subject: Re: how to detect the character encoding in a web page ? > From: redstone-cold at 163.com > To: python-list at python.org > > ? 2012?12?24????UTC+8??8?34?47??iMath??? > > how to detect the character encoding in a web page ? > > > > such as this page > > > > > > > > http://python.org/ > > Finally ,I found by using PyQt?s QtextStream , QTextCodec and chardet ,we can get a web page code more securely > even for this bad page > http://www.qnwz.cn/html/yinlegushihui/magazine/2013/0524/425731.html > > this script > http://www.flvxz.com/getFlv.php?url=aHR0cDojI3d3dy41Ni5jb20vdTk1L3ZfT1RFM05UYzBNakEuaHRtbA== > > and this page without chardet in its source code > http://msdn.microsoft.com/en-us/library/bb802962(v=office.12).aspx > > > from PyQt4.QtCore import * > from PyQt4.QtGui import * > from PyQt4.QtNetwork import * > import sys > import chardet > > def slotSourceDownloaded(reply): > redirctLocation=reply.header(QNetworkRequest.LocationHeader) > redirctLocationUrl=reply.url() if not redirctLocation else redirctLocation > #print(redirctLocationUrl,reply.header(QNetworkRequest.ContentTypeHeader)) > > if (reply.error()!= QNetworkReply.NoError): > print('11111111', reply.errorString()) > return > > pageCode=reply.readAll() > charCodecInfo=chardet.detect(pageCode.data()) > > textStream=QTextStream(pageCode) > codec=QTextCodec.codecForHtml(pageCode,QTextCodec.codecForName(charCodecInfo['encoding'] )) > textStream.setCodec(codec) > content=textStream.readAll() > print(content) > > if content=='': > print('---------', 'cannot find any resource !') > return > > reply.deleteLater() > qApp.quit() > > > if __name__ == '__main__': > app =QCoreApplication(sys.argv) > manager=QNetworkAccessManager () > url =input('input url :') > request=QNetworkRequest (QUrl.fromEncoded(QUrl.fromUserInput(url).toEncoded())) > request.setRawHeader("User-Agent" ,'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0') > manager.get(request) > manager.finished.connect(slotSourceDownloaded) > sys.exit(app.exec_()) > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From redstone-cold at 163.com Sun Jun 9 07:52:20 2013 From: redstone-cold at 163.com (iMath) Date: Sun, 9 Jun 2013 04:52:20 -0700 (PDT) Subject: how to detect the character encoding in a web page ? In-Reply-To: References: Message-ID: <0d5ff0cb-42b3-47f2-ab92-192a80ea26cb@googlegroups.com> ? 2012?12?24????UTC+8??8?34?47??iMath??? > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ here is one thread that can help me understanding my code http://stackoverflow.com/questions/17001407/how-to-detect-the-character-encoding-of-a-web-page-programmatically/17009285#17009285 From j.mapping at gmail.com Fri Jun 14 13:14:53 2013 From: j.mapping at gmail.com (j.mapping at gmail.com) Date: Fri, 14 Jun 2013 10:14:53 -0700 (PDT) Subject: PyGresql 4.1.1 for python2.7 In-Reply-To: References: <510A6BA4.4070306@compulab.co.il> Message-ID: <131ac889-eeae-450d-aa92-080f5ef33d63@googlegroups.com> On Sunday, February 3, 2013 4:14:34 AM UTC-7, alexandra wrote: > Using dependency walker revealed that the following are missing from > libpq: > > PQescapeLiteral > > PQescapeIdentifier > > These are only defined in postgresql 9. > > Documentation states that PyGresql 4.1.1 is compatible with > PostgreSQL 8.3 or higher and I'm using 8.4. > > Has anyone else had this problem? > > > > > On 01/31/2013 03:03 PM, alexandra > wrote: > > > > > Hello, > > > > I'm trying to upgrade to python2.7. > > Installed PyGresql 4.1.1 for python 2.7. > > When running "import pg" command I get the following error: > > > > from _pg import * > > ImportError: DLL load failed: The operating system cannot run %1. > > > > I'm using Windows XP SP3, and have PostgreSQL 8.4 installed. > > The command runs fine in python 2.6. > > > > Is this due to having multiple versions of python installed? Or > some kind of dll incompatibility with 2.7 (maybe libpq.dll)? > > > > Thanks for the help Yes I'm having this problem also. Did you ever find a solution? J From nagle at animats.com Mon Jun 3 15:20:43 2013 From: nagle at animats.com (John Nagle) Date: Mon, 03 Jun 2013 12:20:43 -0700 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: Message-ID: On 5/15/2013 9:19 PM, Benjamin Peterson wrote: > It is my greatest pleasure to announce the release of Python 2.7.5. > > 2.7.5 is the latest maintenance release in the Python 2.7 series. Thanks very much. It's important that Python 2.x be maintained. 3.x is a different language, with different libraries, and lots of things that still don't work. Many old applications will never be converted. John Nagle From carlosnepomuceno at outlook.com Mon Jun 3 18:37:46 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 01:37:46 +0300 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: , Message-ID: ---------------------------------------- > From: nagle at animats.com > Subject: Re: [RELEASED] Python 2.7.5 > Date: Mon, 3 Jun 2013 12:20:43 -0700 [...] > 3.x is a different language, with different libraries, and lots of > things that still don't work. Many old applications will never > be converted. > > John Nagle What still doesn't work in Python 3? Is Python 2.7.5 last (final, never to be updated) revision or will it still be supported? From rosuav at gmail.com Mon Jun 3 18:54:54 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 08:54:54 +1000 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: Message-ID: On Tue, Jun 4, 2013 at 8:37 AM, Carlos Nepomuceno wrote: > ---------------------------------------- >> From: nagle at animats.com >> Subject: Re: [RELEASED] Python 2.7.5 >> Date: Mon, 3 Jun 2013 12:20:43 -0700 > [...] >> 3.x is a different language, with different libraries, and lots of >> things that still don't work. Many old applications will never >> be converted. >> >> John Nagle > > What still doesn't work in Python 3? > > Is Python 2.7.5 last (final, never to be updated) revision or will it still be supported? There won't be a Python 2.8 (at least, not from python.org), so there won't be any feature additions to the Python 2 line. It'll be supported in terms of bugfixes for a good while though, see PEP 373 [1], and of course distributions can do their own backporting of patches for as long as they like (Red Hat will quite possibly want to support old Pythons for a long time). [1] http://www.python.org/dev/peps/pep-0373/ ChrisA From breamoreboy at yahoo.co.uk Mon Jun 3 19:12:03 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Tue, 04 Jun 2013 00:12:03 +0100 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: , Message-ID: On 03/06/2013 23:37, Carlos Nepomuceno wrote: > ---------------------------------------- >> From: nagle at animats.com >> Subject: Re: [RELEASED] Python 2.7.5 >> Date: Mon, 3 Jun 2013 12:20:43 -0700 > [...] >> 3.x is a different language, with different libraries, and lots of >> things that still don't work. Many old applications will never >> be converted. >> >> John Nagle > > What still doesn't work in Python 3? http://python3wos.appspot.com/ > > Is Python 2.7.5 last (final, never to be updated) revision or will it still be supported? > http://www.python.org/dev/peps/pep-0373/ -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From carlosnepomuceno at outlook.com Mon Jun 3 19:25:11 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 02:25:11 +0300 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: , , , , Message-ID: Thank you! :) ---------------------------------------- > To: python-list at python.org > From: breamoreboy at yahoo.co.uk [...] >> What still doesn't work in Python 3? > > http://python3wos.appspot.com/ > >> >> Is Python 2.7.5 last (final, never to be updated) revision or will it still be supported? >> > > http://www.python.org/dev/peps/pep-0373/ > > -- > "Steve is going for the pink ball - and for those of you who are > watching in black and white, the pink is next to the green." Snooker > commentator 'Whispering' Ted Lowe. > > Mark Lawrence > > -- > http://mail.python.org/mailman/listinfo/python-list From joshua.landau.ws at gmail.com Tue Jun 4 16:42:37 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Tue, 4 Jun 2013 21:42:37 +0100 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: Message-ID: On 4 June 2013 00:12, Mark Lawrence wrote: > On 03/06/2013 23:37, Carlos Nepomuceno wrote: >> What still doesn't work in Python 3? > > http://python3wos.appspot.com/ Don't take this list too seriously - some of those do have fully working and stable Python 3 packages that just aren't in pip, like python-daemon. From fabiosantosart at gmail.com Tue Jun 4 16:51:53 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 21:51:53 +0100 Subject: [RELEASED] Python 2.7.5 In-Reply-To: References: Message-ID: On 4 Jun 2013 21:47, "Joshua Landau" wrote: > > On 4 June 2013 00:12, Mark Lawrence wrote: > > On 03/06/2013 23:37, Carlos Nepomuceno wrote: > >> What still doesn't work in Python 3? > > > > http://python3wos.appspot.com/ > > Don't take this list too seriously - some of those do have fully > working and stable Python 3 packages that just aren't in pip, like > python-daemon. Also, django's py3k support is experimental for now. https://docs.djangoproject.com/en/dev/releases/1.5/ (see overview, second paragraph) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben+python at benfinney.id.au Wed Jun 5 21:40:55 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Thu, 06 Jun 2013 11:40:55 +1000 Subject: Python 3 and =?utf-8?Q?=E2=80=98python-daemon=E2=80=99?= (was: [RELEASED] Python 2.7.5) References: Message-ID: <7w38swow2g.fsf_-_@benfinney.id.au> Joshua Landau writes: > Don't take this list too seriously - some of those do have fully > working and stable Python 3 packages that just aren't in pip, like > python-daemon. That's news to me, as the package maintainer. There's no official ?python-daemon? release for Python 3. What ?python-daemon? works in Python 3? -- \ ?We are not gonna be great; we are not gonna be amazing; we are | `\ gonna be *amazingly* amazing!? ?Zaphod Beeblebrox, _The | _o__) Hitch-Hiker's Guide To The Galaxy_, Douglas Adams | Ben Finney From debruinjj at gmail.com Sun Jun 2 21:47:48 2013 From: debruinjj at gmail.com (Jurgens de Bruin) Date: Sun, 2 Jun 2013 18:47:48 -0700 (PDT) Subject: Please help with Threading In-Reply-To: <7baacf5a-0c50-4935-ad5b-148c208d759b@googlegroups.com> References: <7baacf5a-0c50-4935-ad5b-148c208d759b@googlegroups.com> Message-ID: On Saturday, 18 May 2013 10:58:13 UTC+2, Jurgens de Bruin wrote: > This is my first script where I want to use the python threading module. I have a large dataset which is a list of dict this can be as much as 200 dictionaries in the list. The final goal is a histogram for each dict 16 histograms on a page ( 4x4 ) - this already works. > > What I currently do is a create a nested list [ [ {} ], [ {} ] ] each inner list contains 16 dictionaries, thus each inner list is a single page of 16 histograms. Iterating over the outer-list and creating the graphs takes to long. So I would like multiple inner-list to be processes simultaneously and creating the graphs in "parallel". > > I am trying to use the python threading for this. I create 4 threads loop over the outer-list and send a inner-list to the thread. This seems to work if my nested lists only contains 2 elements - thus less elements than threads. Currently the scripts runs and then seems to get hung up. I monitor the resource on my mac and python starts off good using 80% and when the 4-thread is created the CPU usages drops to 0%. > > > > My thread creating is based on the following : http://www.tutorialspoint.com/python/python_multithreading.htm > > > > Any help would be create!!! Thanks to all for the discussion/comments on threading, although I have not been commenting I have been following. I have learnt a lot and I am still reading up on everything mentioned. Thanks again Will see how I am going to solve my senario. From feliphil at gmx.net Sat Jun 1 14:18:17 2013 From: feliphil at gmx.net (Wolfgang Keller) Date: Sat, 1 Jun 2013 20:18:17 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> Message-ID: <20130601201817.55d3361dda93dac387a9eab6@gmx.net> > > A GUI that can not be used without taking the ten fingers off the > > keyboard is indeed entirely unusable for any half-proficient > > screenworker. And anyone doing actual productive screenwork every > > day for more than just a few months will inevitably (have to) get > > proficient (unless completely braindead). > > My ten fingers stay on my keyboard, which looks somewhat thus: > > http://www.xbitlabs.com/images/mobile/lenovo-thinkpad-t61/keyboard.jpg > > See the red dot in the middle? Mouse. I didn't mean "trackpoints" or similar devices, but full keyboard "navigation" of the entire GUI through shortcuts etc. A "touch-type" GUI is a "must have" for any application that's supposed to be used productively. The mouse is nice to "explore" a GUI or for occasional/leisurely use, but once you use an application daily to earn your living, it's a hopeless roadblock for productivity. As is the "response time" behaviour of "web applications". Besides that pathological non-operating system MS (Not Responding), btw. "No cursor animation ever" is an absolute "must have" requirement for productivity applications. > THIS is a professional programmer's workspace. :) And by "screenworkers" I didn't refer to programmers. Those people rarely have to use the stuff that they implement. Sincerely, Wolfgang From rosuav at gmail.com Sat Jun 1 16:46:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 2 Jun 2013 06:46:02 +1000 Subject: Future standard GUI library In-Reply-To: <20130601201817.55d3361dda93dac387a9eab6@gmx.net> References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> Message-ID: On Sun, Jun 2, 2013 at 4:18 AM, Wolfgang Keller wrote: >> > A GUI that can not be used without taking the ten fingers off the >> > keyboard is indeed entirely unusable for any half-proficient >> > screenworker. And anyone doing actual productive screenwork every >> > day for more than just a few months will inevitably (have to) get >> > proficient (unless completely braindead). >> >> My ten fingers stay on my keyboard, which looks somewhat thus: >> >> http://www.xbitlabs.com/images/mobile/lenovo-thinkpad-t61/keyboard.jpg >> >> See the red dot in the middle? Mouse. > > I didn't mean "trackpoints" or similar devices, but full keyboard > "navigation" of the entire GUI through shortcuts etc. > > A "touch-type" GUI is a "must have" for any application that's supposed > to be used productively. The mouse is nice to "explore" a GUI or for > occasional/leisurely use, but once you use an application daily to earn > your living, it's a hopeless roadblock for productivity. You have seriously underestimated the power of the combined keyboard+mouse interface. I absolutely agree that keyboard-only will (almost) always beat mouse-only, but keyboard AND mouse together can beat either alone, if the UI is designed correctly. Case in point: Partial staging of a file in git. I can use 'git add -p' or 'git gui'. With the former, it's all keyboard; I can step through the hunks, choose what to stage, move on. With the latter, it's more visual; I right-click a hunk and choose "Stage this hunk" (or "Stage this line", which is actually quite fiddly with 'git add -p'). I am a self-confessed keyboard junkie. I will use the keyboard for pretty much everything. Yet I use git gui and almost never git add -p, the one exception being when I can't use git gui (eg it's not installed on some remote headless system and installing it would require fetching gobs of GUI libraries). It uses the mouse to good result. > As is the "response time" behaviour of "web applications". On a LAN, with a proper back-end, I can get instant response from a web app. Obviously over the internet there's latency, but that's nothing to do with the use of a web browser as a UI; you'll see that with ssh just as much. > "No cursor animation ever" is an absolute "must have" requirement for > productivity applications. Not really. There are times when the human will be legitimately waiting for the computer. http://xkcd.com/303/ for one. But this still has little to do with the use of a web browser UI; I can achieve exactly that with the Yosemite Project, which can actually be a three-computer system: the content is stored on one, the HTTP server is on another, and the web browser is separate again. And this is only a 100Mbit LAN. If you need moar speeeeeeed, you can always demand gigabit or better. >> THIS is a professional programmer's workspace. :) > > And by "screenworkers" I didn't refer to programmers. Those people > rarely have to use the stuff that they implement. Of course not, programmers never use software they've themselves written. Never. Not in a million... oh wait, what's this I have? Hmm, gcc used to compile gcc, RosMud being used by Rosuav, Neil Hodgson using SciTE... naw, they're all statistical anomalies, carry on! You really have a very low opinion of programmers for someone on a programming mailing list :) ChrisA From tjreedy at udel.edu Sat Jun 1 17:52:18 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Sat, 01 Jun 2013 17:52:18 -0400 Subject: Future standard GUI library In-Reply-To: References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> Message-ID: On 6/1/2013 4:46 PM, Chris Angelico wrote: > On Sun, Jun 2, 2013 at 4:18 AM, Wolfgang Keller wrote: >> And by "screenworkers" I didn't refer to programmers. Those people >> rarely have to use the stuff that they implement. > > Of course not, programmers never use software they've themselves > written. Never. Not in a million... oh wait, what's this I have? Hmm, > gcc used to compile gcc, RosMud being used by Rosuav, Neil Hodgson > using SciTE... naw, they're all statistical anomalies, carry on! And I use Idle to improve Idle. I use the HgWorkbench front-end to hg because point and click is often *faster* for me than remember (or look up command and arg) and type (without error, or correction after error). Now back to ignoring the troll. Terry From feliphil at gmx.net Wed Jun 12 16:28:19 2013 From: feliphil at gmx.net (Wolfgang Keller) Date: Wed, 12 Jun 2013 22:28:19 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> Message-ID: <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> > > A "touch-type" GUI is a "must have" for any application that's > > supposed to be used productively. The mouse is nice to "explore" a > > GUI or for occasional/leisurely use, but once you use an > > application daily to earn your living, it's a hopeless roadblock > > for productivity. > > You have seriously underestimated the power of the combined > keyboard+mouse interface. As someone who has started to use computers with the Atari ST and later the Mac, and as someone who has never become proficient himself with any of the various Unix shells (besides that I had to learn to *hate* any version of MS DOS or MS (Not Responding)), I certainly don't underestimate the value of the mouse. But could it be that you have never seen an actually proficient user of a typical "enterprise" application (ERP, MRP, whatever) "zipping" through the GUI of his/her bread-and-butter application so fast that you can not even read the titles of windows or dialog boxes. Obviously, this won't work if the client runs on this pathological non-operating system MS (Not Responding), much less with "web applications". Oh, and btw; SAP is a particularly illustrative example for the horrible response time behaviour of applications with centralised application logic. They call it "hour-glass display program" over here, "SanduhrAnzeigeProgramm" in German. > > As is the "response time" behaviour of "web applications". > > On a LAN, with a proper back-end, I can get instant response from a > web app. I have been involved as "domain specialist" (and my input has always been consistently conveniently ignored) with projects for web applications and the results never turned out to be even remotely usable for actually productive work. Sincerely, Wolfgang From frank at chagford.com Thu Jun 13 05:32:58 2013 From: frank at chagford.com (Frank Millman) Date: Thu, 13 Jun 2013 11:32:58 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net><20130523174145.22a6c46f586b0a1f656d2412@gmx.net><20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net><20130527172250.a8b0ce44f29398d63a4ec650@gmx.net><20130530184045.6d15530be70e18d96e5654ad@gmx.net><20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: "Wolfgang Keller" wrote in message news:20130612222819.2a044e86ab4b6defe1939a04 at gmx.net... > > But could it be that you have never seen an actually proficient user of > a typical "enterprise" application (ERP, MRP, whatever) "zipping" > through the GUI of his/her bread-and-butter application so fast that > you can not even read the titles of windows or dialog boxes. > > Obviously, this won't work if the client runs on this pathological > non-operating system MS (Not Responding), much less with "web > applications". > [...] > >> >> On a LAN, with a proper back-end, I can get instant response from a >> web app. > > I have been involved as "domain specialist" (and my input has always > been consistently conveniently ignored) with projects for web > applications and the results never turned out to be even remotely usable > for actually productive work. > Hi Wolfgang I share your passion for empowering a human operator to complete and submit a form as quickly as possible. I therefore agree that one should be able to complete a form using the keyboard only. There is an aspect I am unsure of, and would appreciate any feedback based on your experience. I am talking about what I call 'field-by-field validation'. Each field could have one or more checks to ensure that the input is valid. Some can be done on the client (e.g. value must be numeric), others require a round-trip to the server (e.g. account number must exist on file). Some applications defer the server-side checks until the entire form is submitted, others perform the checks in-line. My preference is for the latter. I agree with Chris that on a LAN, it makes little or no difference whether the client side is running a web browser or a traditional gui interface. On a WAN, there could be a latency problem. Ideally an application should be capable of servicing a local client or a remote client, so it is not easy to find the right balance. Do you have strong views on which is the preferred approach. Thanks for any input. Frank Millman From rosuav at gmail.com Thu Jun 13 10:04:17 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 14 Jun 2013 00:04:17 +1000 Subject: Future standard GUI library In-Reply-To: References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: On Thu, Jun 13, 2013 at 7:32 PM, Frank Millman wrote: > I am talking about what I call 'field-by-field validation'. Each field could > have one or more checks to ensure that the input is valid. Some can be done > on the client (e.g. value must be numeric), others require a round-trip to > the server (e.g. account number must exist on file). Some applications defer > the server-side checks until the entire form is submitted, others perform > the checks in-line. My preference is for the latter. It's not either-or. The server *MUST* perform the checks at the time of form submission; the question is whether or not to perform duplicate checks earlier. This is an absolute rule of anything where the client is capable of being tampered with, and technically, you could violate it on a closed system; but it's so easy to migrate from closed system to diverse system without adding all the appropriate checks, so just have the checks from the beginning. In terms of software usability, either is acceptable, but do make sure the user can continue working with the form even if there's latency talking to the server - don't force him/her to wait while you check if the previous field was valid. I know that seems obvious, but apparently not to everyone, as there are forms out there that violate this... ChrisA From frank at chagford.com Fri Jun 14 01:39:08 2013 From: frank at chagford.com (Frank Millman) Date: Fri, 14 Jun 2013 07:39:08 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net><20130523174145.22a6c46f586b0a1f656d2412@gmx.net><20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net><20130527172250.a8b0ce44f29398d63a4ec650@gmx.net><20130530184045.6d15530be70e18d96e5654ad@gmx.net><20130601201817.55d3361dda93dac387a9eab6@gmx.net><20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: "Chris Angelico" wrote in message news:CAPTjJmo+fWsCD3Lb6s+zmWspKzzk_JB=pbcvfLBZjGCFxvM9HA at mail.gmail.com... > On Thu, Jun 13, 2013 at 7:32 PM, Frank Millman wrote: >> I am talking about what I call 'field-by-field validation'. Each field >> could >> have one or more checks to ensure that the input is valid. Some can be >> done >> on the client (e.g. value must be numeric), others require a round-trip >> to >> the server (e.g. account number must exist on file). Some applications >> defer >> the server-side checks until the entire form is submitted, others perform >> the checks in-line. My preference is for the latter. > > It's not either-or. The server *MUST* perform the checks at the time > of form submission; the question is whether or not to perform > duplicate checks earlier. This is an absolute rule of anything where > the client is capable of being tampered with, and technically, you > could violate it on a closed system; but it's so easy to migrate from > closed system to diverse system without adding all the appropriate > checks, so just have the checks from the beginning. > In my case, it is either-or. I do not just do field-by-field validation, I do field-by-field submission. The server builds up a record of the data entered while it is being entered. When the user selects 'Save', it does not resend the entire form, it simply sends a message to the server telling it to process the data it has already stored. > In terms of software usability, either is acceptable, but do make sure > the user can continue working with the form even if there's latency > talking to the server - don't force him/her to wait while you check if > the previous field was valid. I know that seems obvious, but > apparently not to everyone, as there are forms out there that violate > this... > I plead guilty to this, but I am not happy about it, hence my original post. I will take on board your comments, and see if I can figure out a way to have the best of both worlds. Frank From rosuav at gmail.com Fri Jun 14 05:10:27 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 14 Jun 2013 19:10:27 +1000 Subject: Future standard GUI library In-Reply-To: References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: On Fri, Jun 14, 2013 at 3:39 PM, Frank Millman wrote: >> It's not either-or. The server *MUST* perform the checks at the time >> of form submission; the question is whether or not to perform >> duplicate checks earlier. This is an absolute rule of anything where >> the client is capable of being tampered with, and technically, you >> could violate it on a closed system; but it's so easy to migrate from >> closed system to diverse system without adding all the appropriate >> checks, so just have the checks from the beginning. >> > > In my case, it is either-or. I do not just do field-by-field validation, I > do field-by-field submission. The server builds up a record of the data > entered while it is being entered. When the user selects 'Save', it does not > resend the entire form, it simply sends a message to the server telling it > to process the data it has already stored. Ah, I see what you mean. What I was actually saying was that it's mandatory to check on the server, at time of form submission, and optional to pre-check (either on the client itself, for simple syntactic issues, or via AJAX or equivalent) for faster response. As a general rule, I would be inclined to go with a more classic approach for reasons of atomicity. What happens if the user never gets around to selecting Save? Does the server have a whole pile of data that it can't do anything with? Do you garbage-collect that eventually? The classic model allows you to hold off inserting anything into the database until it's fully confirmed, and then do the whole job in a single transaction. But if you want to use a "wizard" approach, where the user enters one thing and then moves on to the next, that can work too. It gets clunky quickly, but it can be useful if the early responses make the subsequent questions drastically different. ChrisA From frank at chagford.com Fri Jun 14 05:36:19 2013 From: frank at chagford.com (Frank Millman) Date: Fri, 14 Jun 2013 11:36:19 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net><20130523174145.22a6c46f586b0a1f656d2412@gmx.net><20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net><20130527172250.a8b0ce44f29398d63a4ec650@gmx.net><20130530184045.6d15530be70e18d96e5654ad@gmx.net><20130601201817.55d3361dda93dac387a9eab6@gmx.net><20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: "Chris Angelico" wrote in message news:CAPTjJmq_m4y0UXXt3JqYThJj9CKbsvp+Z2PGF5v_31xLrgfr4Q at mail.gmail.com... > On Fri, Jun 14, 2013 at 3:39 PM, Frank Millman wrote: >> >> In my case, it is either-or. I do not just do field-by-field validation, >> I >> do field-by-field submission. The server builds up a record of the data >> entered while it is being entered. When the user selects 'Save', it does >> not >> resend the entire form, it simply sends a message to the server telling >> it >> to process the data it has already stored. > > Ah, I see what you mean. What I was actually saying was that it's > mandatory to check on the server, at time of form submission, and > optional to pre-check (either on the client itself, for simple > syntactic issues, or via AJAX or equivalent) for faster response. > > As a general rule, I would be inclined to go with a more classic > approach for reasons of atomicity. What happens if the user never gets > around to selecting Save? Does the server have a whole pile of data > that it can't do anything with? Do you garbage-collect that > eventually? The classic model allows you to hold off inserting > anything into the database until it's fully confirmed, and then do the > whole job in a single transaction. > The data is just stored in memory in a 'Session' object. I have a 'keep-alive' feature that checks if the client is alive, and removes the session with all its data if it detects that the client has gone away. Timeout is configurable, but I have it set to 30 seconds at the moment. The session is removed immediately if the user logs off. He is warned if there is unsaved data. Frank From feliphil at gmx.net Fri Jun 14 11:18:07 2013 From: feliphil at gmx.net (Wolfgang Keller) Date: Fri, 14 Jun 2013 17:18:07 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> Message-ID: <20130614171807.0a3c848f2be0ffdbd1b50813@gmx.net> > I share your passion for empowering a human operator to complete and > submit a form as quickly as possible. I therefore agree that one > should be able to complete a form using the keyboard only. This is not just about "forms", it's about using the entire application without having to use the mouse, ever. > Do you have strong views on which is the preferred approach. Use a decent database RAD desktop (non-web) GUI application framework which uses client-side application logics. "Validation" of input will then be essentially instantaneous. Unless you run the client on that pathological non-operating system MS (Not Responding), obviously. I've posted a corresponding list of frameworks available for Python multiple times already on this group: using PyQt (& Sqlalchemy): Qtalchemy: www.qtalchemy.org Camelot: www.python-camelot.com Pypapi: www.pypapi.org using PyGTK: Sqlkit: sqlkit.argolinux.org (also uses Sqlalchemy) Kiwi: www.async.com.br/projects/kiwi using wxPython: Gui2Py: code.google.com/p/gui2py/ Dabo: www.dabodev.com Defis: sourceforge.net/projects/defis (Russian only) GNUe: www.gnuenterprise.org Server-roundtrips required for simple user interaction are an absolute non-starter for productivity applications. No matter whether in a LAN or WAN. If you want a responsive application you have to de-centralise as much as possible. Perfect solution would be if Bettina Kemme's Postgres-R was available for production use, then even the persistence could run locally on the client with asynchronous replication of all clients ("peer to peer"). Sincerely, Wolfgang From rosuav at gmail.com Fri Jun 14 13:00:10 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 15 Jun 2013 03:00:10 +1000 Subject: Future standard GUI library In-Reply-To: <20130614171807.0a3c848f2be0ffdbd1b50813@gmx.net> References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> <20130614171807.0a3c848f2be0ffdbd1b50813@gmx.net> Message-ID: On Sat, Jun 15, 2013 at 1:18 AM, Wolfgang Keller wrote: > Server-roundtrips required for simple user interaction are an absolute > non-starter for productivity applications. No matter whether in a LAN > or WAN. If you want a responsive application you have to de-centralise > as much as possible. Okay... how long does a round-trip cost? Considering that usability guidelines generally permit ~100ms for direct interaction, and considering that computers on a LAN can easily have sub-millisecond ping times, it seems to me you're allowing a ridiculous amount of time for code to execute on the server. Now, granted, there are systems that suboptimal. (Magento, a PHP-based online shopping cart system, took the better part of a second - something in the order of 700-800ms - to add a single item. And that on reasonable hardware, not a dedicated server but my test box was certainly not trash.) For a real-world example of a LAN system that uses a web browser as its UI, I'm using the Yosemite Project here. It consists of a single-threaded Python script, no scaling assistance from Apache, just the simplest it can possibly be. It is running on three computers: yosemite [the one after whom the project was named], huix, and sikorsky. I used 'time wget http://hostname:3003/airshow' for my testing, which involves: * A DNS lookup from the local DNS server (on the LAN) * An HTTP query to the specified host * A directory listing, usually remote * Building a response (in Python) * Returning that via HTTP * Save the resulting page to disk Since I'm using the bash 'time' builtin, all of this is counted (I'm using the 'real' figure here; the 'user' and 'sys' figures are of course zero, or as close as makes no odds - takes no CPU to do this). The files in question are actually stored on Huix. Queries to that server therefore require a local directory listing; queries to sikorsky involve an sshfs directory listing, and those to yosemite use NetBIOS. (Yosemite runs Windows XP, Huix and Sikorsky are running Linux.) My figures do have one peculiar outlier. Queries from Sikorsky to Yosemite were taking 4-5 seconds, consistently; identical queries from Huix to Yosemite were more consistent with other data. I have no idea why this is. So, the figures! Every figure I could get for talking to a Linux server (either Huix or Sikorsky) was between 7ms and 16ms. (Any particular combination of client and server is fairly stable, eg sikorsky -> sikorsky is consistently 8ms.) And talking to the Windows server, aside from the crazy outlier, varied from 22ms to 29ms. Considering that the Windows lookups involve NetBIOS, I'm somewhat not surprised; there's a bit of cost there. That's the entire round-trip cost. The queries from Sikorsky to Yosemite involve three computers (the client, the server, and the file server), and is completed in under 30 milliseconds. That still gives you 70 milliseconds to render the page to the user, and still be within the estimated response time for an immediate action. In the case of localhost, as mentioned above, that figure comes down to just 8ms - just *eight milliseconds* to do a query involving two servers - so I have to conclude that HTTP is plenty fast enough for a UI. I have seen a number of desktop applications that can't beat that kind of response time. There, thou hast it all, Master Wilfred. Make the most of it. :) ChrisA From feliphil at gmx.net Sat Jun 15 08:25:02 2013 From: feliphil at gmx.net (Wolfgang Keller) Date: Sat, 15 Jun 2013 14:25:02 +0200 Subject: Future standard GUI library References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> <20130614171807.0a3c848f2be0ffdbd1b50813@gmx.net> Message-ID: <20130615142502.2043f2e939d8e54e133dec24@gmx.net> > Okay... how long does a round-trip cost? With a protocol that wasn't made for the purpose (such as HTTP) and all that HTML to "render" (not to mention javascript that's required for even the most trivial issues) - way too long. > Considering that usability guidelines generally permit ~100ms for > direct interaction, That's "generous". A proficient user with a responsive application can easily outpace that. 100ms is definitely a noticeable lag. Even I feel that and I don't use touch-typing to use the GUI. 50ms might not be noticeable, but I don't have the skills myself to test that. > (Magento, a PHP-based online shopping cart system, took the better > part of a second - something in the order of 700-800ms > - to add a single item. And that on reasonable hardware, not a > dedicated server but my test box was certainly not trash.) That's not a question of hardware. Just like with MS (Not Responding). > That's the entire round-trip cost. The queries from Sikorsky to > Yosemite involve three computers (the client, the server, and the file > server), and is completed in under 30 milliseconds. I am talking about applications that actually do something. In my case, database applications. A PostgreSQL transaction is supposed to take at most 25ms to complete (anything above is generally considered an issue that needs to be solved, such as bad SQL), *server-side*. That leaves you another 25ms for the entire network protocol (the pgsql protocol, whatever it is, was designed for the purpose, unlike HTTP) *and* the client-side application logic, including the GUI "rendering". Qt is already quite sluggish sometimes, don't know why. GTK and wxPython "feel" swifter, at least on an actual *operating* system. MS (Not Responding) is definitely incapable to allow applications anything remotely close to "responsiveness". Minute-long lockups with frozen cursor are "normal". > That still gives you 70 milliseconds to render the page to the user, Forget that. 25ms for client-server (pgsql) network protocol, client-side application logic *and* GUI. With a "web" application that would have to include "application server"-side application logic, *and* generation of HTML (and javascript), *and* HTTP protocol *and* HTML "rendering" *and* client-side javascript. Won't work. Sincerely, Wolfgang From rosuav at gmail.com Sat Jun 15 09:26:03 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 15 Jun 2013 23:26:03 +1000 Subject: Future standard GUI library In-Reply-To: <20130615142502.2043f2e939d8e54e133dec24@gmx.net> References: <20130522154233.fe5263cb231c375fc60c7c9b@gmx.net> <20130523174145.22a6c46f586b0a1f656d2412@gmx.net> <20130526194310.9cdb1be80b42c7fdf0ba502f@gmx.net> <20130527172250.a8b0ce44f29398d63a4ec650@gmx.net> <20130530184045.6d15530be70e18d96e5654ad@gmx.net> <20130601201817.55d3361dda93dac387a9eab6@gmx.net> <20130612222819.2a044e86ab4b6defe1939a04@gmx.net> <20130614171807.0a3c848f2be0ffdbd1b50813@gmx.net> <20130615142502.2043f2e939d8e54e133dec24@gmx.net> Message-ID: On Sat, Jun 15, 2013 at 10:25 PM, Wolfgang Keller wrote: >> Okay... how long does a round-trip cost? > > With a protocol that wasn't made for the purpose (such as HTTP) and all > that HTML to "render" (not to mention javascript that's required for > even the most trivial issues) - way too long. You keep saying this. I have yet to see actual timings from you. >> Considering that usability guidelines generally permit ~100ms for >> direct interaction, > > 100ms is definitely a noticeable lag. Even I feel that and I don't use > touch-typing to use the GUI. 50ms might not be noticeable, but I don't > have the skills myself to test that. Okay, so let's talk 50ms then. We can handle this. >> That's the entire round-trip cost. The queries from Sikorsky to >> Yosemite involve three computers (the client, the server, and the file >> server), and is completed in under 30 milliseconds. > > I am talking about applications that actually do something. In my case, > database applications. A PostgreSQL transaction is supposed to take at > most 25ms to complete (anything above is generally considered an issue > that needs to be solved, such as bad SQL), *server-side*. That leaves > you another 25ms for the entire network protocol (the pgsql protocol, > whatever it is, was designed for the purpose, unlike HTTP) *and* the > client-side application logic, including the GUI "rendering". No problem. Again taking *actual real figures*, I got roughly 35-40tps in PostgreSQL across a LAN. That's around about the 25ms figure you're working with, so let's use that as a baseline. My benchmark was actually a durability test from work, which was done on two laptops on a gigabit LAN, with the database server brutally powered down in the middle of the test. Each transaction updates a minimum of two rows in a minimum of one table (transaction content is randomized some). So that's 25ms for the database, leaving us 25ms for the rest. > 25ms for client-server (pgsql) network protocol, client-side > application logic *and* GUI. > > With a "web" application that would have to include "application > server"-side application logic, *and* generation of HTML (and > javascript), *and* HTTP protocol *and* HTML "rendering" *and* > client-side javascript. > > Won't work. I've demonstrated already that with basic hardware and a simple Python HTTP server, network, application logic, and generation of HTML, all take a total of 8ms. That leaves 17ms for rendering HTML. Now, getting figures for the rendering of HTML is not easy; I've just spent fifteen minutes researching on Google and playing with the Firebug-like feature of Chrome, and haven't come up with an answer; so it may well be that 17ms isn't enough for a full page load. However, I would say that the matter is sufficiently borderline (bearing in mind that you can always use a tiny bit of JS and a DOM change) that it cannot be called as "Won't work"; it's what Mythbusters would dub "Plausible". Of course, if you're trying to support MS IE, there's no way you'll guarantee <50ms response time. This is all predicated on having at least reasonably decent hardware and software. But using either the 100ms figure from common usability guidelines [1] [2] [3] or your more stringent 50ms requirement [4], it's certainly entirely possible to achieve immediate response using AJAX. I've worked with real figures, hard numbers. You keep coming back with vague FUD that it "won't work". Where are your numbers? And like Sir Ruthven Murgatroyd, I fail to see how you can call this impossible in the face of the fact that I have done it. ChrisA [1] http://www.nngroup.com/articles/response-times-3-important-limits/ [2] http://usabilitygeek.com/14-guidelines-for-web-site-tabs-usability/#attachment_719 [3] http://calendar.perfplanet.com/2011/how-response-times-impact-business/ [4] Can you provide a link to any study anywhere that recommends 50ms? From robert.kern at gmail.com Wed Jun 12 09:14:43 2013 From: robert.kern at gmail.com (Robert Kern) Date: Wed, 12 Jun 2013 14:14:43 +0100 Subject: Simple algorithm question - how to reorder a sequence economically In-Reply-To: References: <519f4661$0$6599$c3e8da3$5496439d@news.astraweb.com> <0065152b-16ac-4ce9-8e99-3d0b8e88a31f@fv8g2000vbb.googlegroups.com> Message-ID: On 2013-05-24 14:43, Chris Angelico wrote: > On Fri, May 24, 2013 at 11:23 PM, Peter Brooks > wrote: >> Actually, thinking about >> it, there is probably a source of non-algorithmically-derived 'random' >> numbers somewhere on the net that would do the job nicely. > > True entropy is usually provided by a source such as /dev/random (on > Unix systems). It's sometimes referred to as "cryptographic" > randomness, due to its necessity in secure encryption work. There are > various ways to get this in a cross-platform way. os.random() and os.urandom(), particularly. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From rosuav at gmail.com Wed Jun 12 16:50:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 06:50:02 +1000 Subject: Python Magazine In-Reply-To: References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com> <51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com> <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com> <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com> Message-ID: On Sun, May 26, 2013 at 3:44 PM, Carlos Nepomuceno wrote: > I've been told that in California it is really illegal to block IP addresses without a court order. Any Californians available to confirm that? > > "The sender of information over the Internet is the "owner" of both the information and the IP address attached to the information. ... " > > Source: http://im-from-missouri.blogspot.com.br/2007/05/ip-address-blocking-is-illegal-in.html Way late responding to this (Carlos, I think it's a whole pile of your posts that are only just coming through), but this is patently false. The sender of information is NOT the owner of the IP address. IANA does not sell IP addresses, it allocates them. There is nothing *owned*. This became significant last year when IPv4 depletion made the netblock market wake up dramatically; while it *is* acceptable for money to change hands as part of a netblock transfer arrangement, those IP addresses are *not* a saleable item per se, and transfers *must* be approved by IANA. (For instance, if you own a /28 out of a /8 assigned to APNIC, you can't sell that to someone in Europe, because that would make a mess of core routing tables. Allocations to the five RIRs are always on the basis of /8 blocks.) The Californian legislators can't change that any more than they can legislate that one of their citizens owns Alpha Centauri. ChrisA From carlosnepomuceno at outlook.com Sat Jun 1 04:15:06 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sat, 1 Jun 2013 11:15:06 +0300 Subject: Python Magazine In-Reply-To: <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com>, , , , , <51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com>, , <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com>, , <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com>, , , , , <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> Message-ID: ---------------------------------------- > Date: Fri, 31 May 2013 04:11:06 -0700 > Subject: Re: Python Magazine > From: rama29065 at gmail.com > To: python-list at python.org > > Hello all, > Was busy with work. Finally finished the job of registering the domain name. > Will be live soon. The url is http://pythonmagazine.org. Hope we will be live soon. > Regards, > DRJ. > -- > http://mail.python.org/mailman/listinfo/python-list Nice! Wish you luck! Do you have sponsors? Advertisers? What's the plan? From jonas at geiregat.org Sat Jun 1 06:24:16 2013 From: jonas at geiregat.org (Jonas Geiregat) Date: Sat, 1 Jun 2013 12:24:16 +0200 Subject: Python Magazine In-Reply-To: <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com> <51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com> <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com> <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com> <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> Message-ID: <53EBBFE3-F2AD-4E7D-93BB-222FA893CF0C@geiregat.org> On 31 May 2013, at 13:11, DRJ Reddy wrote: > Hello all, > Was busy with work. Finally finished the job of registering the domain name. > Will be live soon. The url is http://pythonmagazine.org. Hope we will be live soon. I was surprised when I saw it is running on ASP.NET, can this be ? Server: Microsoft-IIS/7.0 Vary: Accept-Encoding X-Pingback: http://pythonmagazine.org/xmlrpc.php X-Powered-By: ASP.NET -------------- next part -------------- An HTML attachment was scrubbed... URL: From rama29065 at gmail.com Wed Jun 5 03:37:53 2013 From: rama29065 at gmail.com (DRJ Reddy) Date: Wed, 5 Jun 2013 00:37:53 -0700 (PDT) Subject: Python Magazine In-Reply-To: References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com>,> , > , > , > , > <51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com>, > , > <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com>, > , > <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com>, > , > , > , > , > <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> Message-ID: <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> On Saturday, June 1, 2013 1:45:06 PM UTC+5:30, Carlos Nepomuceno wrote: > Nice! Wish you luck! > > Do you have sponsors? Advertisers? What's the plan? Thanks Carlos, Right now we haven't engaged with sponsors or advertisers. Thinking whether to have a community magazine or go with the same way as previous ones some sort of commercialization. From carlosnepomuceno at outlook.com Wed Jun 5 08:20:25 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 15:20:25 +0300 Subject: Python Magazine In-Reply-To: <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com>, >, , , > , >,,,> , >,<51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com>,,> , >,<7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com>,,> , >,<8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com>,,> , >, , >,,,> , >, <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com>, , <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> Message-ID: > Date: Wed, 5 Jun 2013 00:37:53 -0700 > Subject: Re: Python Magazine > From: rama29065 at gmail.com [...] > > Do you have sponsors? Advertisers? What's the plan? > Thanks Carlos, > Right now we haven't engaged with sponsors or advertisers. Thinking whether to have a community magazine or go with the same way as previous ones some sort of commercialization. Do you have other magazines? Which ones? How are you going to supply contents? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rama29065 at gmail.com Wed Jun 5 12:17:34 2013 From: rama29065 at gmail.com (DRJ Reddy) Date: Wed, 5 Jun 2013 09:17:34 -0700 (PDT) Subject: Python Magazine In-Reply-To: References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com>, >,> , , > , > <, , , > , > <,<51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com>,,> , > <, <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com>, , > , > <, <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com>, , > , > <, , > <, , , > , > <, <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com>,> , > <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> Message-ID: > Do you have other magazines? Which ones? How are you going to supply contents? We don't have other magazines. I was referring to old python magazines which terminated now. Portable documents(PDF , EPUB or MOBI) for now is being planned. Regards, DRJ. From rosuav at gmail.com Wed Jun 5 13:52:13 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 03:52:13 +1000 Subject: Python Magazine In-Reply-To: References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com> <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com> <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com> <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 2:17 AM, DRJ Reddy wrote: > >> Do you have other magazines? Which ones? How are you going to supply contents? > > We don't have other magazines. I was referring to old python magazines which terminated now. Portable documents(PDF , EPUB or MOBI) for now is being planned. The real problem is the ongoing supply of content. If you can publish on a regular schedule (weekly?) with interesting content, you'll have a highly successful magazine... but if you have to provide all that content yourself, you'll burn out. Try to line up a couple of backup writers or columnists to help out - and no, I'm not offering, I have way too much happening already :) Though the number of words I've typed into python-list today would probably be enough for a month's worth of newsletters... Let's have more of these threads that are actually Python-related! ChrisA From rama29065 at gmail.com Thu Jun 6 01:01:52 2013 From: rama29065 at gmail.com (DRJ Reddy) Date: Wed, 5 Jun 2013 22:01:52 -0700 (PDT) Subject: Python Magazine In-Reply-To: References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com> <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com> <8f19e20c-4f77-43dc-a732-4169e482d2b2@googlegroups.com> <29be50bf-b77c-4450-9d7c-026bfaf7fe89@googlegroups.com> <93c0dff4-6d63-4e7d-981f-e3bff9dddae9@googlegroups.com> Message-ID: <95f13512-877b-4171-b255-d1ff5c02b35a@googlegroups.com> > The real problem is the ongoing supply of content. If you can publish > > on a regular schedule (weekly?) with interesting content, you'll have > > a highly successful magazine... but if you have to provide all that > > content yourself, you'll burn out. Try to line up a couple of backup > > writers or columnists to help out - and no, I'm not offering, I have > > way too much happening already :) Though the number of words I've > > typed into python-list today would probably be enough for a month's > > worth of newsletters... > > > > Let's have more of these threads that are actually Python-related! > > > > ChrisA Dear ChrisA, Currently we are a team of three. We are planning to have contect categorized into topics like ? Some application made of python(command line program or a GUI program) that we make using a python module(planning to cover as many modules as possible) ie; of included batteries of python. ? Python in Security ie; Some scripts that we can write in python like a dictionary attack tool ? One for covering Tkinter. ? One small Game using python. ? Python Facts,Python Quotes, Python PersonalitY (a python personnel bio or an interview), Python video(about a python video from Python Conferences) ? Python articles Guest as well as our own. ? Python Tutorials. ? Python Place( A place where python is being used for production). ? If we are not overloading magazine we would also cover about Python tools like say Ninja-IDE(an IDE for Python extensively written in Python). After a few days we are planning to cover ? Python in cloud.(Open Stack) ? Network Programming.(probably Twisted framework) ? Database programming with SQLite. ? Python Puzzles(some programming Questions). ? Python Webframework probably Django. We welcome further suggestions from the community. Regards, DRJ and Team. From dihedral88888 at gmail.com Sat Jun 1 11:08:26 2013 From: dihedral88888 at gmail.com (88888 Dihedral) Date: Sat, 1 Jun 2013 08:08:26 -0700 (PDT) Subject: Python Magazine In-Reply-To: <51a18686$0$30002$c3e8da3$5496439d@news.astraweb.com> References: <27969350-4dd8-4afa-881a-b4a2364b3cf1@googlegroups.com> <51a0caac$0$30002$c3e8da3$5496439d@news.astraweb.com> <7cd17be8-d455-4db8-b8d0-ccc757db5cff@googlegroups.com> <51a18686$0$30002$c3e8da3$5496439d@news.astraweb.com> Message-ID: Steven D'Aprano? 2013?5?26????UTC+8??11?50?31???? > On Sat, 25 May 2013 21:54:43 -0400, Roy Smith wrote: > > > > > Of course not every IPv6 endpoint will be able to talk to every other > > > IPv6 endpoint, even if the both have globally unique addresses. But, > > > the access controls will be implemented in firewalls with appropriately > > > coded security policies. > > > > Or, more likely, *not* implemented in firewalls with *inappropriately* > > coded security policies. > > > > > > > > -- > > Steven Well, both the reliabl tcpip socket and the unstable udp socket are supported in Python. Aso the html and xml part is supported for the dirct web page content analysis through port 80. I am not sure whether Steven is interested in the web applictions. From carlosnepomuceno at outlook.com Mon Jun 3 18:34:57 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 01:34:57 +0300 Subject: Source code as text/plain In-Reply-To: <20130602230646.GA17969@cskk.homeip.net> References: , <20130602230646.GA17969@cskk.homeip.net> Message-ID: ---------------------------------------- > Date: Mon, 3 Jun 2013 09:06:46 +1000 > From: cs at zip.com.au > To: clp2 at rebertia.com [...] > http://hg.python.org/cpython/raw-file/tip/Lib/string.py What's the 'tip' tag? From andipersti at gmail.com Tue Jun 4 11:51:08 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Tue, 04 Jun 2013 17:51:08 +0200 Subject: Source code as text/plain In-Reply-To: References: , <20130602230646.GA17969@cskk.homeip.net> Message-ID: <51AE0CEC.8030303@gmail.com> On 04.06.2013 00:34, Carlos Nepomuceno wrote: > ---------------------------------------- >> Date: Mon, 3 Jun 2013 09:06:46 +1000 >> From: cs at zip.com.au >> To: clp2 at rebertia.com > [...] >> http://hg.python.org/cpython/raw-file/tip/Lib/string.py > > What's the 'tip' tag? > http://hg.python.org/cpython/help/tip Bye, Andreas From carlosnepomuceno at outlook.com Tue Jun 4 14:34:03 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 21:34:03 +0300 Subject: Source code as text/plain In-Reply-To: <51AE0CEC.8030303@gmail.com> References: , , <20130602230646.GA17969@cskk.homeip.net>, , <51AE0CEC.8030303@gmail.com> Message-ID: Thank you! > Date: Tue, 4 Jun 2013 17:51:08 +0200 > From: andipersti at gmail.com > To: python-list at python.org > Subject: Re: Source code as text/plain > > On 04.06.2013 00:34, Carlos Nepomuceno wrote: > > ---------------------------------------- > >> Date: Mon, 3 Jun 2013 09:06:46 +1000 > >> From: cs at zip.com.au > >> To: clp2 at rebertia.com > > [...] > >> http://hg.python.org/cpython/raw-file/tip/Lib/string.py > > > > What's the 'tip' tag? > > > http://hg.python.org/cpython/help/tip > > Bye, Andreas > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosnepomuceno at outlook.com Sat Jun 1 03:23:25 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sat, 1 Jun 2013 10:23:25 +0300 Subject: Short-circuit Logic In-Reply-To: <51a86319$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <5f101d70-e51f-4531-9153-c92ee2486fd9@googlegroups.com>, <51a1fc7b$0$30002$c3e8da3$5496439d@news.astraweb.com>, <2abf4e9c-8c3b-4e2f-80c9-50c1f1d75c9d@googlegroups.com>, <51a4b5a1$0$29966$c3e8da3$5496439d@news.astraweb.com>, <04b90c02-833a-4bad-88ad-ab71178b8f79@googlegroups.com>, <48519aa0-d0cd-4ffc-a2f5-2107465321d8@qn4g2000pbc.googlegroups.com>, , <51a6b969$0$29966$c3e8da3$5496439d@news.astraweb.com>, , <51a6e6b8$0$11118$c3e8da3@news.astraweb.com>, , <51a8318e$0$29966$c3e8da3$5496439d@news.astraweb.com>, , <51a86319$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: ---------------------------------------- > From: steve+comp.lang.python at pearwood.info > Subject: Re: Short-circuit Logic > Date: Fri, 31 May 2013 08:45:13 +0000 > To: python-list at python.org > > On Fri, 31 May 2013 17:09:01 +1000, Chris Angelico wrote: > >> On Fri, May 31, 2013 at 3:13 PM, Steven D'Aprano >> wrote: >>> What makes you think that the commutative law is relevant here? >>> >>> >> Equality should be commutative. If a == b, then b == a. Also, it's >> generally understood that if a == c and b == c, then a == b, though >> there are more exceptions to that (especially in loosely-typed >> languages). > > Who is talking about equality? Did I just pass through the Looking Glass > into Wonderland again? *wink* > > We're talking about *approximate equality*, which is not the same thing, > despite the presence of the word "equality" in it. It is non-commutative, > just like other comparisons like "less than" and "greater than or equal > to". Nobody gets their knickers in a twist because the>= operator is non- > commutative. Approximately equality CAN be commutative! I have just showed you that in the beginning using the following criteria: |v-u| <= ?*max(|u|,|v|) Which is implemented as fpc_aeq(): def fpc_aeq(u,v,eps=sys.float_info.epsilon): ??? au=abs(u) ??? av=abs(v) ??? return abs(v-u) <= (eps*(au if au>av else av))? # |v-u| <= ?*max(|u|,|v|) > Approximate equality is not just non-commutative, it's also intransitive. > I'm reminded of a story about Ken Iverson, the creator of APL. Iverson > was a strong proponent of what he called "tolerant equality", and APL > defined the = operator as a relative approximate equal, rather than the > more familiar exactly-equal operator most programming languages use. > > In an early talk Ken was explaining the advantages of tolerant > comparison. A member of the audience asked incredulously, > ?Surely you don?t mean that when A=B and B=C, A may not equal C?? > Without skipping a beat, Ken replied, ?Any carpenter knows that!? > and went on to the next question. ? Paul Berry That's true! But it's a consequence of floating points (discretes representing a continuous set -- real numbers). Out of context, as you put it, looks like approximate equality is non-commutative, but that's wrong. Did you read the paper[1] you have suggested? Because SHARP APL in fact uses the same criteria I have mentioned and it supports it extensively to the point of applying it by default to many primitive functions, according to Lathwell[2] wich is reference 19 of [1]. "less than ??? ???????????? ab not equal ??? ??? ????????? a?b floor ??? ????????????????? ?a ceiling ??? ??????????????? ?a membership ??? ???????????? a?b index of ??? ?????????????? a?b" I'll quote Lathwell. He called "tolerant comparison" what we are now calling "approximate equality". "Tolerant comparison considers two numbers to be equal if they are within some neighborhood. The neighborhood has a radius of ?ct times the larger of the two in absolute value." He says "larger of the two" which means "max(|u|,|v|)". So, you reference just reaffirms what TAOCP have demonstrated to be the best practice. I really don't know what the fuck you are arguing about? Can you show me at least one case where the commutative law wouldn't benefit the use of the approximate equality operator? [1] http://www.jsoftware.com/papers/APLEvol.htm [2] http://www.jsoftware.com/papers/satn23.htm > The intransitivity of [tolerant] equality is well known in > practical situations and can be easily demonstrated by sawing > several pieces of wood of equal length. In one case, use the > first piece to measure subsequent lengths; in the second case, > use the last piece cut to measure the next. Compare the lengths > of the two final pieces. > ? Richard Lathwell, APL Comparison Tolerance, APL76, 1976 > > See also here: > > http://www.jsoftware.com/papers/APLEvol.htm > > (search for "fuzz" or "tolerance". > > > > -- > Steven > -- > http://mail.python.org/mailman/listinfo/python-list From mok-kong.shen at t-online.de Sun Jun 2 15:09:14 2013 From: mok-kong.shen at t-online.de (Mok-Kong Shen) Date: Sun, 02 Jun 2013 21:09:14 +0200 Subject: Output from to_bytes In-Reply-To: References: Message-ID: Am 28.05.2013 17:35, schrieb Grant Edwards: > On 2013-05-26, Mok-Kong Shen wrote: >> I don't understand why with the code: >> >> for k in range(8,12,1): >> print(k.to_bytes(2,byteorder='big')) >> >> one gets the following output: >> >> b'\x00\x08' >> b'\x00\t' >> b'\x00\n' >> b'\x00\x0b' >> >> I mean the 2nd and 3rd should be b'\x00\x09' and b'x00\x0a'. >> Anyway, how could I get the output in the forms I want? > > Well, it would help if you told us what output form you want. As I stated, I like the 2nd and 3rd be b'\x00\x09' and b'\x00\x0a' respectively. This is what would expeacted to be in a hexadecimal notation IMHO in other PLs. M. K. Shen From ned at nedbatchelder.com Sun Jun 2 18:18:07 2013 From: ned at nedbatchelder.com (Ned Batchelder) Date: Sun, 02 Jun 2013 18:18:07 -0400 Subject: Output from to_bytes In-Reply-To: References: Message-ID: <51ABC49F.6000406@nedbatchelder.com> On 6/2/2013 3:09 PM, Mok-Kong Shen wrote: > Am 28.05.2013 17:35, schrieb Grant Edwards: >> On 2013-05-26, Mok-Kong Shen wrote: >>> I don't understand why with the code: >>> >>> for k in range(8,12,1): >>> print(k.to_bytes(2,byteorder='big')) >>> >>> one gets the following output: >>> >>> b'\x00\x08' >>> b'\x00\t' >>> b'\x00\n' >>> b'\x00\x0b' >>> >>> I mean the 2nd and 3rd should be b'\x00\x09' and b'x00\x0a'. >>> Anyway, how could I get the output in the forms I want? >> >> Well, it would help if you told us what output form you want. > > As I stated, I like the 2nd and 3rd be b'\x00\x09' and b'\x00\x0a' > respectively. This is what would expeacted to be in a hexadecimal > notation IMHO in other PLs. > When you print bytes, Python doesn't use "hexadecimal notation." It prints a Python bytes literal. That literal will use printable characters like 'Q', or hex escapes like '\x00', or other escapes like '\n', depending on the character. If you want hex output, you have to create it yourself, for example with the binascii module. --Ned. > M. K. Shen > From joshua.landau.ws at gmail.com Sat Jun 1 13:16:05 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Sat, 1 Jun 2013 18:16:05 +0100 Subject: Cutting a deck of cards In-Reply-To: <4286e1af-f97c-4111-ab3d-cdf2e2fa5fa8@googlegroups.com> References: <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com> <4286e1af-f97c-4111-ab3d-cdf2e2fa5fa8@googlegroups.com> Message-ID: On 31 May 2013 12:56, Lee Crocker wrote: > Why on Earth would you want to? "Cutting" a deck makes no sense in software. Randomize the deck properly (Google "Fisher-Yates") and start dealing. Cutting the deck will not make it any more random, True > and in fact will probably make it worse depending on how you choose the cutpoint. I'm pretty sure it won't. Otherwise you'd be lowering entropy by doing a random thing to a random thing. From leedanielcrocker at gmail.com Sun Jun 2 01:57:03 2013 From: leedanielcrocker at gmail.com (Lee Crocker) Date: Sat, 1 Jun 2013 22:57:03 -0700 (PDT) Subject: Cutting a deck of cards In-Reply-To: References: <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com> <4286e1af-f97c-4111-ab3d-cdf2e2fa5fa8@googlegroups.com> Message-ID: <2be353cb-d97b-4175-84f2-49c565976325@googlegroups.com> >> and in fact will probably make it worse depending on how you choose >> the cutpoint. > I'm pretty sure it won't. Otherwise you'd be lowering entropy by doing > a random thing to a random thing. Doing a random thing to a random thing usually *does* lower entropy when the "random" things are actually deterministic algorithms that may have unexpected correlations. That's why you don't write your own PRNG unless you have a very good understanding of the math. If you are shuffling the deck with, say, numbers from random.org (which uses atmospheric noise), then cutting the deck afterward will have precisely 0 effect, since the (51 * 52!) possible outcomes include 51 copies of each of the 52! orderings, and so the odds of each end up the same. But if you're choosing the cutpoint by getting a value from the same PRNG you used to shuffle, there might very well be a correlation that makes some arrangements more likely than others. From giorgos.tzampanakis at gmail.com Sat Jun 1 10:58:55 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Sat, 1 Jun 2013 14:58:55 +0000 (UTC) Subject: Cutting a deck of cards References: <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com> Message-ID: On 2013-05-26, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * decks)) > random.shuffle(cards) > > So now I have an array of cards. I would like to cut these cards at some > random point (between 1 and 13 * 4 * decks - 1, moving the lower half of > that to the top half of the cards array. > > For some reason, I can't see how this can be done (I know that it must > be a simple line or two in Python, but I am really stuck here). Anyone > have any direction they can give me on this? Thanks, RVic, python newbie > The slice notation should be your friend here: random.shuffle(cards) cut_point = random.choice(xrange(len(cards))) cards = cards[cut_point :] + cards[: cut_point] -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ From mok-kong.shen at t-online.de Sun Jun 2 15:25:45 2013 From: mok-kong.shen at t-online.de (Mok-Kong Shen) Date: Sun, 02 Jun 2013 21:25:45 +0200 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: Am 30.05.2013 21:22, schrieb Ned Batchelder: > > On 5/30/2013 2:26 PM, Mok-Kong Shen wrote: >> Am 27.05.2013 17:30, schrieb Ned Batchelder: >>> On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: >>>> From an int one can use to_bytes to get its individual bytes, >>>> but how can one reconstruct the int from the sequence of bytes? >>>> >>> The next thing in the docs after int.to_bytes is int.from_bytes: >>> http://docs.python.org/3.3/library/stdtypes.html#int.from_bytes >> >> I am sorry to have overlooked that. But one thing I yet wonder is why >> there is no direct possibilty of converting a byte to an int in [0,255], >> i.e. with a constrct int(b), where b is a byte. >> > > Presumably you want this to work: > > >>> int(b'\x03') > 3 > > But you also want this to work: > > >>> int(b'7') > 7 > > These two interpretations are incompatible. If b'\x03' becomes 3, then > shouldn't b'\x37' become 55? But b'\x37' is b'7', and you want that to > be 7. b'7' is the byte with the character 7 in a certain code, so that's ok. In other PLs one assigns an int to a byte, with that int in either decimal notation or hexadecimal notation, or else one assigns a character to it, in which case it gets the value of the character in a certain code. What I don't yet understand is why Python is apprently different from other PLs in that point in not allowing direct coersion of a byte to an int. M. K. Shen From rosuav at gmail.com Sun Jun 2 15:54:11 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 05:54:11 +1000 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On Mon, Jun 3, 2013 at 5:25 AM, Mok-Kong Shen wrote: > b'7' is the byte with the character 7 in a certain code, so that's > ok. In other PLs one assigns an int to a byte, with that int in either > decimal notation or hexadecimal notation, or else one assigns a > character to it, in which case it gets the value of the character > in a certain code. What I don't yet understand is why Python is > apprently different from other PLs in that point in not allowing direct > coersion of a byte to an int. It does. Just subscript it: >>> b'7'[0] 55 ChrisA From invalid at invalid.invalid Mon Jun 3 10:31:45 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Mon, 3 Jun 2013 14:31:45 +0000 (UTC) Subject: How to get an integer from a sequence of bytes References: Message-ID: On 2013-06-03, Dennis Lee Bieber wrote: > On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen > declaimed the following in > gmane.comp.python.general: > > >> b'7' is the byte with the character 7 in a certain code, so that's >> ok. In other PLs one assigns an int to a byte, with that int in either > > In other languages "byte" is an 8-bit signed/unsigned numeric. That's a common assumption, but historically, a "byte" was merely the smallest addressable unit of memory. The size of a "byte" on widely used used CPUs ranged from 4 bits to 60 bits. Quoting from http://en.wikipedia.org/wiki/Byte "The size of the byte has historically been hardware dependent and no definitive standards existed that mandated the size." That's why IEEE standards always use the word "octet" when referring a value containing 8 bits. Only recently has it become common to assume that an "byte" contains 8 bits. -- Grant Edwards grant.b.edwards Yow! It's a lot of fun at being alive ... I wonder if gmail.com my bed is made?!? From d at davea.name Mon Jun 3 18:07:41 2013 From: d at davea.name (Dave Angel) Date: Mon, 03 Jun 2013 18:07:41 -0400 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: <51AD13AD.20203@davea.name> On 06/03/2013 10:31 AM, Grant Edwards wrote: > On 2013-06-03, Dennis Lee Bieber wrote: >> On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen >> declaimed the following in >> gmane.comp.python.general: >> >> >>> b'7' is the byte with the character 7 in a certain code, so that's >>> ok. In other PLs one assigns an int to a byte, with that int in either >> >> In other languages "byte" is an 8-bit signed/unsigned numeric. > > That's a common assumption, but historically, a "byte" was merely the > smallest addressable unit of memory. The size of a "byte" on widely > used used CPUs ranged from 4 bits to 60 bits. > I recall rewriting the unpacking algorithm to get the 10 characters from each byte, on such a machine. -- DaveA From invalid at invalid.invalid Mon Jun 3 18:34:04 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Mon, 3 Jun 2013 22:34:04 +0000 (UTC) Subject: How to get an integer from a sequence of bytes References: Message-ID: On 2013-06-03, Dave Angel wrote: > On 06/03/2013 10:31 AM, Grant Edwards wrote: >> On 2013-06-03, Dennis Lee Bieber wrote: >>> On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen >>> declaimed the following in >>> gmane.comp.python.general: >>> >>> >>>> b'7' is the byte with the character 7 in a certain code, so that's >>>> ok. In other PLs one assigns an int to a byte, with that int in either >>> >>> In other languages "byte" is an 8-bit signed/unsigned numeric. >> >> That's a common assumption, but historically, a "byte" was merely the >> smallest addressable unit of memory. The size of a "byte" on widely >> used used CPUs ranged from 4 bits to 60 bits. >> > > I recall rewriting the unpacking algorithm to get the 10 > characters from each byte, on such a machine. Yep. IIRC there were CDC machines (Cyber 6600?) with a 60-bit wide "byte" and a 6-bit wide upper-case-only character set. ISTM that the Pascal compiler limited you to 6 significant characters in variable names so that it could use a simple single register compare while doing symbol lookups... I think some IBM machines had 60-bit "bytes" as well. -- Grant Edwards grant.b.edwards Yow! DIDI ... is that a at MARTIAN name, or, are we gmail.com in ISRAEL? From drsalists at gmail.com Mon Jun 3 18:41:41 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Mon, 3 Jun 2013 15:41:41 -0700 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On Mon, Jun 3, 2013 at 7:31 AM, Grant Edwards wrote: > That's a common assumption, but historically, a "byte" was merely the > smallest addressable unit of memory. The size of a "byte" on widely > used used CPUs ranged from 4 bits to 60 bits. > > Quoting from http://en.wikipedia.org/wiki/Byte > > "The size of the byte has historically been hardware > dependent and no definitive standards existed that mandated the > size." > > That's why IEEE standards always use the word "octet" when referring a > value containing 8 bits. > When I was a Freshman in college, I used a CDC Cyber a lot; it had 6 bit bytes and 60 bit words. This was in 1985. Today though, it would be difficult to sell a conventional (Von Neumann) computer that didn't have 8 bit bytes. Quantum computers would still sell if they were odd this way - they're going to be really different anyway. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosnepomuceno at outlook.com Mon Jun 3 19:18:53 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 02:18:53 +0300 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: , , , , , , , Message-ID: ________________________________ > Date: Mon, 3 Jun 2013 15:41:41 -0700 > Subject: Re: How to get an integer from a sequence of bytes > From: drsalists at gmail.com > To: python-list at python.org [...] > Today though, it would be difficult to sell a conventional (Von > Neumann) computer that didn't have 8 bit bytes. Quantum computers > would still sell if they were odd this way - they're going to be really > different anyway. Nowadays it would be a hard task to find a Von Neumann architecture machine. Most of current CPUs are variants of the Harvard architecture: they separate instructions from data at the cache level. From drsalists at gmail.com Mon Jun 3 19:47:26 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Mon, 3 Jun 2013 16:47:26 -0700 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On Mon, Jun 3, 2013 at 4:18 PM, Carlos Nepomuceno < carlosnepomuceno at outlook.com> wrote: > ________________________________ > > Date: Mon, 3 Jun 2013 15:41:41 -0700 > > Subject: Re: How to get an integer from a sequence of bytes > > From: drsalists at gmail.com > > To: python-list at python.org > [...] > > Today though, it would be difficult to sell a conventional (Von > > Neumann) computer that didn't have 8 bit bytes. Quantum computers > > would still sell if they were odd this way - they're going to be really > > different anyway. > > Nowadays it would be a hard task to find a Von Neumann architecture > machine. > > Most of current CPUs are variants of the Harvard architecture: they > separate instructions from data at the cache level. > I stand corrected. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From invalid at invalid.invalid Tue Jun 4 09:42:46 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Tue, 4 Jun 2013 13:42:46 +0000 (UTC) Subject: How to get an integer from a sequence of bytes References: Message-ID: On 2013-06-03, Carlos Nepomuceno wrote: > ________________________________ >> Date: Mon, 3 Jun 2013 15:41:41 -0700 >> Subject: Re: How to get an integer from a sequence of bytes >> From: drsalists at gmail.com >> To: python-list at python.org > [...] >> Today though, it would be difficult to sell a conventional (Von >> Neumann) computer that didn't have 8 bit bytes. Quantum computers >> would still sell if they were odd this way - they're going to be really >> different anyway. > > Nowadays it would be a hard task to find a Von Neumann architecture > machine. > > Most of current CPUs are variants of the Harvard architecture: they > separate instructions from data at the cache level. VN designs are still very common in smaller CPUs (embedded stuff). Even modern desktop CPUs are "logically" still Von Neumann designs from the programmer's point of view (there's only a single address space for both data and instructions). The fact that there are two sparate caches is almost entirely hidden from the user. If you start to do stuff like write self-modifying code, then _may_ start having to worry about cache coherency. -- Grant Edwards grant.b.edwards Yow! I request a weekend in at Havana with Phil Silvers! gmail.com From carlosnepomuceno at outlook.com Tue Jun 4 09:58:04 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 16:58:04 +0300 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: , , , , , , , , , Message-ID: > From: invalid at invalid.invalid > Subject: Re: How to get an integer from a sequence of bytes > Date: Tue, 4 Jun 2013 13:42:46 +0000 > To: python-list at python.org [...] > VN designs are still very common in smaller CPUs (embedded stuff). DSPs perhaps... not CPUs. Even ARMs are Harvard variants. > Even modern desktop CPUs are "logically" still Von Neumann designs > from the programmer's point of view (there's only a single address > space for both data and instructions). The fact that there are two > sparate caches is almost entirely hidden from the user. If you start > to do stuff like write self-modifying code, then _may_ start having to > worry about cache coherency. Code/data separation isn't the only aspect. VN architecture is totally serial, even for RAM. It's been a while since we've got into the multi-core, multipath world. Even in embedded devices. > -- > Grant Edwards grant.b.edwards Yow! I request a weekend in > at Havana with Phil Silvers! > gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From invalid at invalid.invalid Tue Jun 4 09:39:22 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Tue, 4 Jun 2013 13:39:22 +0000 (UTC) Subject: How to get an integer from a sequence of bytes References: Message-ID: On 2013-06-03, Dan Stromberg wrote: > On Mon, Jun 3, 2013 at 7:31 AM, Grant Edwards wrote: > >> That's a common assumption, but historically, a "byte" was merely the >> smallest addressable unit of memory. The size of a "byte" on widely >> used used CPUs ranged from 4 bits to 60 bits. >> >> Quoting from http://en.wikipedia.org/wiki/Byte >> >> "The size of the byte has historically been hardware >> dependent and no definitive standards existed that mandated the >> size." >> >> That's why IEEE standards always use the word "octet" when referring a >> value containing 8 bits. > > When I was a Freshman in college, I used a CDC Cyber a lot; it had 6 bit > bytes and 60 bit words. This was in 1985. But you couldn't address individual 6-bit "hextets" in memory could you? My recollection is that incrementing a memory address got you the next 60-bit chunk -- that means that by the older terminology a "byte" was 60 bits. A "character" was 6 bits, and a single register or memory location could hold 6 characters. > Today though, it would be difficult to sell a conventional (Von Neumann) > computer that didn't have 8 bit bytes. There are tons (as in millions of units per month) of CPUs still being sold in the DSP market with 16, 20, 24, and 32 bit "bytes". (When writing C on a TMS320Cxx CPU sizeof (char) == sizeof (int) == sizeof (long) == sizeof (float) == sizeof (double) == 1. They all contain 32 bits. > Quantum computers would still sell if they were odd this way - > they're going to be really different anyway. -- Grant Edwards grant.b.edwards Yow! Either CONFESS now or at we go to "PEOPLE'S COURT"!! gmail.com From joshua.landau.ws at gmail.com Tue Jun 4 15:51:35 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Tue, 4 Jun 2013 20:51:35 +0100 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On 4 June 2013 14:39, Grant Edwards wrote: > On 2013-06-03, Dan Stromberg wrote: >> Today though, it would be difficult to sell a conventional (Von Neumann) >> computer that didn't have 8 bit bytes. > > There are tons (as in millions of units per month) of CPUs still being > sold in the DSP market with 16, 20, 24, and 32 bit "bytes". (When > writing C on a TMS320Cxx CPU sizeof (char) == sizeof (int) == sizeof > (long) == sizeof (float) == sizeof (double) == 1. They all contain 32 > bits. ) *) for the bracket not in the reply Sorry. From rosuav at gmail.com Tue Jun 4 17:49:55 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 07:49:55 +1000 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On Wed, Jun 5, 2013 at 5:51 AM, Joshua Landau wrote: > On 4 June 2013 14:39, Grant Edwards wrote: >> On 2013-06-03, Dan Stromberg wrote: >>> Today though, it would be difficult to sell a conventional (Von Neumann) >>> computer that didn't have 8 bit bytes. >> >> There are tons (as in millions of units per month) of CPUs still being >> sold in the DSP market with 16, 20, 24, and 32 bit "bytes". (When >> writing C on a TMS320Cxx CPU sizeof (char) == sizeof (int) == sizeof >> (long) == sizeof (float) == sizeof (double) == 1. They all contain 32 >> bits. > ) > > *) for the bracket not in the reply > > Sorry. So... can we cite http://xkcd.com/859/ in two threads at once, or does that create twice as much tension? Once an XKCD is un-cited, will it be garbage collected promptly, or do they contain refloops? ChrisA From ian.g.kelly at gmail.com Tue Jun 4 18:34:20 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Tue, 4 Jun 2013 16:34:20 -0600 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On Tue, Jun 4, 2013 at 3:49 PM, Chris Angelico wrote: > So... can we cite http://xkcd.com/859/ in two threads at once, or does > that create twice as much tension? No, you just look at one of them upside-down, and then they cancel each other out. From timr at probo.com Wed Jun 5 01:11:37 2013 From: timr at probo.com (Tim Roberts) Date: Tue, 04 Jun 2013 22:11:37 -0700 Subject: How to get an integer from a sequence of bytes References: Message-ID: Grant Edwards wrote: >On 2013-06-03, Dan Stromberg wrote: >> >> When I was a Freshman in college, I used a CDC Cyber a lot; it had 6 bit >> bytes and 60 bit words. This was in 1985. > >But you couldn't address individual 6-bit "hextets" in memory could >you? My recollection is that incrementing a memory address got you >the next 60-bit chunk -- that means that by the older terminology a >"byte" was 60 bits. A "character" was 6 bits, and a single register >or memory location could hold 6 characters. A single machine word was 60 bits, so a single register read got you 10 characters. There were three sets of registers -- the X registers were 60 bits, the A and B registers were 18 bits, which was the size of the largest possible address. CDC didn't actually use the term "byte". That was IBM's domain. When ASCII became unavoidable, most programs changed to using 5x 12-bit "bytes" per word. Ah, memories. I spent 10 years working for Control Data. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Wed Jun 5 01:11:37 2013 From: timr at probo.com (Tim Roberts) Date: Tue, 04 Jun 2013 22:11:37 -0700 Subject: How to get an integer from a sequence of bytes References: Message-ID: Grant Edwards wrote: >On 2013-06-03, Dan Stromberg wrote: >> >> When I was a Freshman in college, I used a CDC Cyber a lot; it had 6 bit >> bytes and 60 bit words. This was in 1985. > >But you couldn't address individual 6-bit "hextets" in memory could >you? My recollection is that incrementing a memory address got you >the next 60-bit chunk -- that means that by the older terminology a >"byte" was 60 bits. A "character" was 6 bits, and a single register >or memory location could hold 6 characters. A single machine word was 60 bits, so a single register read got you 10 characters. There were three sets of registers -- the X registers were 60 bits, the A and B registers were 18 bits, which was the size of the largest possible address. CDC didn't actually use the term "byte". That was IBM's domain. When ASCII became unavoidable, most programs changed to using 5x 12-bit "bytes" per word. Ah, memories. I spent 10 years working for Control Data. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From fabiosantosart at gmail.com Wed Jun 12 10:00:52 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Wed, 12 Jun 2013 15:00:52 +0100 Subject: How to get an integer from a sequence of bytes In-Reply-To: References: Message-ID: On 5 Jun 2013 06:23, "Tim Roberts" wrote: > A single machine word was 60 bits, so a single register read got you 10 > characters. 10 characters! Now that sounds like it's enough to actually store a word. However long words can inadverten be cropped. -------------- next part -------------- An HTML attachment was scrubbed... URL: From invalid at invalid.invalid Wed Jun 12 10:42:26 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Wed, 12 Jun 2013 14:42:26 +0000 (UTC) Subject: How to get an integer from a sequence of bytes References: Message-ID: On 2013-06-12, F?bio Santos wrote: > On 5 Jun 2013 06:23, "Tim Roberts" wrote: >> A single machine word was 60 bits, so a single register read got you 10 >> characters. > > 10 characters! Now that sounds like it's enough to actually store a word. > However long words can inadverten be cropped. Only the first 10 characters in variable names were significant when you wrote Pascal programs (I don't remember if that was true for FORTRAN, but I bet it was). -- Grant Edwards grant.b.edwards Yow! I'm gliding over a at NUCLEAR WASTE DUMP near gmail.com ATLANTA, Georgia!! From timr at probo.com Fri Jun 14 01:27:23 2013 From: timr at probo.com (Tim Roberts) Date: Thu, 13 Jun 2013 22:27:23 -0700 Subject: How to get an integer from a sequence of bytes References: Message-ID: <3balr817vq1bfh6hug0cmr6rvi6mb991u7@4ax.com> F?bio Santos wrote: >On 5 Jun 2013 06:23, "Tim Roberts" wrote: >> A single machine word was 60 bits, so a single register read got you 10 >> characters. > >10 characters! Now that sounds like it's enough to actually store a word. >However long words can inadverten be cropped. Well, Cybers weren't often used for heavy text processing. Most of the time, a "word" was limited to 7 characters, so you could fit an 18-bit address in the bottom of the register. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From darcy at druid.net Wed Jun 12 09:51:18 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Wed, 12 Jun 2013 09:51:18 -0400 Subject: .mat files processing in Python In-Reply-To: <1369687416.80604.YahooMailNeo@web161705.mail.bf1.yahoo.com> References: <1369687416.80604.YahooMailNeo@web161705.mail.bf1.yahoo.com> Message-ID: <20130612095118.157605d0@imp> On Mon, 27 May 2013 13:43:36 -0700 (PDT) Romila Anamaria wrote: > I am beginner > in Python programming Are you a beginner in using the Internet too? You just sent a 2.69MB message to a mailing list. You shouldn't send huge files like that in email at all but especially not to a mailing list that gets archived. Please don't ever do that again. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From tjreedy at udel.edu Wed Jun 12 15:01:38 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 12 Jun 2013 15:01:38 -0400 Subject: .mat files processing in Python In-Reply-To: <1369687416.80604.YahooMailNeo@web161705.mail.bf1.yahoo.com> References: <1369687416.80604.YahooMailNeo@web161705.mail.bf1.yahoo.com> Message-ID: On 5/27/2013 4:43 PM, Romila Anamaria wrote: > I am beginner in Python programming and I want to make an application Please post plain test only, not html (with a font size too small to read ;-). Don't send attachments, especially not 2 MB files. -- Terry Jan Reedy From max at alcyone.com Sun Jun 2 19:57:02 2013 From: max at alcyone.com (Erik Max Francis) Date: Sun, 02 Jun 2013 16:57:02 -0700 Subject: Python #ifdef In-Reply-To: References: Message-ID: On 05/29/2013 08:05 AM, Chris Angelico wrote: > It's not a bad tool. I used it as a sort of PHP preprocessor, because > requirements at work had me wanting to have a source file defining a > PHP class and having an autogenerated section in the middle of that > class. PHP's 'include' directive doesn't work for that. Of course, had > we been using a better language, that wouldn't have been an issue (and > it stopped being an issue when we improved the design and stopped > using that class system, too, though I retained the makefile > directives about building .php.m4 -> .php files). But still, GNU M4 is > a decent piece of technology. Agreed. The terror that most people feel when hearing "m4" is because m4 was associated with sendmail, not because m4 was inherently awful. It has problems, but you'd only encounter them when doing something _very_ abstract. -- Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Jabber erikmaxfrancis Substance is one of the greatest of our illusions. -- Sir Arthur Eddington From roy at panix.com Sun Jun 2 20:23:14 2013 From: roy at panix.com (Roy Smith) Date: Sun, 02 Jun 2013 20:23:14 -0400 Subject: Python #ifdef References: Message-ID: In article , Erik Max Francis wrote: > On 05/29/2013 08:05 AM, Chris Angelico wrote: > > It's not a bad tool. I used it as a sort of PHP preprocessor, because > > requirements at work had me wanting to have a source file defining a > > PHP class and having an autogenerated section in the middle of that > > class. PHP's 'include' directive doesn't work for that. Of course, had > > we been using a better language, that wouldn't have been an issue (and > > it stopped being an issue when we improved the design and stopped > > using that class system, too, though I retained the makefile > > directives about building .php.m4 -> .php files). But still, GNU M4 is > > a decent piece of technology. > > Agreed. The terror that most people feel when hearing "m4" is because > m4 was associated with sendmail Arrrrggghhh. You had to go and dredge up those bad memories? I hadn't thought about sendmail config files in years. I'll probably never be able to get to sleep tonight. From skip.montanaro at gmail.com Sun Jun 2 20:29:17 2013 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Sun, 2 Jun 2013 19:29:17 -0500 Subject: Python #ifdef In-Reply-To: References: Message-ID: > The terror that most people feel when hearing "m4" is because m4 was associated with sendmail, not because m4 was inherently awful. In fact, m4 made sendmail configs easier to maintain. Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Sun Jun 2 22:05:49 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 12:05:49 +1000 Subject: Python #ifdef In-Reply-To: References: Message-ID: On Mon, Jun 3, 2013 at 9:57 AM, Erik Max Francis wrote: > On 05/29/2013 08:05 AM, Chris Angelico wrote: >> >> It's not a bad tool. I used it as a sort of PHP preprocessor, because >> requirements at work had me wanting to have a source file defining a >> PHP class and having an autogenerated section in the middle of that >> class. PHP's 'include' directive doesn't work for that. Of course, had >> we been using a better language, that wouldn't have been an issue (and >> it stopped being an issue when we improved the design and stopped >> using that class system, too, though I retained the makefile >> directives about building .php.m4 -> .php files). But still, GNU M4 is >> >> a decent piece of technology. > > > Agreed. The terror that most people feel when hearing "m4" is because m4 > was associated with sendmail, not because m4 was inherently awful. It has > problems, but you'd only encounter them when doing something _very_ > abstract. Ah. I actually wasn't aware of m4's use with sendmail. I first met it as the aforementioned PHP preprocessor, simply by Googling for something along the lines of "generic preprocessor". First hit solved my problems. ChrisA From carlosnepomuceno at outlook.com Mon Jun 3 18:18:14 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 01:18:14 +0300 Subject: Python #ifdef In-Reply-To: References: , , , , , Message-ID: ---------------------------------------- > Date: Mon, 3 Jun 2013 12:05:49 +1000 > Subject: Re: Python #ifdef > From: rosuav at gmail.com > To: python-list at python.org [...] > Ah. I actually wasn't aware of m4's use with sendmail. I first met it > as the aforementioned PHP preprocessor, simply by Googling for > something along the lines of "generic preprocessor". First hit solved > my problems. > > ChrisA Why didn't you use something like EZT[1]? [1] https://code.google.com/p/ezt/ From rosuav at gmail.com Wed Jun 12 16:42:22 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 06:42:22 +1000 Subject: Python #ifdef In-Reply-To: References: Message-ID: On Tue, Jun 4, 2013 at 8:18 AM, Carlos Nepomuceno wrote: > ---------------------------------------- >> Date: Mon, 3 Jun 2013 12:05:49 +1000 >> Subject: Re: Python #ifdef >> From: rosuav at gmail.com >> To: python-list at python.org > [...] >> Ah. I actually wasn't aware of m4's use with sendmail. I first met it >> as the aforementioned PHP preprocessor, simply by Googling for >> something along the lines of "generic preprocessor". First hit solved >> my problems. >> >> ChrisA > > Why didn't you use something like EZT[1]? > > [1] https://code.google.com/p/ezt/ I'm a bit behind getting to this; I think some python-list posts got stuck somewhere (maybe in the news->list gateway?). Anyway: The reason I didn't was simply that m4 came up first. I was familiar with the C preprocessor and PPWizard (which is designed for HTML), and simply went looking for a generic one. And yes, I had seriously contemplated using the C preprocessor (from gcc), but there was a reason not to (don't remember now, but I'm guessing it'll be the conflict between hash comments in PHP and hash directives to cpp). ChrisA From rustompmody at gmail.com Sat Jun 1 13:43:38 2013 From: rustompmody at gmail.com (rusi) Date: Sat, 1 Jun 2013 10:43:38 -0700 (PDT) Subject: Can anyone please help me in understanding the following python code References: <921173f3-21e7-46b4-a7b1-86660a3ebc72@googlegroups.com> Message-ID: <38d697bb-0c33-48e2-bf44-e10c15a168e4@fq2g2000pbb.googlegroups.com> On May 30, 2:48?pm, bhk... at gmail.com wrote: > Code : > ----- > def mergeSort(alist): > ? ? print("Splitting ",alist) > ? ? if len(alist)>1: > ? ? ? ? mid = len(alist)//2 > ? ? ? ? lefthalf = alist[:mid] > ? ? ? ? righthalf = alist[mid:] > > ? ? ? ? mergeSort(lefthalf) > ? ? ? ? mergeSort(righthalf) > > ? ? ? ? i=0 > ? ? ? ? j=0 > ? ? ? ? k=0 > ? ? ? ? while i ? ? ? ? ? ? if lefthalf[i] ? ? ? ? ? ? ? ? alist[k]=lefthalf[i] > ? ? ? ? ? ? ? ? i=i+1 > ? ? ? ? ? ? else: > ? ? ? ? ? ? ? ? alist[k]=righthalf[j] > ? ? ? ? ? ? ? ? j=j+1 > ? ? ? ? ? ? k=k+1 > > ? ? ? ? while i ? ? ? ? ? ? alist[k]=lefthalf[i] > ? ? ? ? ? ? i=i+1 > ? ? ? ? ? ? k=k+1 > > ? ? ? ? while j ? ? ? ? ? ? alist[k]=righthalf[j] > ? ? ? ? ? ? j=j+1 > ? ? ? ? ? ? k=k+1 > ? ? print("Merging ",alist) > > alist = [54,26,93,17,77,31,44,55,20] > mergeSort(alist) > print(alist) > > Output: > ------- > ('Splitting ', [54, 26, 93, 17, 77, 31, 44, 55, 20]) > ('Splitting ', [54, 26, 93, 17]) > ('Splitting ', [54, 26]) > ('Splitting ', [54]) > ('Merging ', [54]) > ('Splitting ', [26]) > ('Merging ', [26]) > ('Merging ', [26, 54]) > ('Splitting ', [93, 17]) > ('Splitting ', [93]) > ('Merging ', [93]) > ('Splitting ', [17]) > ('Merging ', [17]) > ('Merging ', [17, 93]) > ('Merging ', [17, 26, 54, 93]) > ('Splitting ', [77, 31, 44, 55, 20]) > ('Splitting ', [77, 31]) > ('Splitting ', [77]) > ('Merging ', [77]) > ('Splitting ', [31]) > ('Merging ', [31]) > ('Merging ', [31, 77]) > ('Splitting ', [44, 55, 20]) > ('Splitting ', [44]) > ('Merging ', [44]) > ('Splitting ', [55, 20]) > ('Splitting ', [55]) > ('Merging ', [55]) > ('Splitting ', [20]) > ('Merging ', [20]) > ('Merging ', [20, 55]) > ('Merging ', [20, 44, 55]) > ('Merging ', [20, 31, 44, 55, 77]) > ('Merging ', [17, 20, 26, 31, 44, 54, 55, 77, 93]) > [17, 20, 26, 31, 44, 54, 55, 77, 93] > > Question: > --------- > Function mergeSort is called only once, but it is getting recursively executed after the printing the last statement "print("Merging ",alist)". But don't recursion taking place except at these places "mergeSort(lefthalf), mergeSort(righthalf)" > > Sometimes the function execution directly starts from i=0,j=0,k=0 . Not sure how. > > Can anyone please help me out here? Not in direct answer to your question... Still see if this helps you to understand mergesorting better. I generally find that mixing recursion along with imperative programming makes recursion look difficult. Imperative programming goes scot-free and recursion gets a bad name!! So here is a pure recursive/functional solution. Tell me if you understand it better (or worse!!) Its written to demonstrate the IDEA of mergesort. Its actual efficiency is sub-par for various reasons. ------------------------------------- # merging two lists, both assumed sorted def merge(a,b): if a == []: return b elif b== []: return a elif a[0] < b[0]: return [a[0]] + merge(a[1:],b) else: return [b[0]] + merge(a,b[1:]) # The same as merge above written in pure functional style def merge1(a,b): return (b if a == [] else a if b == [] else [a[0]] + merge(a[1:],b) if a[0] < b[0] else [b[0]] + merge(a,b[1:]) ) def mergeSort(alist): if len(alist)>1: mid = len(alist)//2 lefthalf = alist[:mid] righthalf = alist[mid:] return merge1(mergeSort(lefthalf),mergeSort(righthalf) ) else: return alist From giorgos.tzampanakis at gmail.com Sat Jun 1 10:43:08 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Sat, 1 Jun 2013 14:43:08 +0000 (UTC) Subject: Python toplevel in a Web page References: Message-ID: On 2013-05-30, Franck Ditter wrote: > Hello, > I wonder if I can find some source code example > of a Python 3 toplevel box in a Web page. > Something simple, no mySQL, no Django hammer, etc. > Just the basics of the technology to get the > content of a small text editor in which the user > writes some Python script, to be analyzed (eval'ed) > then whose result is to be written in another text box. > Simple, pythonistic. > Thanks for the pointer, > > franck Just set up a webpage with a text area that sends its content as a POST request to the server where a cgi script will invoke python to run the script and respond with the output. Do you trust all possible users of this application? If not, you should make sure that the python interpreter is running in a sandbox. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ From giorgos.tzampanakis at gmail.com Sat Jun 1 09:23:54 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Sat, 1 Jun 2013 13:23:54 +0000 (UTC) Subject: How to Begin Web Development with Python ? References: Message-ID: Chitrank Dixit wrote: > Hello Python developers > > I have learnt python and used it for various purposes for scietific > computing using sage and GUI development using Tkinter and lots more. I > want to start web development using python My goal is to learn the web > development in python from the basic level and understand the big web > development projects like Django , MoinMoin Wiki , Plone and network > programming further with twisted. > > I have found Web2Py to be an easy library to quickly use and develop the > web application. Is there any other library to start my development with. > and > does my plan of learning Web2Py is good for Web development and getting > involved in the big projects like Django , MoinMoin Wiki , Plone. > I am largely in the same situation as you, i.e. I used Python mostly for scientific applications, using scipy. I wanted to create a website to publish my research (see my signature for the result, but keep in mind it's still work in progress!). I chose CherryPy as my web framework, largely because it's simple and gets out of the way. I have found that the documentation can be somewhat lacking in certain respects but overall it's very easy to do what you want. CherryPy does not specify a template library so I chose mako which is fast and very simple to use. The only problem I had with it was getting meaningful tracebacks when an exception was raised by the in-template code, but I was able to rectify it once I read the relevant documentation section carefully. Modulok suggested using ORM software. ORM should not really be needed if you are aiming at scientific content for your application, you should be fine with straight SQL (many consider ORM a hindrance rather than help for any project [1], [2]). But if you do find the need for ORM then SQLAlchemy is very good and is considered pretty much a de facto standard in the Python world. Good luck, and I'm sure comp.lang.python posters will be happy to help you with any problems you come across! [1] https://en.wikipedia.org/wiki/Object-relational_mapping#Controversy [2] http://goo.gl/ECNSp -- www.statsfair.com : Real (statistical) tennis and snooker player rankings and ratings. From modulok at gmail.com Sat Jun 1 18:16:21 2013 From: modulok at gmail.com (Modulok) Date: Sat, 1 Jun 2013 16:16:21 -0600 Subject: How to Begin Web Development with Python ? In-Reply-To: References: Message-ID: > > I have learnt python and used it for various purposes for scietific > > computing using sage and GUI development using Tkinter and lots more. I > > want to start web development using python My goal is to learn the web > > development in python from the basic level and understand the big web > > development projects like Django , MoinMoin Wiki , Plone and network > > programming further with twisted. > > > > I have found Web2Py to be an easy library to quickly use and develop the > > web application. Is there any other library to start my development with. > > and > > does my plan of learning Web2Py is good for Web development and getting > > involved in the big projects like Django , MoinMoin Wiki , Plone. > > > > Modulok suggested using ORM software. ORM should not really be needed if > you are aiming at scientific content for your application, you should > be fine with straight SQL (many consider ORM a hindrance rather than > help for any project [1], [2]). But if you do find the need for ORM > then SQLAlchemy is very good and is considered pretty much a de facto > standard in the Python world. > > Good luck, and I'm sure comp.lang.python posters will be happy to help > you with any problems you come across! > > [1] https://en.wikipedia.org/wiki/Object-relational_mapping#Controversy > [2] http://goo.gl/ECNSp > > > In SQLalchemy you can use straight SQL, or a database abstraction, or a full ORM depending on your needs. The full ORM scared me at first. It was over-complicated nonsense, black magic and I already had a background in SQL on a console. I knew the exact queries I wanted. I didn't need this technical obfuscation wedged between me and greatness. However the more I used it the more I started to like it. (Slowly!) It's kind of an acquired taste. It's not perfect for everything, but it's usually quite useful once you become comfortable with it. Even so there are some valid points made against them. The nice part about SQLalchemy over most other "orm" packages is it doesn't really care how high or low level you interact with your data. It supports them all. You can do a raw SQL query on a cursor if you want. If you need more, you can use the database abstraction. Or more still is setting up a full ORM. You're never locked into anything. The down side to SQLalchemy however it is a very large library to learn. There are books about it alone. For leaner requirements I use psycopg2, simply because I use postgresql as my data store and it's pretty much the pythyon/postgresql de-facto standard. Internally this is what SQLalchemy uses to access a postgresql database. If you're on MySQL or Oracle or whatever your low level package will be different. What you use depends on your preferred learning style: top-down or bottom-up. If you already know SQL the bottom-up approach of learning the low level lib will serve you well and you'll feel more immediately productive. Good luck! -Modulok- -------------- next part -------------- An HTML attachment was scrubbed... URL: From wuwei23 at gmail.com Sun Jun 2 22:40:06 2013 From: wuwei23 at gmail.com (alex23) Date: Sun, 2 Jun 2013 19:40:06 -0700 (PDT) Subject: How to Begin Web Development with Python ? References: Message-ID: On Jun 1, 11:23?pm, Giorgos Tzampanakis wrote: > Modulok suggested using ORM software. ORM should not really be needed if > you are aiming at scientific content for your application, you should > be fine with straight SQL (many consider ORM a hindrance rather than > help for any project ?[1], [2]). But if you do find the need for ORM > then SQLAlchemy is very good and is considered pretty much a de facto > standard in the Python world. SQLAlchemy isn't just an ORM, though. Even more compelling, to me, is its SQL Expression Language, which allows you to programmatically write SQL expressions in a cross-database compatible way. It makes it a lot easier to port your application to another database backend should it require it. I tend to start projects with a local instance of sqlite, for example, before migrating to PostGres/Oracle for production. From rustompmody at gmail.com Sat Jun 1 00:39:54 2013 From: rustompmody at gmail.com (rusi) Date: Fri, 31 May 2013 21:39:54 -0700 (PDT) Subject: Create a file in /etc/ as a non-root user References: <0e688580-c0fb-4caf-8fb1-f622b2c7bcb5@googlegroups.com> <4fc3af47-2dc4-4de1-9479-53741215c3a2@googlegroups.com> <042qt.10122$tu1.2940@fx20.am4> Message-ID: <35f61a44-2bde-4fd8-bf07-1d62d5901c64@jr6g2000pbb.googlegroups.com> On May 31, 7:42?pm, Chris Angelico wrote: > On Sat, Jun 1, 2013 at 12:02 AM, Alister wrote: > > /etc is used to store configuration files for the operating system & if > > you inadvertently corrupt the wrong one then you could kill the system. > > Expanding on this: > > http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard > > The FHS applies to Linux, but you'll find it close to what other > Unix-like OSes use too. Yes the FHS is a good center for such discussions. Let me expand on this a bit. I am going to use debian/ubuntu+apt because I know it a bit. You can substitute RH/Centos+yum or whatever... Modern linuxes are SOAs (service oriented architectures) or cloud architectures even if we dont like the buzzwords. This means that when I install debian/ubuntu on my personal computer there is some kind of contract-ing that goes on between me and debian. Some of it legal, some semi-legal some entirely informal/ conventional but still very important. Legal: For example it may be 'my very own computer' but if I take sources under a certain license and use them in violation of that license I could get into legal trouble. Semi-legal: Free and not-free software can coexist in ways that are at least legally nebulous Conventional: Debian must not use the machine (and file-system in particular) in ways that disrespect me. Note I am not talking of obvious legal gaffes like stealing my private data but of more 'conventional' problems like strewing my home directory with meaningless temporary files. Likewise: I MUST RESPECT Debian's AREA. For example I cant go messing about in /usr/bin [the name 'usr' is misleading and unfortunate] and expect support from debian. So $ sudo rm /usr/bin/foo is improper whereas $ sudo apt-get purge foo is proper. And its improper because you are not to mess around in debian's area -- except for officially approved channels like 'apt-get purge?' -- just as debian is not to mess around in yours. And writing into /etc constitutes messing with debian (or whatever is your distro). So yes, as Chris suggested read the FHS. And consider using a 'public-messable' area like /usr/local instead of /etc. Actually the situation is more complicated: the deal is not between just ordinary users like you/me and the distro. There's - ordinary users like you/me - packagers - the distro - upstream each with their own rights and responsibilities. What these are and how to navigate them is best discussed in your distro's fora eg http://forums.debian.net/ http://ubuntuforums.org/forum.php From denismfmcmahon at gmail.com Sat Jun 1 17:19:30 2013 From: denismfmcmahon at gmail.com (Denis McMahon) Date: Sat, 1 Jun 2013 21:19:30 +0000 (UTC) Subject: Create a file in /etc/ as a non-root user References: <0e688580-c0fb-4caf-8fb1-f622b2c7bcb5@googlegroups.com> Message-ID: On Fri, 31 May 2013 02:12:58 -0700, BIBHU DAS wrote: > Any Idea how to create a file in /etc as non-root user?Can i use umask > or chmod.......confused If you don't have root access, you probably shouldn't be trying to write in /etc. If you need to write in /etc, explain to the sysadmin why you need root access. -- Denis McMahon, denismfmcmahon at gmail.com From rustompmody at gmail.com Sat Jun 1 22:51:33 2013 From: rustompmody at gmail.com (rusi) Date: Sat, 1 Jun 2013 19:51:33 -0700 (PDT) Subject: Create a file in /etc/ as a non-root user References: <0e688580-c0fb-4caf-8fb1-f622b2c7bcb5@googlegroups.com> Message-ID: On Jun 2, 2:19?am, Denis McMahon wrote: > On Fri, 31 May 2013 02:12:58 -0700, BIBHU DAS wrote: > > Any Idea how to create a file in /etc as non-root user?Can i use umask > > or chmod.......confused > > If you don't have root access, you probably shouldn't be trying to write > in /etc. If you need to write in /etc, explain to the sysadmin why you > need root access. The OP is evidently working on a macbook pro. >From which I infer its his own personal notebook. So 'explain to the sysadmin' amounts to explain to oneself!! 40 years ago, on the first Unices, with machines millions of times weaker and costlier than today, 'sysadmin' and 'normal user' were usually different. Today they are usually the same. So we old Unix-heads need to change our explanations from 'explain to the sysadmin' to 'change hat from normal-user to superuser'. And then why simplifying life by having only one hat -- $ sudo bash # and do everything there is not such a good idea! To the OP: One thing that has not changed in 40 (or rather 60) years is the concept of binding times. eg C programmers cannot get off the ground if they do not distinguish compile-time from run-time. In the current context, it is probably good to distinguish system- admining time from system-use time. So as sysadmin, you can pretty much do as you please (though remember my comments earlier on respecting your distro's space), make a directory under /etc, chmod, chown, chgrp it to your taste, so that the (group of) ordinary users can write to it. And then in normal user mode you should be able to write to it. However... as I said above it may be preferable to use /usr/local (for programs) or /var (for data) rather than mess in /etc. [Think of /etc as windows' registry] Study the FHS to make the right choice. And finally, if you are the only guy involved, why are you not doing everything under $HOME? From ian.g.kelly at gmail.com Mon Jun 3 14:29:29 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Mon, 3 Jun 2013 12:29:29 -0600 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <98f99db1-d200-4291-a050-cbbb30290d4c@googlegroups.com> Message-ID: On May 31, 2013 6:27 PM, "Chris Angelico" wrote: > Yeah. I know that particular one because I have l aliased to ls -CF > (aka --columns --classify), mainly because it came that way as a > commented-out entry in my first Debian. Have since become quite > accustomed to it; to me, 'l' means 'look' (I do love my MUDs), so I'm > considering aliasing 'gl' to 'pwd' so that I can 'glance' too :) > > Hmm. What other MUD commands have obvious Unix equivalents? > > say --> echo > emote --> python -c > attack --> sudo rm -f Have you ever tried Adventure Shell? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Sun Jun 2 23:18:43 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 13:18:43 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <0164e853-5237-45b6-8ff5-7a1fdd2ca462@ua8g2000pbb.googlegroups.com> References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <98f99db1-d200-4291-a050-cbbb30290d4c@googlegroups.com> <0164e853-5237-45b6-8ff5-7a1fdd2ca462@ua8g2000pbb.googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 12:30 PM, alex23 wrote: > On Jun 1, 10:24 am, Chris Angelico wrote: >> Hmm. What other MUD commands have obvious Unix equivalents? >> >> say --> echo >> emote --> python -c >> attack --> sudo rm -f > > who --> who > tell --> write > alias --> ln > look --> cat > go --> cd > teleport --> pushd/popd ? I don't use an explicit 'go' though, I usually just type 'n' to go north, or 'booth1' to go booth1. Unfortunately that doesn't translate well into a simple alias :) Hey, if you like MUDs, why not come play D&D with us? minstrelhall.com port 221 - always looking for new players! ChrisA From joshua.landau.ws at gmail.com Mon Jun 3 07:26:38 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Mon, 3 Jun 2013 12:26:38 +0100 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <98f99db1-d200-4291-a050-cbbb30290d4c@googlegroups.com> <0164e853-5237-45b6-8ff5-7a1fdd2ca462@ua8g2000pbb.googlegroups.com> Message-ID: On 3 June 2013 04:18, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 12:30 PM, alex23 wrote: >> On Jun 1, 10:24 am, Chris Angelico wrote: >>> Hmm. What other MUD commands have obvious Unix equivalents? >>> >>> say --> echo >>> emote --> python -c >>> attack --> sudo rm -f >> >> who --> who >> tell --> write >> alias --> ln >> look --> cat >> go --> cd >> teleport --> pushd/popd ? > > I don't use an explicit 'go' though, I usually just type 'n' to go > north, or 'booth1' to go booth1. Unfortunately that doesn't translate > well into a simple alias :) What shell do you use? Zsh supports this (implicit cd). I don't have it active because it's not that useful - you get better completion with explicit cd - but it exists. From nikos.gr33k at gmail.com Sat Jun 1 01:35:05 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 31 May 2013 22:35:05 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> Message-ID: <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> ?? ???????, 1 ??????? 2013 3:15:22 ?.?. UTC+3, ? ??????? Dennis Lee Bieber ??????: > On Fri, 31 May 2013 08:20:54 -0700 (PDT), ???????????????????????? ?????????????????? > > declaimed the following in > > gmane.comp.python.general: > > > > > I'am using CentOS v6.4 on my VPS and hence 'yum' install manager and i just tried: > > > > > > Code: > > > root at nikos [~]# which python > > > /usr/bin/python > > > root at nikos [~]# which python3 > > > /root/.local/lib/python2.7/bin/python3 > > > root at nikos [~]# which python3.3 > > > /root/.local/lib/python2.7/bin/python3.3 > > > root at nikos [~]# > > > > I'd be concerned that those 3/3.3 entries are showing up in a 2.7 > > installation directory! > > > > Other than that, I'd see if some of those of softlinks (or even > > hardlinks) to another... That is: /usr/bin/python maybe links to your > > python3.3, and your python3 also links to the python3.3 -- meaning you > > really only have one Python in the 3.x branch (you didn't check for 2.x) > > -- > > Wulfraed Dennis Lee Bieber AF6VN > > wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/ Thats exactly my thoughts. Can you please tell me HOW TO GET RID OF ALL PYTHON SETUPS except 2.6 that is needed for system core and then just install 3.3.2? also why cant i install 3.3.2 using yum. if i could instead of building from source then i wouldn't have this installed mess but i could simply yum remove python* From rosuav at gmail.com Sat Jun 1 02:18:26 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 1 Jun 2013 16:18:26 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> Message-ID: On Sat, Jun 1, 2013 at 3:35 PM, ???????? ?????? wrote: > Can you please tell me HOW TO GET RID OF ALL PYTHON SETUPS except 2.6 that is needed for system core and then just install 3.3.2? Nuke the hard drive from orbit. It's the only way to be sure. > also why cant i install 3.3.2 using yum. if i could instead of building from source then i wouldn't have this installed mess but i could simply > yum remove python* That would require that the repo have a 3.3.2 build in it. I don't know the Red Hat / CentOS policies there, but I know Debian stable wouldn't have anything so new - it takes time to test things. ChrisA From nikos.gr33k at gmail.com Sat Jun 1 03:51:40 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 00:51:40 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> Message-ID: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > That would require that the repo have a 3.3.2 build in it. I don't > know the Red Hat / CentOS policies there, but I know Debian stable > wouldn't have anything so new - it takes time to test things. Is there a way to change to some repo that contain the latest python 3.3.2 to yo yum it? Do you advise me to have the peple that iam paiding the VPS to switch me from CentOS 6.4 to ubuntu or even better debian? From rosuav at gmail.com Sat Jun 1 04:00:03 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 1 Jun 2013 18:00:03 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> Message-ID: On Sat, Jun 1, 2013 at 5:51 PM, ???????? ?????? wrote: > ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >> That would require that the repo have a 3.3.2 build in it. I don't >> know the Red Hat / CentOS policies there, but I know Debian stable >> wouldn't have anything so new - it takes time to test things. > > Is there a way to change to some repo that contain the latest python 3.3.2 to yo yum it? > > Do you advise me to have the peple that iam paiding the VPS to switch me from CentOS 6.4 to ubuntu or even better debian? I advise you to follow the recommendations of the Matrix Oracle and make up . ChrisA From cs at zip.com.au Sat Jun 1 04:21:14 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 1 Jun 2013 18:21:14 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> References: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> Message-ID: <20130601082114.GA78628@cskk.homeip.net> On 01Jun2013 00:51, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: | > That would require that the repo have a 3.3.2 build in it. I don't | > know the Red Hat / CentOS policies there, but I know Debian stable | > wouldn't have anything so new - it takes time to test things. | | Is there a way to change to some repo that contain the latest python 3.3.2 to yo yum it? I asked Google: extra yum repositories for centos and it pointed me at: http://wiki.centos.org/AdditionalResources/Repositories Probably one of these has Python 3. Or build it from source; it's not hard. -- Cameron Simpson Luge strategy? Lie flat and try not to die. - Carman Boyle, Olympic Luge Gold Medalist From nikos.gr33k at gmail.com Sat Jun 1 04:30:46 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 01:30:46 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> Message-ID: ?? ???????, 1 ??????? 2013 11:21:14 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 01Jun2013 00:51, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > > | > That would require that the repo have a 3.3.2 build in it. I don't > > | > know the Red Hat / CentOS policies there, but I know Debian stable > > | > wouldn't have anything so new - it takes time to test things. > > | > > | Is there a way to change to some repo that contain the latest python 3.3.2 to yo yum it? > > > > I asked Google: > > > > extra yum repositories for centos > > > > and it pointed me at: > > > > http://wiki.centos.org/AdditionalResources/Repositories > > > > Probably one of these has Python 3. Or build it from source; it's not hard. Should i chnage form CentoOS 6.4 to ubuntu by your opinion? From cs at zip.com.au Sun Jun 2 00:36:06 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sun, 2 Jun 2013 14:36:06 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: Message-ID: <20130602043606.GA33818@cskk.homeip.net> On 01Jun2013 01:30, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ???????, 1 ??????? 2013 11:21:14 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: | > On 01Jun2013 00:51, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | > | ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: | > | > That would require that the repo have a 3.3.2 build in it. I don't | > | > know the Red Hat / CentOS policies there, but I know Debian stable | > | > wouldn't have anything so new - it takes time to test things. | > | | > | Is there a way to change to some repo that contain the latest python 3.3.2 to yo yum it? | > | > I asked Google: | > extra yum repositories for centos | > and it pointed me at: | > http://wiki.centos.org/AdditionalResources/Repositories | > | > Probably one of these has Python 3. Or build it from source; it's not hard. | | Should i chnage form CentoOS 6.4 to ubuntu by your opinion? No. Just sort it out on CentOS. Try the extra repos. Get Python 3 from one (I'm not sure why you think your current Python 3 install is a problem anyway, though). You're already slightly familiar with CentOS. Switching distros will just cause more pain. Fix your actual problems first. This is not a recommendation one way or another re CentOS versus Ubunutu; it is a recommendation not to change without a better reason. -- Cameron Simpson It takes seven or eight people to send a FAX. - Anonymous IRS guy From rosuav at gmail.com Sun Jun 2 00:41:45 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 2 Jun 2013 14:41:45 +1000 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <20130602043606.GA33818@cskk.homeip.net> References: <20130602043606.GA33818@cskk.homeip.net> Message-ID: On Sun, Jun 2, 2013 at 2:36 PM, Cameron Simpson wrote: > This is not a recommendation one way or another re CentOS versus > Ubunutu; it is a recommendation not to change without a better reason. Agreed. I happen to like Debian-family Linuxes, having spent most of my Linux time on either Ubuntu or Debian (and am now happy with Debian Wheezy on most of my computers), but there's really no point jumping ship randomly. I'm saying this for the archive only, though. Nikos just needs to learn the skill of figuring out where his problems really are. ChrisA From walterhurry at lavabit.com Mon Jun 3 10:35:46 2013 From: walterhurry at lavabit.com (Walter Hurry) Date: Mon, 3 Jun 2013 14:35:46 +0000 (UTC) Subject: Too many python installations. Should i remove them all and install the latest? References: <20130602043606.GA33818@cskk.homeip.net> Message-ID: On Sun, 02 Jun 2013 14:41:45 +1000, Chris Angelico wrote: > Nikos just > needs to learn the skill of figuring out where his problems really are. > Between the keyboard and the chair, obv. From nagia.retsina at gmail.com Mon Jun 3 11:01:04 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Mon, 3 Jun 2013 08:01:04 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> Message-ID: ?? ???????, 3 ??????? 2013 5:35:46 ?.?. UTC+3, ? ??????? Walter Hurry ??????: > On Sun, 02 Jun 2013 14:41:45 +1000, Chris Angelico wrote: > > > > > Nikos just > > > needs to learn the skill of figuring out where his problems really are. > > > > > Between the keyboard and the chair, obv. Maybe you should tell us how you find out yours. From torriem at gmail.com Mon Jun 3 14:37:23 2013 From: torriem at gmail.com (Michael Torrie) Date: Mon, 03 Jun 2013 12:37:23 -0600 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> Message-ID: <51ACE263.7040507@gmail.com> On 06/03/2013 09:01 AM, nagia.retsina at gmail.com wrote: > Maybe you should tell us how you find out yours. Chris and others have told you how they go about solving their problems. Quite a few times. In fact repeating themselves even. I think we've run out of different ways to saying it now. It's a process of research, tracing execution, understanding code flow, beta-testing code on a local machine (not on a production server!). Why do you expect it to be any different? From nikos.gr33k at gmail.com Tue Jun 4 02:33:49 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 3 Jun 2013 23:33:49 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> Message-ID: <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> Could you please install them because i need to work? a) pip (so that i can successfully run 'pip install pymysql' b) development tools I wiped the while perl away (leaving intact 2.6) but i wiped out pip at the proces to. From fabiosantosart at gmail.com Tue Jun 4 03:08:44 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 08:08:44 +0100 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> Message-ID: On 4 Jun 2013 07:44, "???????? ??????" wrote: > > Could you please install them because i need to work? > > a) pip (so that i can successfully run 'pip install pymysql' > b) development tools > > I wiped the while perl away (leaving intact 2.6) but i wiped out pip at the proces to. > -- > http://mail.python.org/mailman/listinfo/python-list Pip should be in your system's package manager. In Ubuntu it's available through sudo apt-get install python-pip. What are those development tools you speak of? Why would you uninstall perl? -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 03:11:39 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 00:11:39 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> Message-ID: <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> ?? ?????, 4 ??????? 2013 10:08:44 ?.?. UTC+3, ? ??????? F?bio Santos ??????: > Pip should be in your system's package manager. In Ubuntu it's available through sudo apt-get install python-pip. > What are those development tools you speak of? > Why would you uninstall perl? Sorry i meant Python, not Perl I'm using CentOS. So, i guess its something like 'yum install python-pip' i cannot find it, have searched it in variosu ways. From wuwei23 at gmail.com Tue Jun 4 03:21:11 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 00:21:11 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> Message-ID: On Jun 4, 5:11?pm, ???????? ?????? wrote: > So, i guess its something like 'yum install python-pip' > i cannot find it, have searched it in variosu ways. If you're going to claim to have tried something, can you at least tell us what you tried? Because quelle surprise! the most obvious combination of search terms works: [plone at localhost]$ yum search python-pip ... python-pip.noarch : Pip installs packages. Python3 packages. An easy_install replacement If you're not seeing this then you've broken your package manager, possibly by overwriting the existing repositories with the new ones you've added. It's next to impossible to tell, however, because we don't have an access to what you mean by "variosu ways". Expert tip: there's this AMAZING technology called "Google", which if you visit their site, enter the cryptic incantation "python pip centos", and click on *the very first link*, it actually provides you with explicit directions! What brave new world that etc! From nikos.gr33k at gmail.com Tue Jun 4 03:39:02 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 00:39:02 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> Message-ID: ?? ?????, 4 ??????? 2013 10:21:11 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 4, 5:11?pm, ???????? ?????? wrote: > > > So, i guess its something like 'yum install python-pip' > > i cannot find it, have searched it in variosu ways. > > > > If you're going to claim to have tried something, can you at least > tell us what you tried? Because quelle surprise! the most obvious > combination of search terms works: Well, since you dough me here it is: nikos at superhost.gr [~]# yum search python-pip Loaded plugins: fastestmirror Determining fastest mirrors * base: mirror.netcologne.de * extras: mirror.optimate-server.de * updates: mirror.softaculous.com base | 3.7 kB 00:00 extras | 3.5 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 2.6 MB 00:00 vz-base | 951 B 00:00 vz-base 3/3 vz-updates | 951 B 00:00 No Matches found nikos at superhost.gr [~]# From nikos.gr33k at gmail.com Tue Jun 4 04:20:20 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 01:20:20 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> Message-ID: <49025258-4c96-4e1b-8afc-e2b0f2011598@googlegroups.com> Still can't find it: nikos at superhost.gr [~/www/data/apps]# yum search *pip* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.netcologne.de * extras: mirror.optimate-server.de * updates: mirror.softaculous.com No Matches found nikos at superhost.gr [~/www/data/apps]# From nikos.gr33k at gmail.com Tue Jun 4 05:49:48 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 02:49:48 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <49025258-4c96-4e1b-8afc-e2b0f2011598@googlegroups.com> References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> <49025258-4c96-4e1b-8afc-e2b0f2011598@googlegroups.com> Message-ID: <80207921-8df5-4bba-b121-eeca96a55258@googlegroups.com> Okey found it. since couldnt install pip i did: easy_install pymysql From fabiosantosart at gmail.com Tue Jun 4 07:26:23 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 12:26:23 +0100 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <80207921-8df5-4bba-b121-eeca96a55258@googlegroups.com> References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> <49025258-4c96-4e1b-8afc-e2b0f2011598@googlegroups.com> <80207921-8df5-4bba-b121-eeca96a55258@googlegroups.com> Message-ID: On 4 Jun 2013 10:54, "???????? ??????" wrote: > > Okey found it. > > since couldnt install pip i did: > > easy_install pymysql It is not the recommended way to install pip, but you can ironically easy_install pip -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabiosantosart at gmail.com Tue Jun 4 07:29:00 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 12:29:00 +0100 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> <49025258-4c96-4e1b-8afc-e2b0f2011598@googlegroups.com> <80207921-8df5-4bba-b121-eeca96a55258@googlegroups.com> Message-ID: On 4 Jun 2013 12:26, "F?bio Santos" wrote: > > > On 4 Jun 2013 10:54, "???????? ??????" wrote: > > > > Okey found it. > > > > since couldnt install pip i did: > > > > easy_install pymysql > > It is not the recommended way to install pip, but you can ironically easy_install pip Sorry for double posting but my favorite web host has a lot of pythons. It is very handy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From torriem at gmail.com Tue Jun 4 10:32:55 2013 From: torriem at gmail.com (Michael Torrie) Date: Tue, 04 Jun 2013 08:32:55 -0600 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: References: <20130602043606.GA33818@cskk.homeip.net> <9306b2b1-b295-413e-9cc4-ed5bfe55d1f1@googlegroups.com> <1b3e3341-3429-4c3e-9ce4-38559e9d3006@googlegroups.com> Message-ID: <51ADFA97.2090004@gmail.com> On 06/04/2013 01:39 AM, ???????? ?????? wrote: > Well, since you dough me here it is: Did you even bother to google it? If you did, you'd find that python-pip is available in a semi-official repository called EPEL. Just about every RHEL and CentOS install should have EPEL installed. Now it's pip for Python 2.6 of course. If you need python 3.3, there is a repo out there (third-party of course) that google can help you find. From torriem at gmail.com Sun Jun 2 13:33:36 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 02 Jun 2013 11:33:36 -0600 Subject: Too many python installations. Should i remove them all and install the latest? In-Reply-To: <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> <7eb10d6f-2252-4704-8cad-aca7e6fbf08c@googlegroups.com> <564b0e3b-7b09-4b43-897d-d423f92f19ca@googlegroups.com> Message-ID: <51AB81F0.30109@gmail.com> On 06/01/2013 01:51 AM, ???????? ?????? wrote: > ?? ???????, 1 ??????? 2013 9:18:26 ?.?. UTC+3, ? ??????? Chris > Angelico ??????: > >> That would require that the repo have a 3.3.2 build in it. I don't >> know the Red Hat / CentOS policies there, but I know Debian stable >> wouldn't have anything so new - it takes time to test things. > > Is there a way to change to some repo that contain the latest python > 3.3.2 to yo yum it? Let me brutally blunt here, nick: have you googled for the answer or are you just expecting us to do all your research for you? I googled for this out of curiousity and found at least one third-party repo that did have Python 3.3.x in it for CentOS/RHEL 6.4. I'll give you a free hint about finding it: sometimes you have to add RHEL to the search term as well as CentOS, since CentOS is a free clone of RHEL. >From now on, ????????, before asking a question like this on this list, please state what google search terms you used, what you found, and why the google searches did not turn up the information you seek. From wuwei23 at gmail.com Sun Jun 2 22:16:31 2013 From: wuwei23 at gmail.com (alex23) Date: Sun, 2 Jun 2013 19:16:31 -0700 (PDT) Subject: Too many python installations. Should i remove them all and install the latest? References: <063fc449-5582-4a84-9eea-35e04344dbe0@googlegroups.com> Message-ID: <1745649e-0f7d-4475-88bb-7014d172201a@kt20g2000pbb.googlegroups.com> On Jun 1, 1:20?am, ???????? ?????? wrote: > Why so many pythons in my system. Because _you_ installed them. And we _know_ this because you've posted multiple threads relating to your problems with _your_ installations of Python 3. Even more entertainingly: > root at nikos [~]# which python3 > /root/.local/lib/python2.7/bin/python3 You seem to have installed python3 inside of a local copy of python2.7. Awesomely professional webhosting service you're providing here. > root at nikos [~]# python3 > Python 3.3.0 (default, Apr 6 2013, 01:53:31) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> exit() > > root at nikos [~]# python3.3 > Python 3.3.0 (default, Apr 6 2013, 01:53:31) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> exit() Did you _really_ need to post this? Was it to have us confirm they _are_ the same versions? > did i screwed up my remote VPS which i host 10 peoples webpages? STOP EXPERIMENTING ON YOUR PRODUCTION SERVER. You should have a test server that is a mirror of your production on which you can _safely_ flail around ignorantly without _costing your customers_ in lost time or data. They're sure as hell should _not_ be paying you to learn Python badly. From andipersti at gmail.com Sat Jun 1 03:21:01 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Sat, 01 Jun 2013 09:21:01 +0200 Subject: netcdF4 variables In-Reply-To: References: Message-ID: <51A9A0DD.1080609@gmail.com> On 01.06.2013 05:30, Sudheer Joseph wrote: > some hing like a list > xx=nc,variables[:] > should get me all variable names with out other surrounding stuff?? > > In [4]: ncf.variables > Out[4]: OrderedDict([(u'LON', ), [SNIP] It looks like "variables" is an OrderedDict. Thus >>> ncf.variables.keys() should return a view (or list, depending on your python version) of all keys, i.e. all variable names. Bye, Andreas From sjo.india at gmail.com Sat Jun 1 07:54:35 2013 From: sjo.india at gmail.com (Sudheer Joseph) Date: Sat, 1 Jun 2013 04:54:35 -0700 (PDT) Subject: netcdF4 variables In-Reply-To: References: Message-ID: Thank you very much it works for me. with best regards, Sudheer On Saturday, June 1, 2013 12:51:01 PM UTC+5:30, Andreas Perstinger wrote: > On 01.06.2013 05:30, Sudheer Joseph wrote: > > > some hing like a list > > > xx=nc,variables[:] > > > should get me all variable names with out other surrounding stuff?? > > > > > > In [4]: ncf.variables > > > Out[4]: OrderedDict([(u'LON', ), > > [SNIP] > > > > It looks like "variables" is an OrderedDict. Thus > > > > >>> ncf.variables.keys() > > > > should return a view (or list, depending on your python version) of all > > keys, i.e. all variable names. > > > > Bye, Andreas From nikos.gr33k at gmail.com Sat Jun 1 01:30:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 31 May 2013 22:30:42 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script Message-ID: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> I have asked this in alt.apache.configuration but received no response at all, so i was thinking of you guys as a last resort to this. Sorry about that but koukos.py need to set a cookies that other scripts depend upon for identification. 'python3 koukos.py' runs properly. chown nikos:nikos koukos.py chmod 755 koukos.py are all in place. i want to run a python script 4 days now and i receive this message: [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml when i tail -F /usr/local/apache/logs/error_log & What this error means? It appears that the effective user of the script does not have permission to open the log file that the suexec call requires. - fopen reported "permission denied", presumably on the logfile - suexec, receiving the fopen "permission denied" error, reported "could not open log file" These errors, in turn, seem to have prematurely terminated the script headers that i use in koukos.py script, causing the koukos.py script to fail. This caused apache to report (with a generic and inappropriate error message) that the shtml file that invokes the script failed. [code] root at nikos [/home/nikos/www/cgi-bin]# chmod g+w /usr/local/apache/logs/suexec_log root at nikos [/home/nikos/www/cgi-bin]# ls -al /usr/local/apache/logs/suexec_log -rw-rw-r-- 1 root apache 506823 Jun 1 02:55 /usr/local/apache/logs/suexec_log [/code] [code] root at nikos [/home/nikos/www/cgi-bin]# chmod g+w /var/log/httpd/suexec.log root at nikos [/home/nikos/www/cgi-bin]# ls -l /var/log/httpd/suexec.log -rw-rw-r-- 1 root root 0 Jun 1 02:52 /var/log/httpd/suexec.log [/code] and still iam receiving the same error..... From rosuav at gmail.com Sat Jun 1 01:38:17 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 1 Jun 2013 15:38:17 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> Message-ID: On Sat, Jun 1, 2013 at 3:30 PM, ???????? ?????? wrote: > I have asked this in alt.apache.configuration but received no response at all You posted it FIFTEEN HOURS AGO on a low-traffic forum. Sheesh! Learn a little patience. ChrisA From nikos.gr33k at gmail.com Sat Jun 1 03:49:56 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 00:49:56 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> Message-ID: <85d8dcab-5739-437d-9b45-01eecdbe0c52@googlegroups.com> ?? ???????, 1 ??????? 2013 8:38:17 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > You posted it FIFTEEN HOURS AGO on a low-traffic forum. > Sheesh! Learn a little patience. I think this is enough time for to get an answer, i dont think so meone would answer from there but if you know some other list i can sk this question please let me knwo and i'll ask there. All my script are python 3.x readyand koukos.py is as well, oits just that damn suexec issue that doesnt let my last script that all it does is to set a cookie to work properly. If you kwno the answer please advise me what it needs to be done. This will be my last question, all other issues have been taker care of. From rosuav at gmail.com Sat Jun 1 03:56:04 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 1 Jun 2013 17:56:04 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <85d8dcab-5739-437d-9b45-01eecdbe0c52@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <85d8dcab-5739-437d-9b45-01eecdbe0c52@googlegroups.com> Message-ID: On Sat, Jun 1, 2013 at 5:49 PM, ???????? ?????? wrote: > ?? ???????, 1 ??????? 2013 8:38:17 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >> You posted it FIFTEEN HOURS AGO on a low-traffic forum. >> Sheesh! Learn a little patience. > > I think this is enough time for to get an answer, i dont think so meone would answer from there but if you know some other list i can sk this question please let me knwo and i'll ask there. > Did you follow the usual rule of lurking on a list before posting? Or at very least, reading the archive? I just quickly Googled the newsgroup name and found the archive. When you see a newsgroup that gets only a handful of posts a month, you can NOT expect up-to-the-minute responses. Actually, you can't expect that EVER. Now learn a little patience and courtesy. http://www.catb.org/esr/faqs/smart-questions.html ChrisA From nikos.gr33k at gmail.com Sat Jun 1 04:31:36 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 01:31:36 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <85d8dcab-5739-437d-9b45-01eecdbe0c52@googlegroups.com> Message-ID: I was searchign all night long yesterday an i didn manged to get this workign. Please if someoen is expreinces with linux just help me out here a but. From alain at dpt-info.u-strasbg.fr Sat Jun 1 05:03:47 2013 From: alain at dpt-info.u-strasbg.fr (Alain Ketterlin) Date: Sat, 01 Jun 2013 11:03:47 +0200 Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> Message-ID: <87txliw6bw.fsf@dpt-info.u-strasbg.fr> ???????? ?????? writes: [...] > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file Here is a link to suexec documentation (at least some version of it, this is the second link provided by google): http://httpd.apache.org/docs/2.2/suexec.html Read this and check your setup to see if it matches. -- Alain. From nikos.gr33k at gmail.com Sat Jun 1 05:19:02 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 02:19:02 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <87txliw6bw.fsf@dpt-info.u-strasbg.fr> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <87txliw6bw.fsf@dpt-info.u-strasbg.fr> Message-ID: ?? ???????, 1 ??????? 2013 12:03:47 ?.?. UTC+3, ? ??????? Alain Ketterlin ??????: > http://httpd.apache.org/docs/2.2/suexec.html > Read this and check your setup to see if it matches. I have already seen this Alan thank you and tried the command i mentioned but with no successfull result whatsoever. From paul at subsignal.org Sun Jun 2 07:51:56 2013 From: paul at subsignal.org (=?UTF-8?B?UGF1bCBLw7ZsbGU=?=) Date: Sun, 02 Jun 2013 13:51:56 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> Message-ID: Am 01.06.2013 07:30, schrieb ???????? ??????: [snipp] > > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml > > when i tail -F /usr/local/apache/logs/error_log & > > What this error means? > > It appears that the effective user of the script does not have permission to open the log file > that the suexec call requires. Yes, so which logfile and what user is suexec using to run your script? You should be able to answer all this from your apache configuration. cheers Paul From as at sci.fi Mon Jun 3 11:20:00 2013 From: as at sci.fi (Anssi Saari) Date: Mon, 03 Jun 2013 18:20:00 +0300 Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> Message-ID: ???????? ?????? writes: > [code] > root at nikos [/home/nikos/www/cgi-bin]# chmod g+w /var/log/httpd/suexec.log > root at nikos [/home/nikos/www/cgi-bin]# ls -l /var/log/httpd/suexec.log > -rw-rw-r-- 1 root root 0 Jun 1 02:52 /var/log/httpd/suexec.log > [/code] > > > and still iam receiving the same error..... What did you hope to accomplish with this second chmod? Nobody is in the root group except root. I hope. My guess based on very minimal Googling on the topic is you should change the group of /var/log/httpd/suexec.log to apache. Then again, I have no idea why you have both /usr/local/apache/logs/suexec_log and /var/log/httpd/suexec.log, but the former apparently has some data in it and the latter does not so changing permissions on /var/log/httpd/suexec.log may not help... Oh, apparently suexec prints its config if you run suexec -V, so include that output if you still have problems. From carlosnepomuceno at outlook.com Mon Jun 3 18:13:44 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 01:13:44 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, Message-ID: ---------------------------------------- > From: as at sci.fi > Subject: Re: Apache and suexec issue that wont let me run my python script > Date: Mon, 3 Jun 2013 18:20:00 +0300 > To: python-list at python.org > > ???????? ?????? writes: > >> [code] >> root at nikos [/home/nikos/www/cgi-bin]# chmod g+w /var/log/httpd/suexec.log >> root at nikos [/home/nikos/www/cgi-bin]# ls -l /var/log/httpd/suexec.log >> -rw-rw-r-- 1 root root 0 Jun 1 02:52 /var/log/httpd/suexec.log >> [/code] >> >> >> and still iam receiving the same error..... > > What did you hope to accomplish with this second chmod? Nobody is in the > root group except root. I hope. My guess based on very minimal Googling > on the topic is you should change the group of /var/log/httpd/suexec.log > to apache. > > Then again, I have no idea why you have both > /usr/local/apache/logs/suexec_log and /var/log/httpd/suexec.log, but the > former apparently has some data in it and the latter does not so > changing permissions on /var/log/httpd/suexec.log may not help... '/var/log/httpd' is the default place for the Red Hat and CentOS installation of httpd. '/usr/local/apache/logs' is the default directory of the Apache httpd installation. httpd has probably been upgraded by 'make install'. > Oh, apparently suexec prints its config if you run suexec -V, so include > that output if you still have problems. > -- > http://mail.python.org/mailman/listinfo/python-list From torriem at gmail.com Mon Jun 3 19:23:16 2013 From: torriem at gmail.com (Michael Torrie) Date: Mon, 03 Jun 2013 17:23:16 -0600 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, Message-ID: <51AD2564.6080707@gmail.com> On 06/03/2013 04:13 PM, Carlos Nepomuceno wrote: > '/var/log/httpd' is the default place for the Red Hat and CentOS installation of httpd. > > '/usr/local/apache/logs' is the default directory of the Apache httpd installation. > > httpd has probably been upgraded by 'make install'. Oh wow. What a mess. I think Nick needs to read a good book on Red Hat EL system administration. Think he needs to start over with a fresh install of CentOS and only install software that comes from a repo using yum until he learns what he's doing. From carlosnepomuceno at outlook.com Mon Jun 3 19:33:19 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 02:33:19 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <51AD2564.6080707@gmail.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, , , , <51AD2564.6080707@gmail.com> Message-ID: ---------------------------------------- > Date: Mon, 3 Jun 2013 17:23:16 -0600 > From: torriem at gmail.com > To: python-list at python.org > Subject: Re: Apache and suexec issue that wont let me run my python script > > On 06/03/2013 04:13 PM, Carlos Nepomuceno wrote: >> '/var/log/httpd' is the default place for the Red Hat and CentOS installation of httpd. >> >> '/usr/local/apache/logs' is the default directory of the Apache httpd installation. >> >> httpd has probably been upgraded by 'make install'. > > Oh wow. What a mess. I think Nick needs to read a good book on Red Hat > EL system administration. Think he needs to start over with a fresh > install of CentOS and only install software that comes from a repo using > yum until he learns what he's doing. > -- > http://mail.python.org/mailman/listinfo/python-list I did a httpd 'make install' on CentOS 6 and it worked fine. Needed a few tweaks that I don't remember though. If you don't have any previous experience with Apache httpd settings I wouldn't try that on a production server. From torriem at gmail.com Tue Jun 4 00:45:28 2013 From: torriem at gmail.com (Michael Torrie) Date: Mon, 03 Jun 2013 22:45:28 -0600 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, , , , <51AD2564.6080707@gmail.com> Message-ID: <51AD70E8.70506@gmail.com> On 06/03/2013 05:33 PM, Carlos Nepomuceno wrote: > I did a httpd 'make install' on CentOS 6 and it worked fine. Needed a > few tweaks that I don't remember though. > > If you don't have any previous experience with Apache httpd settings > I wouldn't try that on a production server. Precisely. Given his experience levels, installing httpd from source is recipe for disaster. He's now going to have to track security flaw reports manually, try to figure out which ones apply to him, and keep his apache up to date. I can't think of anything he'd need in Apache that's not in the CentOS packages. I've sys-admined for years and I've never ever needed an Apache outside out of the repos. Sometimes I needed other things I had to build from source, but never apache. From rosuav at gmail.com Tue Jun 4 03:51:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 17:51:02 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <51AD70E8.70506@gmail.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> Message-ID: On Tue, Jun 4, 2013 at 2:45 PM, Michael Torrie wrote: > On 06/03/2013 05:33 PM, Carlos Nepomuceno wrote: >> I did a httpd 'make install' on CentOS 6 and it worked fine. Needed a >> few tweaks that I don't remember though. >> >> If you don't have any previous experience with Apache httpd settings >> I wouldn't try that on a production server. > > Precisely. Given his experience levels, installing httpd from source is > recipe for disaster. He's now going to have to track security flaw > reports manually, try to figure out which ones apply to him, and keep > his apache up to date. I can't think of anything he'd need in Apache > that's not in the CentOS packages. I've sys-admined for years and I've > never ever needed an Apache outside out of the repos. Sometimes I > needed other things I had to build from source, but never apache. Agreed. I'm a Debian guy rather than Red Hat, and by comparison Debian changes with every gust of wind, but the same applies. There's little reason to build most things from source; take advantage of the massive testing that's been done! Of course, there will be times when the version in the repo is just too old, but that's never been the case for me with Apache. ChrisA From nikos.gr33k at gmail.com Tue Jun 4 06:12:41 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 03:12:41 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> Message-ID: <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> I think i'll do a "chmod 666 /var/log/httpd/suexec.log" and see if the error goes away. I think what the problem is, i have the owner and group as root:root with read/write permissions, but apache is likely owned by something else (www:www or apache:webservd). So either i'll have to change the group ownership of the log file to the group apache is running as or change the log file to world read/write, which isn't safe since other people log into the box, but is generally harmless i think with log files. Checking the permissions of /var/log/httpd directory itself: nikos at superhost.gr [~/www/cgi-bin]# ls -ld /var/log/httpd/ drwx------ 2 root root 4096 Jun 1 02:52 /var/log/httpd// Is that a problem? http != Apache ? i'm still confused about what is: '/var/log/httpd' and what is '/usr/local/Apache' Is seems like this is the same service runnign twice under different names. From nikos.gr33k at gmail.com Tue Jun 4 06:17:08 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 03:17:08 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> Message-ID: <98303eab-f7fa-43fc-82a4-9a05584d8058@googlegroups.com> I just tried out those: root at nikos [~]# ls -l /var/log/httpd/suexec.log -rw-rw-r-- 1 root root 0 Jun 1 02:52 /var/log/httpd/suexec.log root at nikos [~]# ls -l /usr/local/apache/logs/suexec_log -rw-rw-r-- 1 root apache 532667 Jun 4 13:11 /usr/local/apache/logs/suexec_log root at nikos [~]# chown root:apache /var/log/httpd/suexec.log root at nikos [~]# ls -l /var/log/httpd/suexec.log -rw-rw-r-- 1 root apache 0 Jun 1 02:52 /var/log/httpd/suexec.log but i'm not usre if they solve the problem or why there are 2 suexec.log files. From benjamin at schollnick.net Tue Jun 4 06:21:56 2013 From: benjamin at schollnick.net (Benjamin Schollnick) Date: Tue, 4 Jun 2013 06:21:56 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> Message-ID: On Jun 4, 2013, at 6:12 AM, ???????? ?????? wrote: > Checking the permissions of /var/log/httpd directory itself: > > nikos at superhost.gr [~/www/cgi-bin]# ls -ld /var/log/httpd/ > drwx------ 2 root root 4096 Jun 1 02:52 /var/log/httpd// > > Is that a problem? > > http != Apache ? Yes, httpd is Apache, or at least part of Apache. > i'm still confused about what is: > '/var/log/httpd' and what is '/usr/local/Apache' > > Is seems like this is the same service runnign twice under different names. Not really. Unix unlike some other OSes, separates your data from your applications. That's one reason, when Apple designed Mac OS X, you can re-install Mac OS X over your current installation, and not lose any data. Your user data is separate from the OS data. The /Usr tree is considered read-only. In theory nothing should write to that folder, unless you are installing Unix tools. Please note, it's not read only in the OS, yes, it does require super user rights, but that tree is not read only. The /Var tree is where the OS writes data to. For example, Log files, temporary work files, etc. I hope this clears some of this up. If I have made any mistakes here, please feel free to politely correct me |-) - Benjamin -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 06:56:19 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 03:56:19 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> Message-ID: root at nikos [/home/nikos/www/cgi-bin]# chmod 755 /var/log/httpd/suexec.log root at nikos [/home/nikos/www/cgi-bin]# ls -l /var/log/httpd/suexec.log -rwxr-xr-x 1 root apache 0 Jun 1 02:52 /var/log/httpd/suexec.log* root at nikos [/home/nikos/www/cgi-bin]# chmod 755 /usr/local/apache/logs/error_log root at nikos [/home/nikos/www/cgi-bin]# ls -l /usr/local/apache/logs/error_log -rwxr-xr-x 1 root root 32414017 Jun 4 13:51 /usr/local/apache/logs/error_log* root at nikos [/home/nikos/www/cgi-bin]# chown root:apache /usr/local/apache/logs/error_log root at nikos [/home/nikos/www/cgi-bin]# ls -l /usr/local/apache/logs/error_log -rwxr-xr-x 1 root apache 32414017 Jun 4 13:51 /usr/local/apache/logs/error_log* root at nikos [/home/nikos/www/cgi-bin]# Now the error i get whn trying to run my scgi script via browser is root at nikos [/home/nikos/www/cgi-bin]# [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] suexec failure: could not open log file [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] fopen: Permission denied [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml I just don't get it..... I chmod'ed i chown'ed Why still doesn't work? From carlosnepomuceno at outlook.com Tue Jun 4 07:04:36 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:04:36 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, , , <51AD2564.6080707@gmail.com>, , <51AD70E8.70506@gmail.com>, , <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, , Message-ID: send the output of the following command: ps aux|grep httpd > Date: Tue, 4 Jun 2013 03:56:19 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > root at nikos [/home/nikos/www/cgi-bin]# chmod 755 /var/log/httpd/suexec.log > > root at nikos [/home/nikos/www/cgi-bin]# ls -l /var/log/httpd/suexec.log > -rwxr-xr-x 1 root apache 0 Jun 1 02:52 /var/log/httpd/suexec.log* > > root at nikos [/home/nikos/www/cgi-bin]# chmod 755 /usr/local/apache/logs/error_log > > root at nikos [/home/nikos/www/cgi-bin]# ls -l /usr/local/apache/logs/error_log > -rwxr-xr-x 1 root root 32414017 Jun 4 13:51 /usr/local/apache/logs/error_log* > > root at nikos [/home/nikos/www/cgi-bin]# chown root:apache /usr/local/apache/logs/error_log > root at nikos [/home/nikos/www/cgi-bin]# ls -l /usr/local/apache/logs/error_log > > -rwxr-xr-x 1 root apache 32414017 Jun 4 13:51 /usr/local/apache/logs/error_log* > root at nikos [/home/nikos/www/cgi-bin]# > > > Now the error i get whn trying to run my scgi script via browser is > > root at nikos [/home/nikos/www/cgi-bin]# [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] suexec failure: could not open log file > [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] fopen: Permission denied > [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py > [Tue Jun 04 13:55:26 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml > > > I just don't get it..... > I chmod'ed > i chown'ed > > Why still doesn't work? > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 07:09:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 04:09:44 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,> , > , > <51AD2564.6080707@gmail.com>, > , > <51AD70E8.70506@gmail.com>, > , > <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, > , > Message-ID: <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> ?? ?????, 4 ??????? 2013 2:04:36 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > send the output of the following command: > ps aux|grep httpd root at nikos [/home/nikos/www/data/apps]# ps aux | grep httpd root 19194 0.0 0.2 74224 4440 ? Ss Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL root 19201 0.0 0.1 74136 2576 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19202 0.0 0.2 74492 4320 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19203 0.0 0.2 74488 4304 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19204 0.0 0.2 74488 4352 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19205 0.0 0.2 74492 4336 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19206 0.0 0.2 74544 4328 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 19215 0.0 0.2 74492 4300 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody 20170 0.0 0.2 74356 4264 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL root 20860 0.0 0.0 103240 856 pts/2 S+ Jul13 0:00 grep httpd root at nikos [/home/nikos/www/data/apps]# From carlosnepomuceno at outlook.com Tue Jun 4 07:27:25 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:27:25 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, >, , , > , >,<51AD2564.6080707@gmail.com>,,> , >,<51AD70E8.70506@gmail.com>,,> , >,<6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>,,> , >, , , <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> Message-ID: The httpd processes are run by user 'nobody'. You have to change your httpd.conf to assign the correct user or change the owner of the log file to nobody. On httpd.conf look for the following directives: User root Group root > Date: Tue, 4 Jun 2013 04:09:44 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > ?? ?????, 4 ??????? 2013 2:04:36 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > > send the output of the following command: > > ps aux|grep httpd > > root at nikos [/home/nikos/www/data/apps]# ps aux | grep httpd > root 19194 0.0 0.2 74224 4440 ? Ss Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > root 19201 0.0 0.1 74136 2576 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19202 0.0 0.2 74492 4320 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19203 0.0 0.2 74488 4304 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19204 0.0 0.2 74488 4352 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19205 0.0 0.2 74492 4336 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19206 0.0 0.2 74544 4328 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 19215 0.0 0.2 74492 4300 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > nobody 20170 0.0 0.2 74356 4264 ? S Jul13 0:00 /usr/local/apache/bin/httpd -k start -DSSL > root 20860 0.0 0.0 103240 856 pts/2 S+ Jul13 0:00 grep httpd > root at nikos [/home/nikos/www/data/apps]# > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 07:36:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 04:36:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, >,> , , > , > <, <51AD2564.6080707@gmail.com>, , > , > <, <51AD70E8.70506@gmail.com>, , > , > <,<6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>,,> ,> <, , > , > <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> Message-ID: <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> ?? ?????, 4 ??????? 2013 2:27:25 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > The httpd processes are run by user 'nobody'. You have to change your httpd.conf to assign the correct user or change the owner of the log file to nobody. > > On httpd.conf look for the following directives: > User root > Group root Why some httpd run as root(first two) and the rest as nobody? What is user 'nobody' anyways? root at nikos [/home/nikos/www/data/apps]# nano /usr/local/apache/conf/httpd.conf root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'User root' root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'user root' root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'group root' root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'Group root' Doesn't seem to be there. From nikos.gr33k at gmail.com Tue Jun 4 07:38:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 04:38:44 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, >,> , , > , > <, <51AD2564.6080707@gmail.com>, , > , > <, <51AD70E8.70506@gmail.com>, , > , > <,<6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>,,> ,> <,> , > , > <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> Message-ID: <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> root at nikos [/home/nikos/www/data/apps]# ls -l /usr/local/apache/logs/error_log -rwxr-xr-x 1 root apache 32447472 Jun 4 14:36 /usr/local/apache/logs/error_log* root at nikos [/home/nikos/www/data/apps]# chown nobody:apache /usr/local/apache/logs/error_log root at nikos [/home/nikos/www/data/apps]# ls -l /usr/local/apache/logs/error_log -rwxr-xr-x 1 nobody apache 32447472 Jun 4 14:36 /usr/local/apache/logs/error_log* still the same error. From carlosnepomuceno at outlook.com Tue Jun 4 07:42:52 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:42:52 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, >,>,, ,,> , >,<, <51AD2564.6080707@gmail.com>, ,,> , >,<, <51AD70E8.70506@gmail.com>, ,,> , >, <, <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, , >, , > <,>,,,> , >, <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, , <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>, <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> Message-ID: Post your httpd.conf to pastebin and send us the link... > Date: Tue, 4 Jun 2013 04:38:44 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > root at nikos [/home/nikos/www/data/apps]# ls -l /usr/local/apache/logs/error_log > -rwxr-xr-x 1 root apache 32447472 Jun 4 14:36 /usr/local/apache/logs/error_log* > root at nikos [/home/nikos/www/data/apps]# chown nobody:apache /usr/local/apache/logs/error_log > root at nikos [/home/nikos/www/data/apps]# ls -l /usr/local/apache/logs/error_log > -rwxr-xr-x 1 nobody apache 32447472 Jun 4 14:36 /usr/local/apache/logs/error_log* > > > still the same error. > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 07:48:34 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 04:48:34 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,> <, >, , , , > , >, <, > <51AD2564.6080707@gmail.com>, , , > , >, <, > <51AD70E8.70506@gmail.com>, , , > , > <, <, <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, , >,> , > <, >, , , > ,> <, <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, > , > <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>, > <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> Message-ID: ?? ?????, 4 ??????? 2013 2:42:52 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > Post your httpd.conf to pastebin and send us the link... Here it is: http://pastebin.com/kMT2BZp1 From carlosnepomuceno at outlook.com Tue Jun 4 08:11:18 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 15:11:18 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,>,<, >, , , ,,> ,,>, <, > <51AD2564.6080707@gmail.com>, , ,,> ,,>, <, > <51AD70E8.70506@gmail.com>, , ,,> , >,<, <, <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, , >,>,, > <, >,,, , >,,> <,,<4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>,,> , >,<2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>,,> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com>, , Message-ID: > Date: Tue, 4 Jun 2013 04:48:34 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > ?? ?????, 4 ??????? 2013 2:42:52 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > > Post your httpd.conf to pastebin and send us the link... > > > Here it is: http://pastebin.com/kMT2BZp1 > -- > http://mail.python.org/mailman/listinfo/python-list Your httpd.conf is automatically generated by cPanel. Take a look: # Defined in /var/cpanel/cpanel.config: apache_portListen 0.0.0.0:82User nobodyGroup nobodyExtendedStatus OnServerAdmin nikos.gr33k at gmail.comServerName nikos.superhost.grLogLevel warn That means you have to change the settings on cPanel not directly editing httpd.conf. I don't use cPanel so I can't help you on that. Good luck! -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 08:54:30 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 05:54:30 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,>,<, >,> , , , , > , , >, <, > <51AD2564.6080707@gmail.com>, , , , > , , >, <, > <51AD70E8.70506@gmail.com>, , , , > , >,<, <,> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, ,> <,>,, > <,> <,,, ,> <, , > <, , <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, , > , > <, <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>, , > <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com>, > , > Message-ID: <346a1363-b0e0-43f1-abb0-9e1fa61c72ea@googlegroups.com> ?? ?????, 4 ??????? 2013 3:11:18 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > > Date: Tue, 4 Jun 2013 04:48:34 -0700 > > Subject: Re: Apache and suexec issue that wont let me run my python script > > From: nikos... at gmail.com > > To: pytho... at python.org > > > > ?? ?????, 4 ??????? 2013 2:42:52 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > > > Post your httpd.conf to pastebin and send us the link... > > > > > > Here it is: http://pastebin.com/kMT2BZp1 > > -- > > http://mail.python.org/mailman/listinfo/python-list > > Your httpd.conf is automatically generated by cPanel. Take a look: > > > # Defined in /var/cpanel/cpanel.config: apache_port > Listen 0.0.0.0:82 > User nobody > Group nobody > ExtendedStatus On > ServerAdmin nikos... at gmail.com > ServerName nikos.superhost.gr > LogLevel warn > > That means you have to change the settings on cPanel not directly editing httpd.conf. I don't use cPanel so I can't help you on that. > > Good luck! Since, i'm root i will open the file and alter the user nobody to root. Can't i? Also about the suexec.log since i made it 755 why still suexec complain that it cannot open it? From nikos.gr33k at gmail.com Tue Jun 4 08:57:54 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 05:57:54 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,>,<, >,> , , , , > , , >, <, > <51AD2564.6080707@gmail.com>, , , , > , , >, <, > <51AD70E8.70506@gmail.com>, , , , > , >,<, <,> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, ,> <,>,, > <,> <,,, ,> <, , > <, , <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, , > , > <, <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>, , > <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com>, > , > Message-ID: root at nikos [~]# nano /usr/local/apache/conf/httpd.conf and altering user nobody to user root. root at nikos [~]# service httpd restart [Tue Jun 04 15:56:42 2013] [warn] module rpaf_module is already loaded, skipping Syntax error on line 175 of /usr/local/apache/conf/httpd.conf: Error:\tApache has not been designed to serve pages while\n\trunning as root. There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n root at nikos [~]# What can i do? From rosuav at gmail.com Tue Jun 4 09:10:58 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 23:10:58 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 10:57 PM, ???????? ?????? wrote: > root at nikos [~]# nano /usr/local/apache/conf/httpd.conf > > and altering user nobody to user root. > > root at nikos [~]# service httpd restart > [Tue Jun 04 15:56:42 2013] [warn] module rpaf_module is already loaded, skipping > Syntax error on line 175 of /usr/local/apache/conf/httpd.conf: > Error:\tApache has not been designed to serve pages while\n\trunning as root. There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n > root at nikos [~]# > > What can i do? Don't do that. ChrisA From carlosnepomuceno at outlook.com Tue Jun 4 09:13:24 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 16:13:24 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>,>,<, >,>,, , , ,,> , , >,,<, > <51AD2564.6080707@gmail.com>, , , ,,> , , >,,<, > <51AD70E8.70506@gmail.com>, , , ,,> ,,>,<, <,> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, ,>,<,>,, > <,>,<,,, ,>,<, , > <, ,,<4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, , >,, > <,,<2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com>, , >,<03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com>,,> , >, , , Message-ID: > Date: Tue, 4 Jun 2013 05:57:54 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > root at nikos [~]# nano /usr/local/apache/conf/httpd.conf > > and altering user nobody to user root. > > root at nikos [~]# service httpd restart > [Tue Jun 04 15:56:42 2013] [warn] module rpaf_module is already loaded, skipping > Syntax error on line 175 of /usr/local/apache/conf/httpd.conf: > Error:\tApache has not been designed to serve pages while\n\trunning as root. There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n > root at nikos [~]# > > What can i do? You don't need to run httpd as root. In fact it's risky. You can use another user with less privileges to run it like nobody or something else you see fit. I don't think the suggestion to rebuild the server is good, but I don't know how cPanel works so it's just a guess. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 09:17:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 06:17:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> Message-ID: <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> ?? ?????, 4 ??????? 2013 4:10:58 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Tue, Jun 4, 2013 at 10:57 PM, ???????? ?????? wrote: > > > root at nikos [~]# nano /usr/local/apache/conf/httpd.conf > > and altering user nobody to user root. > > root at nikos [~]# service httpd restart > > > [Tue Jun 04 15:56:42 2013] [warn] module rpaf_module is already loaded, skipping > > > Syntax error on line 175 of /usr/local/apache/conf/httpd.conf: > > > Error:\tApache has not been designed to serve pages while\n\trunning as root. There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n > Don't do that. Well i can understand its dangerous but it doesnt also let me. So that leaved me the tampering of the log files. root at nikos [~]# chmod 755 /var/log/httpd/error_log root at nikos [~]# chown nobody:nobody /var/log/httpd/error_log root at nikos [~]# chmod 755 /usr/local/apache/logs/error_log root at nikos [~]# chown nobody:nobody /usr/local/apache/logs/error_log BUT just my luck..... root at nikos [~]# [Tue Jun 04 16:16:21 2013] [error] [client 46.12.95.59] suexec failure: could not open log file [Tue Jun 04 16:16:21 2013] [error] [client 46.12.95.59] fopen: Permission denied [Tue Jun 04 16:16:21 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py [Tue Jun 04 16:16:21 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml [Tue Jun 04 16:16:24 2013] [error] [client 46.12.95.59] suexec failure: could not open log file [Tue Jun 04 16:16:24 2013] [error] [client 46.12.95.59] fopen: Permission denied [Tue Jun 04 16:16:24 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py I DONT KNOW WHAT ELSE TO TRY PLEASE HELP ILL TRY ANYTHING YOU SAY. From rosuav at gmail.com Tue Jun 4 10:33:03 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 00:33:03 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 11:17 PM, ???????? ?????? wrote: > I DONT KNOW WHAT ELSE TO TRY PLEASE HELP ILL TRY ANYTHING YOU SAY. You should try power surging your drivers. Have you got a spare power cord? ChrisA [1] http://www.oocities.org/timessquare/4753/bofh.htm From nikos.gr33k at gmail.com Tue Jun 4 10:40:47 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 07:40:47 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD2564.6080707@gmail.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> Message-ID: <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> ?? ?????, 4 ??????? 2013 5:33:03 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > > I DONT KNOW WHAT ELSE TO TRY PLEASE HELP ILL TRY ANYTHING YOU SAY. > You should try power surging your drivers. Have you got a spare power cord? Jokes are funny, but its over a week now the script is correct and the damn suexec thing doesnt let me do my job. From breamoreboy at yahoo.co.uk Tue Jun 4 10:49:47 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Tue, 04 Jun 2013 15:49:47 +0100 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> Message-ID: On 04/06/2013 15:40, ???????? ?????? wrote: > ?? ?????, 4 ??????? 2013 5:33:03 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >>> I DONT KNOW WHAT ELSE TO TRY PLEASE HELP ILL TRY ANYTHING YOU SAY. > >> You should try power surging your drivers. Have you got a spare power cord? > > Jokes are funny, but its over a week now the script is correct and the damn suexec thing doesnt let me do my job. > I don't know much about the Python suexec module, can you please explain where it's documented. Or is suexec nothing to do with Python? -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From kwpolska at gmail.com Tue Jun 4 11:06:47 2013 From: kwpolska at gmail.com (=?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?=) Date: Tue, 4 Jun 2013 17:06:47 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 4:49 PM, Mark Lawrence wrote: > I don't know much about the Python suexec module, can you please explain > where it's documented. Or is suexec nothing to do with Python? >From Wikipedia: > Apache suEXEC is a feature of the Apache Web server. It allows users to run CGI and SSI applications as a different user - normally, all web server processes run as the default web server user (often wwwrun, Apache or nobody). In other words: Nikolaos is trying to do something HORRIBLY WRONG (just like always). The proper way would be to run the python scripts through WSGI as the standard nobody user. Or do proper file permissions. And WSGI should be used through something intelligent (flask/pyramid/?) --- OT START --- On Tue, Jun 4, 2013 at 4:33 PM, Chris Angelico wrote: > You should try power surging your drivers. Have you got a spare power cord? > > ChrisA > > [1] http://www.oocities.org/timessquare/4753/bofh.htm > -- > http://mail.python.org/mailman/listinfo/python-list Please link and read at the BOFH?s page. [0] is the page and [1] is this exact story. [0]: http://bofh.ntk.net/BOFH/index.php [1]: http://bofh.ntk.net/BOFH/0000/bastard07.php -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html From rosuav at gmail.com Tue Jun 4 11:11:06 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 01:11:06 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 1:06 AM, Chris ?Kwpolska? Warrick wrote: >> [1] http://www.oocities.org/timessquare/4753/bofh.htm >> -- >> http://mail.python.org/mailman/listinfo/python-list > > Please link and read at the BOFH?s page. [0] is the page and [1] is > this exact story. > > [0]: http://bofh.ntk.net/BOFH/index.php > [1]: http://bofh.ntk.net/BOFH/0000/bastard07.php Hrm. I went poking on ntk.net but couldn't find it, so I posted a different link rather than go with no link. Thanks for finding the official page, that's what I'd prefer normally. I think SimonT mucked up something a while ago and lost himself a pile of search engine rank. ChrisA From joel.goldstick at gmail.com Tue Jun 4 11:29:16 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Tue, 4 Jun 2013 11:29:16 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 11:11 AM, Chris Angelico wrote: > On Wed, Jun 5, 2013 at 1:06 AM, Chris ?Kwpolska? Warrick > wrote: > >> [1] http://www.oocities.org/timessquare/4753/bofh.htm > >> -- > >> http://mail.python.org/mailman/listinfo/python-list > > > > Please link and read at the BOFH?s page. [0] is the page and [1] is > > this exact story. > > > > [0]: http://bofh.ntk.net/BOFH/index.php > > [1]: http://bofh.ntk.net/BOFH/0000/bastard07.php > > Hrm. I went poking on ntk.net but couldn't find it, so I posted a > different link rather than go with no link. Thanks for finding the > official page, that's what I'd prefer normally. > > I think SimonT mucked up something a while ago and lost himself a pile > of search engine rank. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list > reading this thread is like slowing down to see the car wreck on the other side of the highway. I think I feel bad for the people who are paying to host their stuff on the OP server. But maybe they get what they deserve. -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Tue Jun 4 13:02:21 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 10:02:21 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> Message-ID: <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> All these popel i host thei websiets are friend fo mine and their webpages all of them run witohut any problem. Only my perosnal webpage, which utilizes python has these kind of issues, the other pages re joomlas and dreamweavers. Please as you see i have been trying anyhting i thought of and everything i googles and been told to. But still this error insists. I'm willing to let someone with full root access to my webhost to see thigns from the inside. Does someone want to take o allok or at elast tell me what else i need to try, that hasn't been tried out yet? From rosuav at gmail.com Tue Jun 4 13:09:18 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 03:09:18 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 3:02 AM, ???????? ?????? wrote: > I'm willing to let someone with full root access to my webhost to see thigns from the inside. > > Does someone want to take o allok or at elast tell me what else i need to try, that hasn't been tried out yet? You need to read up on what happens when you enter Dummy Mode and give someone full root access to your web host. You really REALLY need to understand what that means before you offer random strangers that kind of access to someone else's data. I've half a mind to take you up on your offer, then go look for personal and private info from your clients, and email it to them (along with a link to this thread) to point out what's going on. ChrisA From nikos.gr33k at gmail.com Tue Jun 4 13:12:41 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 10:12:41 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> Message-ID: <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> ?? ?????, 4 ??????? 2013 8:09:18 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 3:02 AM, ???????? ?????? wrote: > > > I'm willing to let someone with full root access to my webhost to see thigns from the inside. > > > > > > Does someone want to take o allok or at elast tell me what else i need to try, that hasn't been tried out yet? > > > > You need to read up on what happens when you enter Dummy Mode and give > > someone full root access to your web host. You really REALLY need to > > understand what that means before you offer random strangers that kind > > of access to someone else's data. > > > > I've half a mind to take you up on your offer, then go look for > > personal and private info from your clients, and email it to them > > (along with a link to this thread) to point out what's going on. > > > > ChrisA I know what full root access mean. I also trust you. I'm hopeless man, its 1 week now dealing with this. From joel.goldstick at gmail.com Tue Jun 4 13:19:53 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Tue, 4 Jun 2013 13:19:53 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 1:12 PM, ???????? ?????? wrote: > ?? ?????, 4 ??????? 2013 8:09:18 ?.?. UTC+3, ? ??????? Chris Angelico > ??????: > > On Wed, Jun 5, 2013 at 3:02 AM, ???????? ?????? > wrote: > > > > > I'm willing to let someone with full root access to my webhost to see > thigns from the inside. > > > > > > > > > > Does someone want to take o allok or at elast tell me what else i need > to try, that hasn't been tried out yet? > > > > > > > > You need to read up on what happens when you enter Dummy Mode and give > > > > someone full root access to your web host. You really REALLY need to > > > > understand what that means before you offer random strangers that kind > > > > of access to someone else's data. > > > > > > > > I've half a mind to take you up on your offer, then go look for > > > > personal and private info from your clients, and email it to them > > > > (along with a link to this thread) to point out what's going on. > > > > > > > > ChrisA > > I know what full root access mean. > I also trust you. > I'm hopeless man, its 1 week now dealing with this. > -- > http://mail.python.org/mailman/listinfo/python-list > I trust you too Chris! -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Tue Jun 4 18:12:26 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 08:12:26 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 3:12 AM, ???????? ?????? wrote: > I know what full root access mean. > I also trust you. > I'm hopeless man, its 1 week now dealing with this. The call is strong... I could rule the galaxy alongside my father... I've searched my feelings, and I know this to be true! Okay. I accept. I'll do as I promised. Might be interesting, and educative - for someone, at least. ChrisA From nikos.gr33k at gmail.com Tue Jun 4 23:55:53 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 20:55:53 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> Message-ID: <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> ?? ???????, 5 ??????? 2013 1:12:26 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 3:12 AM, ???????? ?????? wrote: > > > I know what full root access mean. > > > I also trust you. > > > I'm hopeless man, its 1 week now dealing with this. > > > > The call is strong... I could rule the galaxy alongside my father... > > I've searched my feelings, and I know this to be true! > > > > Okay. I accept. I'll do as I promised. Might be interesting, and > > educative - for someone, at least. Good Day Chris, thanks for accepting. Please mail me and i will send you the root login credentials. Before that happens i want to tell you that i have manages to disable 'suexec' and the error now became: [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py The script though its interpretign correctly as seen from nikos at superhost.gr [~/www/cgi-bin]# python koukos.py Set-Cookie: nikos=admin; expires=Sat, 31 May 2014 03:55:16 GMT; Path=/ Content-type: text/html; charset=utf-8 ???? ??? ??? ????? ????? ??? nikos at superhost.gr [~/www/cgi-bin]# The mojabike is Greek as terminal outputs it. From wuwei23 at gmail.com Wed Jun 5 00:34:55 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 21:34:55 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> On Jun 5, 1:55?pm, ???????? ?????? wrote: > [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed > The script though its interpretign ?correctly as seen from > ni... at superhost.gr [~/www/cgi-bin]# python koukos.py Unless you're symlinking and expect us to use our psychic powers to work that out, '/home/nikos/public_html/cgi-bin/koukos.py' <> '~/www/ cgi-bin/koukos.py'. From nikos.gr33k at gmail.com Wed Jun 5 00:40:37 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 21:40:37 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> Message-ID: <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> ?? ???????, 5 ??????? 2013 7:34:55 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 1:55?pm, ???????? ?????? wrote: > > > [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed > > > > > The script though its interpretign ?correctly as seen from > > > ni... at superhost.gr [~/www/cgi-bin]# python koukos.py > > > > Unless you're symlinking and expect us to use our psychic powers to > > work that out, '/home/nikos/public_html/cgi-bin/koukos.py' <> '~/www/ > > cgi-bin/koukos.py'. Of course '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' What this has to do with what i asked? From wuwei23 at gmail.com Wed Jun 5 00:59:31 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 21:59:31 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> Message-ID: <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> On Jun 5, 2:40?pm, ???????? ?????? wrote: > Of course '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' > What this has to do with what i asked? You display an error of "No such file or directory" and you wonder why I'm trying to confirm the two locations are the same. Can you finally admit you're trolling now? From nikos.gr33k at gmail.com Wed Jun 5 01:11:35 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 22:11:35 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> Message-ID: <4f2d4d19-d53b-4ea8-931d-758cfc1120d8@googlegroups.com> ?? ???????, 5 ??????? 2013 7:59:31 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 2:40?pm, ???????? ?????? wrote: > > > Of course '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' > > > What this has to do with what i asked? > > > > You display an error of "No such file or directory" and you wonder why > I'm trying to confirm the two locations are the same. > > Can you finally admit you're trolling now? I'm not trolling, you are the one that do not understand. Here i swicthed the code from: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/www/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) to this since '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' as i said: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/public_html/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) -------------------------- nikos at superhost.gr [~/www/cgi-bin]# [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml Same error. From nikos.gr33k at gmail.com Wed Jun 5 01:11:35 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 22:11:35 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> Message-ID: <4f2d4d19-d53b-4ea8-931d-758cfc1120d8@googlegroups.com> ?? ???????, 5 ??????? 2013 7:59:31 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 2:40?pm, ???????? ?????? wrote: > > > Of course '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' > > > What this has to do with what i asked? > > > > You display an error of "No such file or directory" and you wonder why > I'm trying to confirm the two locations are the same. > > Can you finally admit you're trolling now? I'm not trolling, you are the one that do not understand. Here i swicthed the code from: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/www/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) to this since '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' as i said: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/public_html/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) -------------------------- nikos at superhost.gr [~/www/cgi-bin]# [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py [Wed Jun 05 08:09:14 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml Same error. From wuwei23 at gmail.com Wed Jun 5 01:23:12 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 22:23:12 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> <4f2d4d19-d53b-4ea8-931d-758cfc1120d8@googlegroups.com> Message-ID: <8cc2dcea-59b5-4dc8-8188-ee032eebbace@mq5g2000pbb.googlegroups.com> On Jun 5, 3:11?pm, ???????? ?????? wrote: > I'm not trolling, you are the one that do not understand. > > Here i swicthed the code from: > path = "/home/nikos/www/data/apps/" > > to this since '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' as i said: > > # Compute a set of current fullpaths > path = "/home/nikos/public_html/data/apps/" > > Same error. "/home/nikos/public_html/data/apps/" <> "/home/nikos/public_html/cgi- bin/" Are you even reading the error messages? From nikos.gr33k at gmail.com Wed Jun 5 01:58:16 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 22:58:16 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <8cc2dcea-59b5-4dc8-8188-ee032eebbace@mq5g2000pbb.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> <4f2d4d19-d53b-4ea8-931d-758cfc1120d8@googlegroups.com> <8cc2dcea-59b5-4dc8-8188-ee032eebbace@mq5g2000pbb.googlegroups.com> Message-ID: <849afdfd-761f-4046-97f0-d9f30f734bce@googlegroups.com> ?? ???????, 5 ??????? 2013 8:23:12 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 3:11?pm, ???????? ?????? wrote: > > > I'm not trolling, you are the one that do not understand. > > > > > > Here i swicthed the code from: > > > path = "/home/nikos/www/data/apps/" > > > > > > to this since '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' as i said: > > > > > > # Compute a set of current fullpaths > > > path = "/home/nikos/public_html/data/apps/" > > > > > > Same error. > > > > "/home/nikos/public_html/data/apps/" <> "/home/nikos/public_html/cgi- > > bin/" > > > > Are you even reading the error messages? What do you mean? Yes i have read the error messsage and i can't understand wht file it can't find. From rosuav at gmail.com Wed Jun 5 03:01:06 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 17:01:06 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <67660f9c-ab58-446c-a888-e94ded268015@a9g2000pbq.googlegroups.com> <1ac4a97f-789d-4583-8fc8-f021d98862f1@googlegroups.com> <4394fb26-2c82-41aa-ad45-9d0f97560c14@oy9g2000pbb.googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 2:59 PM, alex23 wrote: > On Jun 5, 2:40 pm, ???????? ?????? wrote: >> Of course '/home/nikos/public_html/cgi-bin' = '/home/nikos/www/cgi-bin' >> What this has to do with what i asked? > > You display an error of "No such file or directory" and you wonder why > I'm trying to confirm the two locations are the same. > > Can you finally admit you're trolling now? In Nikos's defense (wow that feels wrong), linking public_html and www is quite common, and his prompts have clearly shown that his username is nikos. So the commonality is at least unsurprising. He ought to have mentioned it, of course, but it's at least something well known. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 00:35:03 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 21:35:03 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: <56b0085f-b025-4314-b6dd-9566eba14bb4@googlegroups.com> Here is the script: ================================ #!/usr/bin/python # coding=utf-8 import cgitb; cgitb.enable() import cgi, os, sys, locale, codecs from http import cookies #needed line, script does *not* work without it sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach()) # initialize cookie cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) nikos = cookie.get('nikos') # if visitor cookie does exist if nikos: message = "??? ??? ??????? ???????? ??? ?? ?? ????????? ?? ????????? ?????????? ??? ???????!" cookie['nikos'] = 'admin' cookie['nikos']['path'] = '/' cookie['nikos']['expires'] = -1 #this cookie will expire now else: message = "??? ?? ??? ??? ???? ??? ?? ????, ??? ?? ????, ??? ?? ??????! ?? ????? ????? ? ??????? ??????????!!" cookie['nikos'] = 'admin' cookie['nikos']['path'] = '/' cookie['nikos']['expires'] = 60*60*24*30*12 #this cookie will expire in a year print( cookie, "Content-type: text/html; charset=utf-8\n", message ) sys.exit(0) =================================== This doesn't make sense to me at all.I'll iam tryign to set is a cookie, iwas so happy finally disablin bloody 'suexec' and now this. [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py From rosuav at gmail.com Wed Jun 5 04:09:50 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 18:09:50 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 1:55 PM, ???????? ?????? wrote: > Good Day Chris, thanks for accepting. > > Please mail me and i will send you the root login credentials. Well, I wasn't sure whether this would actually happen or not, but it did. I made it fairly clear to him in multiple posts that I was NOT going to sort out all his problems, yet he clearly did not read that, and has seen fit to compromise his security to the extreme extent of giving his *ROOT PASSWORD* to a total stranger over the internet. With that power, I could have done anything. I could have wiped out all his clients' data. I could have searched through his database content for credit cards, customer information, the works. But I didn't; I merely placed a small file in the public_html directory of each of the twelve web sites he has hosted: http://superhost.gr/Hello_from_Rosuav http://leonidasgkelos.com/Hello_from_Rosuav http://parking-byzantio.gr/Hello_from_Rosuav ... and nine others I have also contacted all the site owners who had a .contactemail file in their home directories, informing them of the situation. Oh, and I changed the root password, since the current one was sent in clear text across the internet. Nikos, the new password has been stored in /home/nikos/new_password - you should be able to access that using your non-root login. I recommend you change it immediately. Peanut gallery, did I make it sufficiently clear beforehand that giving out your root password is a bad idea? ChrisA From storchaka at gmail.com Wed Jun 5 10:46:57 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 05 Jun 2013 17:46:57 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: 05.06.13 11:09, Chris Angelico ???????(??): > Oh, and I changed the root password, since the current one was sent in > clear text across the internet. Nikos, the new password has been > stored in /home/nikos/new_password - you should be able to access that > using your non-root login. I recommend you change it immediately. What are permission modes of /home/nikos and /home/nikos/new_password? From rosuav at gmail.com Wed Jun 5 12:37:47 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 02:37:47 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 12:46 AM, Serhiy Storchaka wrote: > 05.06.13 11:09, Chris Angelico ???????(??): >> >> Oh, and I changed the root password, since the current one was sent in >> clear text across the internet. Nikos, the new password has been >> stored in /home/nikos/new_password - you should be able to access that >> using your non-root login. I recommend you change it immediately. > > > What are permission modes of /home/nikos and /home/nikos/new_password? I didn't actually fiddle with that, but you're right, I ought to have ensured that the password file was mode 600. However, I don't think it would have made a lot of difference; mainly I was wanting to guard against randoms on the internet, not actual legit users of his system (and even they may well not have shell access). ChrisA From nikos.gr33k at gmail.com Wed Jun 5 13:05:20 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 10:05:20 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: <4e6be3f5-8840-49b7-8385-e9ad9a14b50e@googlegroups.com> ?? ???????, 5 ??????? 2013 7:37:47 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 12:46 AM, Serhiy Storchaka wrote: > > > 05.06.13 11:09, Chris Angelico ???????(??): > > >> > > >> Oh, and I changed the root password, since the current one was sent in > > >> clear text across the internet. Nikos, the new password has been > > >> stored in /home/nikos/new_password - you should be able to access that > > >> using your non-root login. I recommend you change it immediately. > > > > > > > > > What are permission modes of /home/nikos and /home/nikos/new_password? > > > > I didn't actually fiddle with that, but you're right, I ought to have > > ensured that the password file was mode 600. However, I don't think it > > would have made a lot of difference; mainly I was wanting to guard > > against randoms on the internet, not actual legit users of his system > > (and even they may well not have shell access). I grant shell access to very new account i create but some of my customers dont evn know the existance of linux, and the other that do, have no idea of what a shell access is. But i grant them the ability just in cae for future usage. Most of them are doign the work via cPanel tools. From rosuav at gmail.com Wed Jun 5 13:19:05 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 03:19:05 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <4e6be3f5-8840-49b7-8385-e9ad9a14b50e@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <4e6be3f5-8840-49b7-8385-e9ad9a14b50e@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 3:05 AM, ???????? ?????? wrote: > I grant shell access to very new account i create but some of my customers dont evn know the existance of linux, and the other that do, have no idea of what a shell access is. But i grant them the ability just in cae for future usage. > > Most of them are doign the work via cPanel tools. I would strongly recommend NOT giving shell access, then. The chances are low that they'll ever need it, and you improve your security significantly by closing it off. On Thu, Jun 6, 2013 at 3:07 AM, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 7:35:48 ?.?. UTC+3, ? ??????? Joel Goldstick ??????: > >>To solve the OPs problems once and for all, I believe we need to know his >social security number and his mother's maiden name. (Yes, i know SSN is for US >but... ) > > Even if i gibe you that info, what can you possibly expect to happen? > Gain access to my Gmail account because you stuck in its security question? What about: gain access to your bank account the same way? How would you feel about random people on the internet having the ability to transfer money on your behalf? ChrisA From nikos.gr33k at gmail.com Wed Jun 5 10:56:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 07:56:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: <87951bdb-5e41-4e32-8912-ae82c9b035d3@googlegroups.com> ?? ???????, 5 ??????? 2013 5:46:57 ?.?. UTC+3, ? ??????? Serhiy Storchaka ??????: > 05.06.13 11:09, Chris Angelico ???????(??): > > > Oh, and I changed the root password, since the current one was sent in > > > clear text across the internet. Nikos, the new password has been > > > stored in /home/nikos/new_password - you should be able to access that > > > using your non-root login. I recommend you change it immediately. > > > > What are permission modes of /home/nikos and /home/nikos/new_password? nikos at superhost.gr [~/www]# pwd /home/nikos/www nikos at superhost.gr [~/www]# ls -ld ../ drwx--x--x 24 nikos nikos 4096 Jun 5 11:28 ..// nikos at superhost.gr [~/www]# From nikos.gr33k at gmail.com Wed Jun 5 04:26:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 01:26:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> Message-ID: <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> ?? ???????, 5 ??????? 2013 11:09:50 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 1:55 PM, ???????? ?????? wrote: > > > Good Day Chris, thanks for accepting. > > > > > > Please mail me and i will send you the root login credentials. > > > > Well, I wasn't sure whether this would actually happen or not, but it did. > > > > I made it fairly clear to him in multiple posts that I was NOT going > > to sort out all his problems, yet he clearly did not read that, and > > has seen fit to compromise his security to the extreme extent of > > giving his *ROOT PASSWORD* to a total stranger over the internet. > > > > With that power, I could have done anything. I could have wiped out > > all his clients' data. I could have searched through his database > > content for credit cards, customer information, the works. But I > > didn't; I merely placed a small file in the public_html directory of > > each of the twelve web sites he has hosted: > > > > http://superhost.gr/Hello_from_Rosuav > > http://leonidasgkelos.com/Hello_from_Rosuav > > http://parking-byzantio.gr/Hello_from_Rosuav > > ... and nine others > > > > I have also contacted all the site owners who had a .contactemail file > > in their home directories, informing them of the situation. > > > > Oh, and I changed the root password, since the current one was sent in > > clear text across the internet. Nikos, the new password has been > > stored in /home/nikos/new_password - you should be able to access that > > using your non-root login. I recommend you change it immediately. > > > > Peanut gallery, did I make it sufficiently clear beforehand that > > giving out your root password is a bad idea? > > > > ChrisA I gave you out of my good and trustworthy heart my root password so for you to look upon my systrem configuration and all you did was trying to fuck me by sending mails to my clients? How am i suppose to change the roor password from a normal user account?("nikos")? Other 3 times i hve gavein people my root password and they all trid to help me out, only you screwed me like this. If i lose some of my clients, will you been paying for the money loss? Do you think this server i rent comes for free with cPanel, Softaculous and other licenses? Fuck you. From rosuav at gmail.com Wed Jun 5 04:41:55 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 18:41:55 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 6:26 PM, ???????? ?????? wrote: > > I gave you out of my good and trustworthy heart my root password so for you to look upon my systrem configuration and all you did was trying to fuck me by sending mails to my clients? That would be "trusting", not "trustworthy", and I did make it pretty clear what I was proposing. > How am i suppose to change the roor password from a normal user account?("nikos")? You don't. You log in as the normal user and look in your normal user's home directory. In there, you will find a file giving you the root password. It's safer that way; everything's done over SSH. > Other 3 times i hve gavein people my root password and they all trid to help me out, only you screwed me like this. > > If i lose some of my clients, will you been paying for the money loss? No, I will not. I never made you any promise. If you lose some of your clients, it is because you have made some very poor decisions, including to tinker live with this server instead of having a staging area. All I've done is give your clients a chance to know what you're doing with their data, which I think is fair enough. > Do you think this server i rent comes for free with cPanel, Softaculous and other licenses? Of course not. (In my opinion, cpanel is ridiculously overpriced.) Most of these sorts of things are either overkill, or utterly trivial; if you need it, the price is immaterial, but most people simply don't. Before you get too angry at me, ask yourself this question: Would you stand for someone giving out access to your system to a third party? Because that's exactly what you did to your clients. You gave me, a perfect stranger, full access to *THEIR* data. Do you understand how serious that is? In addition, you posted me the password in clear text via email. That's why I changed it - it's entirely possible someone saw the password in transmission. This matter is far more serious than you seem to be giving it consideration for. You complain that I violated your trust; you violated the trust of people who are paying you money. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 04:53:32 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 01:53:32 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> Message-ID: <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> ?? ???????, 5 ??????? 2013 11:41:55 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 6:26 PM, ???????? ?????? wrote: > > > > > > I gave you out of my good and trustworthy heart my root password so for you to look upon my systrem configuration and all you did was trying to fuck me by sending mails to my clients? > > > > That would be "trusting", not "trustworthy", and I did make it pretty > > clear what I was proposing. > > > > > How am i suppose to change the roor password from a normal user account?("nikos")? > > > > You don't. You log in as the normal user and look in your normal > > user's home directory. In there, you will find a file giving you the > > root password. It's safer that way; everything's done over SSH. > > > > > Other 3 times i hve gavein people my root password and they all trid to help me out, only you screwed me like this. > > > > > > If i lose some of my clients, will you been paying for the money loss? > > > > No, I will not. I never made you any promise. If you lose some of your > > clients, it is because you have made some very poor decisions, > > including to tinker live with this server instead of having a staging > > area. All I've done is give your clients a chance to know what you're > > doing with their data, which I think is fair enough. > > > > > Do you think this server i rent comes for free with cPanel, Softaculous and other licenses? > > > > Of course not. (In my opinion, cpanel is ridiculously overpriced.) > > Most of these sorts of things are either overkill, or utterly trivial; > > if you need it, the price is immaterial, but most people simply don't. > > > > Before you get too angry at me, ask yourself this question: Would you > > stand for someone giving out access to your system to a third party? > > Because that's exactly what you did to your clients. You gave me, a > > perfect stranger, full access to *THEIR* data. Do you understand how > > serious that is? In addition, you posted me the password in clear text > > via email. That's why I changed it - it's entirely possible someone > > saw the password in transmission. > > > > This matter is far more serious than you seem to be giving it > > consideration for. You complain that I violated your trust; you > > violated the trust of people who are paying you money. > > > > ChrisA So, iam to blame this for trusting you? YOU COULD HAVE ACTUALLY TRIED TO SEE WHATS WRONG WITH 'FILES.PY' INSTEAD OF CREATING TEXT FIELS AND COPIED THEM ALL OVER THE CLIENTS HOME DIRECTORY FOLDERS AND MAIL THEM TOO. IF YOU DIDNT WANTED TO DO THAT THEN YOU COULD AHVE SAID TO ME, NIKOS I DONT FEEL LIKE LOGGING TO YOUR SYSTEM BECAUSE I DONT REALLY WANTED TO HELP YOU OUT. BUT NO, YOU WANTED TO MAKE AN IMPRESSION BY SCREWING ME. I ALSO HAVE GIVEN ROOT ACCESS TO ANOTHER MEMBER OF THIS LIST AND HE IN FACT TRIED TO HELP ME INSTEAD OF DOING WHAT YOU DID. AND FROM 2 OTHER PEOPLE AS SOME OTHER FORUMS TOO. YOU NEVER BOTHERED TAKING A LOOK AT THE ENCODING ISSUE. I WONT TALK TO YOU AGAIN. YOU MADE A FALSE PROMISE OF HELPING ME AND THEN SCREWED ME. FUCK YOU AND NO I DONT MIND THE LANGUAGE. From wuwei23 at gmail.com Wed Jun 5 04:58:53 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 01:58:53 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <95d45cc9-394a-4ff5-89f3-d0ba56c6b1bf@v5g2000pbv.googlegroups.com> On Jun 5, 6:53?pm, ???????? ?????? wrote: > So, iam to blame this for trusting you? I'm sure you were smart enough to get Chris to sign a contract before giving him the keys to your kingdom, no? From rosuav at gmail.com Wed Jun 5 05:05:36 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:05:36 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 6:53 PM, ???????? ?????? wrote: > So, iam to blame this for trusting you? Your clients trust you to not compromise their security. You compromised their security by giving the root password to a stranger. > YOU COULD HAVE ACTUALLY TRIED TO SEE WHATS WRONG WITH 'FILES.PY' INSTEAD OF CREATING TEXT FIELS AND COPIED THEM ALL OVER THE CLIENTS HOME DIRECTORY FOLDERS AND MAIL THEM TOO. > > IF YOU DIDNT WANTED TO DO THAT THEN YOU COULD AHVE SAID TO ME, NIKOS I DONT FEEL LIKE LOGGING TO YOUR SYSTEM BECAUSE I DONT REALLY WANTED TO HELP YOU OUT. When did I ever give the impression that I wanted to help? When did I ever actually ask you for that power? No, you kept trying to thrust it on us as part of your demands for assistance. > I ALSO HAVE GIVEN ROOT ACCESS TO ANOTHER MEMBER OF THIS LIST AND HE IN FACT TRIED TO HELP ME INSTEAD OF DOING WHAT YOU DID. AND FROM 2 OTHER PEOPLE AS SOME OTHER FORUMS TOO. So... your root account has fairly public access. Did you notify your clients that half a dozen random people have full access to their server? Can you prove to them that their private data is, indeed, private? > I WONT TALK TO YOU AGAIN. YOU MADE A FALSE PROMISE OF HELPING ME AND THEN SCREWED ME. What promise? I never promised to help. Go read my posts... I would have said "reread" except that you never read them in the first place. Just be aware, I didn't actually hurt you in any way. I changed your root password to protect it, but you still have access. The only harm that could come from this is that your clients are now aware of the risks they are taking by remaining with you. I'm stripping away the veil and exposing the truth. Nothing more. And now, we're very much off-topic for python-list, but I think it's a good thing for other potential server-maintainers to be aware of. Trust is a very precious thing. ChrisA From modelnine at modelnine.org Wed Jun 5 05:04:15 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 11:04:15 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <51AEFF0F.50605@modelnine.org> Am 05.06.2013 10:53, schrieb ???????? ??????: > I ALSO HAVE GIVEN ROOT ACCESS TO ANOTHER MEMBER OF THIS LIST AND HE IN FACT TRIED TO HELP ME INSTEAD OF DOING WHAT YOU DID. AND FROM 2 OTHER PEOPLE AS SOME OTHER FORUMS TOO. You know what you're saying there? You've given (at least) four people you don't know at all (you know, on the internet nobody knows you're a dog and stuff) - and as such shouldn't trust them at all, either - free and full admission to a system that critical for you. That's like handing out keys to the front door of your home to any passer-by on the street who you feel like talking to - and then later wondering why your belongings are suddenly gone. Seeing how riled up you get about this, what Chris did is for the better. At least it seems that you won't be able to change your root password back, either, and as such you won't have root access anymore to your system for the time being, which makes your system and the internets a safer place for now. -- --- Heiko. From rosuav at gmail.com Wed Jun 5 05:19:22 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:19:22 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <51AEFF0F.50605@modelnine.org> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: On Wed, Jun 5, 2013 at 7:04 PM, Heiko Wundram wrote: > Seeing how riled up you get about this, what Chris did is for the better. At > least it seems that you won't be able to change your root password back, > either, and as such you won't have root access anymore to your system for > the time being, which makes your system and the internets a safer place for > now. Not quite accurate; he can change his root password back as soon as he logs in as the non-root user and cats one little file. Actually, I just tested, and the password I set is no longer valid, so I'm guessing he's already done so... either that, or a third party who was previously given access has now changed the password to something else. ChrisA From modelnine at modelnine.org Wed Jun 5 05:29:10 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 11:29:10 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: <51AF04E6.8030907@modelnine.org> Am 05.06.2013 11:19, schrieb Chris Angelico: > Not quite accurate; he can change his root password back as soon as he > logs in as the non-root user and cats one little file. I understood that - I rather got the impression that he (as a person) wasn't technically capable of changing it. Alas, the internets didn't remain a better place for long. :-) -- --- Heiko. From nikos.gr33k at gmail.com Wed Jun 5 05:33:04 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:33:04 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: ?? ???????, 5 ??????? 2013 12:29:10 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: > Am 05.06.2013 11:19, schrieb Chris Angelico: > > > Not quite accurate; he can change his root password back as soon as he > > > logs in as the non-root user and cats one little file. > > > > I understood that - I rather got the impression that he (as a person) > > wasn't technically capable of changing it. Alas, the internets didn't > > remain a better place for long. :-) It will remain, if you go away. From modelnine at modelnine.org Wed Jun 5 05:55:49 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 11:55:49 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: <51AF0B25.70605@modelnine.org> Am 05.06.2013 11:33, schrieb ???????? ??????: > It will remain, if you go away. Look, pal, I work as a programmer for a (medium size) network service provider, and due to that I (should) know my networking security 101. It's generally people like you who are: 1) extremely careless about their system 2) intolerably naive and persistently refusing to learn and who as a consequence hand out root logins for hosts with big (!) pipes to people that should - under no circumstances ever, EVER - be trusted, who are in turn causing the scourge of the public internets that's called a botnet. It doesn't matter whether you're simply so stupid (yes, I said it!) as to hand out actual root logins or whether you refuse to update your system or whether you use weak passwords: in all cases, your system is compromised, and due to the rather big pipe that your system has it in turn compromises the integrity of the whole network that the system is connected to. Chris is completely right: you shouldn't thank him for not doing 'rm -rf /' on your system (that's utter peanuts, and only hits you), you should rather thank him for not copying your complete client data (and in turn their client's data, let's talk about identity theft) and/or for not installing a bot on your system which would in turn cause me to have headaches when the bot's misused to DDoS or for any other form of network-based attack on the network that I need to administer. It's you who's the untrustworthy, completely unreliable and utterly irresponsible member of the community of networks that's called the Internet. Please go somewhere else. -- --- Heiko. From nikos.gr33k at gmail.com Wed Jun 5 06:21:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 03:21:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: ?? ???????, 5 ??????? 2013 12:55:49 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: > Am 05.06.2013 11:33, schrieb ???????????????????????? ??????????????????: > It's you who's the untrustworthy, completely unreliable and utterly > irresponsible member of the community of networks that's called the > Internet. I dont care what you do for a living, you never helped me a bit in anything, you just presented to me your self 1 hour ago to join the party. > Please go somewhere else. Please sod off from my thread. Thank you. From modelnine at modelnine.org Wed Jun 5 06:33:48 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 12:33:48 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <51AEFF0F.50605@modelnine.org> Message-ID: <51AF140C.4040306@modelnine.org> Am 05.06.2013 12:21, schrieb ???????? ??????: > I dont care what you do for a living, you never helped me a bit in anything, you just presented to me your self 1 hour ago to join the party. Guess why I did so: you're presently touching a subject (network safety) that I hold dear, and not only being a troll. -- --- Heiko. From nikos.gr33k at gmail.com Wed Jun 5 05:14:04 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:14:04 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 12:05:36 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 6:53 PM, ???????? ?????? wrote: > > > So, iam to blame this for trusting you? > > > > Your clients trust you to not compromise their security. You > > compromised their security by giving the root password to a stranger. > > > > > YOU COULD HAVE ACTUALLY TRIED TO SEE WHATS WRONG WITH 'FILES.PY' INSTEAD OF CREATING TEXT FIELS AND COPIED THEM ALL OVER THE CLIENTS HOME DIRECTORY FOLDERS AND MAIL THEM TOO. > > > > > > IF YOU DIDNT WANTED TO DO THAT THEN YOU COULD AHVE SAID TO ME, NIKOS I DONT FEEL LIKE LOGGING TO YOUR SYSTEM BECAUSE I DONT REALLY WANTED TO HELP YOU OUT. > > > > When did I ever give the impression that I wanted to help? When did I > > ever actually ask you for that power? No, you kept trying to thrust it > > on us as part of your demands for assistance. > > > > > I ALSO HAVE GIVEN ROOT ACCESS TO ANOTHER MEMBER OF THIS LIST AND HE IN FACT TRIED TO HELP ME INSTEAD OF DOING WHAT YOU DID. AND FROM 2 OTHER PEOPLE AS SOME OTHER FORUMS TOO. > > > > So... your root account has fairly public access. Did you notify your > > clients that half a dozen random people have full access to their > > server? Can you prove to them that their private data is, indeed, > > private? > > > > > I WONT TALK TO YOU AGAIN. YOU MADE A FALSE PROMISE OF HELPING ME AND THEN SCREWED ME. > > > > What promise? I never promised to help. Go read my posts... I would > > have said "reread" except that you never read them in the first place. > > > > Just be aware, I didn't actually hurt you in any way. I changed your > > root password to protect it, but you still have access. The only harm > > that could come from this is that your clients are now aware of the > > risks they are taking by remaining with you. I'm stripping away the > > veil and exposing the truth. Nothing more. > > > > And now, we're very much off-topic for python-list, but I think it's a > > good thing for other potential server-maintainers to be aware of. > > Trust is a very precious thing. > > > > ChrisA TODAY I READ YOUR POSTS THAT YOU ACTUALLY OFFERED TO LOG INTO MY SERVER. THAT WOULD IMPLY THAT YOU WANTED TO HELP OUT AND THATS WHY YOU OFFERED. I AKSED YOU FOR YOUR MAIL THEN AND YOU SEND ME A PRIVATE MAIL TO SEND YOU THE DATA. THEN I AGVE IT TO YOU. SHOULD I HAVE ASKED YOU EXPLICITLY BY MAIL TO 'ACTUALLY TRY TO HELP ME INSTEAD OF SCREW MY BUSINESS'? I TRUSTED YOU BECASUE I WAS UNDER THE IMPRESSION YOU COULD HELP ME WITH THIS ISSUES I;VE BEEN STRUGGLING. NEXT THIS YOU'RE GONNA TELL ME IS TO BE HAPPY THAT YOU DIDN'T WIPE THE WHOLE SYSTEM OUT BY 'RM -RF /' GO TO HELL. From rosuav at gmail.com Wed Jun 5 05:27:20 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:27:20 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 7:14 PM, ???????? ?????? wrote: > NEXT THIS YOU'RE GONNA TELL ME IS TO BE HAPPY THAT YOU DIDN'T WIPE THE WHOLE SYSTEM OUT BY 'RM -RF /' Yes. Actually, yes. Do you understand now what you have done by giving your password to multiple people? This is *completely* different from asking for help. You are giving someone complete access to do ANYTHING and without even being logfiled (try it - can you find out what I did? You'll be able to find a few things, like what IP addresses I logged in from, but not everything); this is something that you simply do not EVER do. And rm -rf / (by the way, it wouldn't work if I shouted at your computer the way you're shouting at me) is actually not the worst thing I could do. If one of your clients accepts credit cards from his customers and stores them, I could compromise your client's customers. They have a measure of trust in the web server; you are betraying that trust by letting me in. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 05:32:27 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:32:27 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> ?? ???????, 5 ??????? 2013 12:27:20 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 7:14 PM, ???????? ?????? wrote: > > > NEXT THIS YOU'RE GONNA TELL ME IS TO BE HAPPY THAT YOU DIDN'T WIPE THE WHOLE SYSTEM OUT BY 'RM -RF /' > > > > Yes. Actually, yes. Do you understand now what you have done by giving > > your password to multiple people? This is *completely* different from > > asking for help. You are giving someone complete access to do ANYTHING > > and without even being logfiled (try it - can you find out what I did? > > You'll be able to find a few things, like what IP addresses I logged > > in from, but not everything); this is something that you simply do not > > EVER do. > > > > And rm -rf / (by the way, it wouldn't work if I shouted at your > > computer the way you're shouting at me) is actually not the worst > > thing I could do. If one of your clients accepts credit cards from his > > customers and stores them, I could compromise your client's customers. > > They have a measure of trust in the web server; you are betraying that > > trust by letting me in. iI got back root access and i 'rm -y /home/user/public_html/Hello_from_ROSUAV' so to delete your deface. Thank God you just placed that text file there and did not deface frontpages. Then i run 'history' to see what exactly you ahve typed but the history log only showed me my own commands. From rosuav at gmail.com Wed Jun 5 05:41:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:41:02 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 7:32 PM, ???????? ?????? wrote: > iI got back root access and i > > 'rm -y /home/user/public_html/Hello_from_ROSUAV' > so to delete your deface. Thank God you just placed that text file there and did not deface frontpages. Indeed. That's one of the few truly accurate statements you've made. I am a God-fearing man, a Christian, a man of ethics, and that is why I did not deface anything. All I did was create those files and read a few little pieces like the .contactemail nuggets (btw, thanks - those are the very people who have the right to know about this). > Then i run 'history' to see what exactly you ahve typed but the history log only showed me my own commands. Precisely. My commands are not in your .bash_history file. Someone could have done anything and you wouldn't even know. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 05:46:13 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:46:13 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <51AD70E8.70506@gmail.com> <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com> <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com> <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> <03d8964e-7cea-4072-b1f1-19d83e494191@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> Message-ID: <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> And here us Alex23 private mail that sent out to me: On Jun 5, 7:06 pm, ???????? ?????? wrote: > There would have been no violation if he just look into en encoding issue and not meddled with my customers mail and data. "Waaah, why didn't this stranger do my job for me for free? I'm so confused!" > Alex23, you are the *WORST* character i ever encountered in this list and forums in gernal. Hooray! You probably haven't noticed because you don't give a shit about any other problems here but your own, but I do help people on this list, when it's clear they actually want to learn and not just palm off their confusion onto other people. What I don't do is some lazy dickwad's work for him; I get enough of that from my project managers. I don't suffer fools gladly, and boy, are you ever a fool. > Idiot and ignorant too not knowing that ~/www is a symlink to ~/public_html and pretending to help. Firstly, that's why I _asked_ if they were the same. Secondly, excuse me if I don't set up my web servers using shitty obsolete mechanisms like CGI. And given I'm not the one who's handing out root access to his commercial server like it's candy, you really shouldn't be throwing terms like "ignorant" around. > Fuck you too and sod off. You're such a charmer What a fucker... From wuwei23 at gmail.com Wed Jun 5 05:49:13 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 02:49:13 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> Message-ID: <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> On Jun 5, 7:46?pm, ???????? ?????? wrote: > And here us Alex23 private mail that sent out to me: Which I spared the list from because it was off-topic, but I don't think that's a concept you're overly familiar with given your posting history. From nikos.gr33k at gmail.com Wed Jun 5 06:32:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 03:32:42 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> Message-ID: <09415a13-43ee-4fec-80f9-1261d3aa8485@googlegroups.com> ?? ???????, 5 ??????? 2013 12:49:13 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 7:46?pm, ???????? ?????? wrote: > > > And here us Alex23 private mail that sent out to me: > > > > Which I spared the list from because it was off-topic, but I don't > > think that's a concept you're overly familiar with given your posting > > history. You spare it from the list because you wanted to bitch in private. Now sod off. From breamoreboy at yahoo.co.uk Wed Jun 5 09:23:01 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 14:23:01 +0100 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <09415a13-43ee-4fec-80f9-1261d3aa8485@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> <09415a13-43ee-4fec-80f9-1261d3aa8485@googlegroups.com> Message-ID: On 05/06/2013 11:32, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 12:49:13 ?.?. UTC+3, ? ??????? alex23 ??????: >> On Jun 5, 7:46 pm, ???????? ?????? wrote: >> >>> And here us Alex23 private mail that sent out to me: >> >> >> >> Which I spared the list from because it was off-topic, but I don't >> >> think that's a concept you're overly familiar with given your posting >> >> history. > > You spare it from the list because you wanted to bitch in private. > Now sod off. > Never in the field of the internet has so much been owed to so many by so few. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From steve+comp.lang.python at pearwood.info Wed Jun 5 23:57:08 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 03:57:08 GMT Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> <09415a13-43ee-4fec-80f9-1261d3aa8485@googlegroups.com> Message-ID: <51b00894$0$29966$c3e8da3$5496439d@news.astraweb.com> On Wed, 05 Jun 2013 03:32:42 -0700, ???????? ?????? wrote: [...] > You spare it from the list because you wanted to bitch in private. Now > sod off. ????????, please stop trading insults with people who you feel have wronged you. If somebody gives you deliberately bad advice, that is one thing. Otherwise, please try to ignore their insults rather than throwing fuel on the fire by insulting back. But please also try to learn from them! Most of the criticisms given have been valid, even if put rudely. For example, this thread, and related threads, are ENORMOUS. I cannot keep track of all the issues. Please try not to make this thread unnecessarily complicated with rapid fire responses that don't help. * Please think before you reply. Does your reply *help* the conversation, or make it worse? * Please stop making multiple changes at once. It makes it hard to see what causes the breakage. * If you change something, and it breaks, undo the change, then experiment outside of your live system to try to understand and fix the issue. As for everyone else, please try to be polite and helpful, or don't reply at all. Thank you. -- Steven From nikos.gr33k at gmail.com Thu Jun 6 00:08:16 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 21:08:16 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <51b00894$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <41bef3a4-577f-42d4-a93e-48e7704428f2@googlegroups.com> <5f463e95-aaff-430a-baca-b12a7cde02a5@googlegroups.com> <76db4468-4b5e-487a-858b-eb77789e979f@g5g2000pbp.googlegroups.com> <09415a13-43ee-4fec-80f9-1261d3aa8485@googlegroups.com> <51b00894$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <2027c764-6a03-47c5-acae-3a666e161722@googlegroups.com> ?? ??????, 6 ??????? 2013 6:57:08 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > On Wed, 05 Jun 2013 03:32:42 -0700, ???????? ?????? wrote: > > > > [...] > > > You spare it from the list because you wanted to bitch in private. Now > > > sod off. > > > > ????????, please stop trading insults with people who you feel have > > wronged you. > > > > If somebody gives you deliberately bad advice, that is one thing. > > Otherwise, please try to ignore their insults rather than throwing fuel > > on the fire by insulting back. > > > > But please also try to learn from them! Most of the criticisms given have > > been valid, even if put rudely. > > > > For example, this thread, and related threads, are ENORMOUS. I cannot > > keep track of all the issues. Please try not to make this thread > > unnecessarily complicated with rapid fire responses that don't help. > > > > * Please think before you reply. Does your reply *help* the > > conversation, or make it worse? > > > > * Please stop making multiple changes at once. It makes it hard to see > > what causes the breakage. > > > > * If you change something, and it breaks, undo the change, then > > experiment outside of your live system to try to understand and fix the > > issue. > > > > > > As for everyone else, please try to be polite and helpful, or don't reply > > at all. > > > > > > Thank you. > > > > > > -- > > Steven Okey as, you ahve seen form yesterday night(Greek time) i have stopped answering to this thread. I have said what needed ot be heard. From nikos.gr33k at gmail.com Wed Jun 5 05:19:53 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:19:53 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 12:04:15 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: > Am 05.06.2013 10:53, schrieb ???????????????????????? ??????????????????: > > > I ALSO HAVE GIVEN ROOT ACCESS TO ANOTHER MEMBER OF THIS LIST AND HE IN FACT TRIED TO HELP ME INSTEAD OF DOING WHAT YOU DID. AND FROM 2 OTHER PEOPLE AS SOME OTHER FORUMS TOO. > > > > You know what you're saying there? You've given (at least) four people > > you don't know at all (you know, on the internet nobody knows you're a > > dog and stuff) - and as such shouldn't trust them at all, either - free > > and full admission to a system that critical for you. That's like > > handing out keys to the front door of your home to any passer-by on the > > street who you feel like talking to - and then later wondering why your > > belongings are suddenly gone. > > > > Seeing how riled up you get about this, what Chris did is for the > > better. At least it seems that you won't be able to change your root > > password back, either, and as such you won't have root access anymore to > > your system for the time being, which makes your system and the > > internets a safer place for now. I'am a perosn that eaisly trust other people to have ethics, especially python programmers who knows how difficult its to debug a script and have it working. Some people can be trusted, and actually try to help. Some dont. Chris is na example of the latter. At least he didnt wipe the whoile system out. And i do have access of my system 30 mins now. And yes i will again root access to another person, which i beleive he can be trsuted and give me some friendly help. Tha is all i have to say and i'm not naive or fool. As i said some people can actually be trusted. From rosuav at gmail.com Wed Jun 5 05:31:37 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:31:37 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 7:19 PM, ???????? ?????? wrote: > I'am a perosn that eaisly trust other people to have ethics, especially python programmers who knows how difficult its to debug a script and have it working. > Some people can be trusted, and actually try to help. > Some dont. > Chris is na example of the latter. At least he didnt wipe the whoile system out. I've actually tried on MANY occasions to help you. I have put in a number of hours of volunteer time researching and posting for you, which I don't regret only because the list is of value to more people than just the one who asked the question. You are unhelpable. > And i do have access of my system 30 mins now. > And yes i will again root access to another person, which i beleive he can be trsuted and give me some friendly help. > > Tha is all i have to say and i'm not naive or fool. > As i said some people can actually be trusted. So you'll casually give out your root password again, yet you think you are not naive? The next person you meet might actually do you some harm. You most definitely *are* a fool. ChrisA From breamoreboy at yahoo.co.uk Wed Jun 5 09:25:01 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 14:25:01 +0100 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On 05/06/2013 10:31, Chris Angelico wrote: > > You most definitely *are* a fool. > > ChrisA > I believe the above is just plain wrong. A fool and his money are easily parted, but this guy won't part with his cash. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From nikos.gr33k at gmail.com Wed Jun 5 05:37:05 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:37:05 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 12:31:37 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 7:19 PM, ???????? ?????? wrote: > > > I'am a perosn that eaisly trust other people to have ethics, especially python programmers who knows how difficult its to debug a script and have it working. > > > Some people can be trusted, and actually try to help. > > > Some dont. > > > Chris is na example of the latter. At least he didnt wipe the whoile system out. > > > > I've actually tried on MANY occasions to help you. I have put in a > > number of hours of volunteer time researching and posting for you, > > which I don't regret only because the list is of value to more people > > than just the one who asked the question. You are unhelpable. > > > > > And i do have access of my system 30 mins now. > > > And yes i will again root access to another person, which i beleive he can be trsuted and give me some friendly help. > > > > > > Tha is all i have to say and i'm not naive or fool. > > > As i said some people can actually be trusted. > > > > So you'll casually give out your root password again, yet you think > > you are not naive? The next person you meet might actually do you some > > harm. > > > > You most definitely *are* a fool. TheRE is this saying that applis to you: A THIEF BELEIVES EVERYBODY STEALS. You do not trust people because you think all of them are likely to screw you, when its the other way around. From rosuav at gmail.com Wed Jun 5 05:48:53 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 19:48:53 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <4b65cdfe-b6c2-4d97-8623-77b10711bf78@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 7:37 PM, ???????? ?????? wrote: > TheRE is this saying that applis to you: > A THIEF BELEIVES EVERYBODY STEALS. > > You do not trust people because you think all of them are likely to screw you, when its the other way around. You really need to do a basic course in internet security. Why do we have SSL? Is it because everyone's honest and trustworthy? Why do you access your server using a password in the first place? I mean, if people are honest, wouldn't it be fine to just use TELNET and simply enter your name to get access? Please don't misunderstand me. If I hated you, thought you worthless, and/or was angry at you, I would not be trying to explain this; you would have been in my killfile weeks ago and I would not even be aware of your problems. I think you have the capacity to learn and improve, but you really need to put some effort into figuring out what you're doing. I dread to think what you're charging your clients for the shoddy service you're offering them. With ten clients, you're probably having to charge them the equivalent of $US50/year just for cpanel, on top of all your other costs. No wonder the economy of Greece is in trouble. ChrisA From wuwei23 at gmail.com Wed Jun 5 05:52:41 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 02:52:41 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Jun 5, 7:48?pm, Chris Angelico wrote: > No wonder the economy of Greece is in trouble. This isn't addressed just to Chris, as this isn't the first time the joke has been made, but could we not? There's a term for applying the failings of an individual to an entire genetic or cultural collective, and it isn't a pretty one. From rosuav at gmail.com Wed Jun 5 06:12:55 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 20:12:55 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 7:52 PM, alex23 wrote: > On Jun 5, 7:48 pm, Chris Angelico wrote: >> No wonder the economy of Greece is in trouble. > > This isn't addressed just to Chris, as this isn't the first time the > joke has been made, but could we not? There's a term for applying the > failings of an individual to an entire genetic or cultural collective, > and it isn't a pretty one. Sorry. You're right, that was un-called-for. I retract that comment. My main point I still stand by, though. These people are paying good money for a service that probably seems fine, to them. It's probably seemed fine for several years, even. But underneath, the systems admin is constantly breaking stuff and then coming in a panic to an open forum, begging for help, and then giving root access to strangers in the hope that they'll magically fix everything. This is not the sort of service I would pay for, and this is why I do not regret the potential damage to Nikos's revenue. The complaint is equivalent to begging a bank not to put in security cameras, because bank robbers might get less income. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 06:30:49 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 03:30:49 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <8ee3ad3f-22b3-4ad6-a334-3933ba0e31de@googlegroups.com> ?? ???????, 5 ??????? 2013 1:12:55 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 7:52 PM, alex23 wrote: > > > On Jun 5, 7:48 pm, Chris Angelico wrote: > > >> No wonder the economy of Greece is in trouble. > > > > > > This isn't addressed just to Chris, as this isn't the first time the > > > joke has been made, but could we not? There's a term for applying the > > > failings of an individual to an entire genetic or cultural collective, > > > and it isn't a pretty one. > > > > Sorry. You're right, that was un-called-for. I retract that comment. > > > > My main point I still stand by, though. These people are paying good > > money for a service that probably seems fine, to them. It's probably > > seemed fine for several years, even. But underneath, the systems admin > > is constantly breaking stuff and then coming in a panic to an open > > forum, begging for help, and then giving root access to strangers in > > the hope that they'll magically fix everything. This is not the sort > > of service I would pay for, and this is why I do not regret the > > potential damage to Nikos's revenue. The complaint is equivalent to > > begging a bank not to put in security cameras, because bank robbers > > might get less income. I dont own e-shops websites that require credit cards to make transactions. I just host 10 peoples who happen to be my friends websites, most of them created by Joomla CMS. 50 euros they pay me for the year for my services and some of them the half. I barely make some money out of this which with your actions today might loose them too. I hope you are happy. What ever i try is expicitly under my user account for python issues and not system wide, so hell brakes loose. And even if it did, my company whos server i rent, would have been abel to fix that. What you did is unforgivable, you should have decalred that: "Nik, i actually dont want to help you with your damn enodnig issue, bur rather mess with your system to prove a point and i dont even regret if you loose some of your customers." Having said that, you could have been honest. At some point i will pay someone here to modify my templates and python scripts to use web frameworks. You and Heiko of course would be excluded from the programmer for hire list. Michael Torrie Steven D'aprano Lele Gaifax Cameron Simpson are possible candidates. From modelnine at modelnine.org Wed Jun 5 06:37:46 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 12:37:46 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <8ee3ad3f-22b3-4ad6-a334-3933ba0e31de@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8ee3ad3f-22b3-4ad6-a334-3933ba0e31de@googlegroups.com> Message-ID: <51AF14FA.1070806@modelnine.org> Am 05.06.2013 12:30, schrieb ???????? ??????: > You and Heiko of course would be excluded from the programmer for hire list. Guess what: I have a job. And I don't give a damn. -- --- Heiko. From antoon.pardon at rece.vub.ac.be Wed Jun 5 06:39:28 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Wed, 05 Jun 2013 12:39:28 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <51AF1560.5050406@rece.vub.ac.be> Op 05-06-13 11:19, ???????? ?????? schreef: > I'am a perosn that eaisly trust other people to have ethics, especially python programmers who knows how difficult its to debug a script and have it working. > Some people can be trusted, and actually try to help. > Some dont. > Chris is na example of the latter. At least he didnt wipe the whoile system out. > And i do have access of my system 30 mins now. > And yes i will again root access to another person, which i beleive he can be trsuted and give me some friendly help. You believing so, is not enough. > Tha is all i have to say and i'm not naive or fool. > As i said some people can actually be trusted. Yes you are naive and a fool. The existance of trustworthy people is not the issue. The issue is how do you protect your server from the untrustworthy ones. Chris has shown you that your method for the latter sucks, yet here you are publicly stating you will just proceed in the same way. Someone with malice in mind has only to win your trust here or elsewhere by faking he wants to help you and you seem willing to give them the root password to your server. On top of that you have made it public that this will likely work. That certainly makes you naive and a fool. -- Antoon Pardon From nikos.gr33k at gmail.com Wed Jun 5 07:07:23 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 04:07:23 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> Message-ID: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> ?? ???????, 5 ??????? 2013 1:39:28 ?.?. UTC+3, ? ??????? Antoon Pardon ??????: > Op 05-06-13 11:19, ???????????????????????? ?????????????????? schreef: > > > I'am a perosn that eaisly trust other people to have ethics, especially python programmers who knows how difficult its to debug a script and have it working. > > > Some people can be trusted, and actually try to help. > > > Some dont. > > > Chris is na example of the latter. At least he didnt wipe the whoile system out. > > > And i do have access of my system 30 mins now. > > > And yes i will again root access to another person, which i beleive he can be trsuted and give me some friendly help. > > You believing so, is not enough. > > > Tha is all i have to say and i'm not naive or fool. > > > As i said some people can actually be trusted. > > Yes you are naive and a fool. The existance of trustworthy people is not > > the issue. The issue is how do you protect your server from the > > untrustworthy ones. > > > > Chris has shown you that your method for the latter sucks, yet here you > > are publicly stating you will just proceed in the same way. > > > > Someone with malice in mind has only to win your trust here or elsewhere > > by faking he wants to help you and you seem willing to give them the > > root password to your server. On top of that you have made it public > > that this will likely work. I will understand by his attitude in general if he is likely to help me or not. With Chris, being an expert and all, i was 60%-40% that he was likely to help me, but i was rather worrying if he would solve the filename encoding and suexec issues more that harming the server(whoch he did not) Btw, since history doesnt show me his history comamnds when he logged in from .au(why not really?), how can i tell what exactly did he do when he logged on to the server? From modelnine at modelnine.org Wed Jun 5 07:14:34 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 13:14:34 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: <51AF1D9A.5080603@modelnine.org> Am 05.06.2013 13:07, schrieb ???????? ??????: > Btw, since history doesnt show me his history comamnds when he logged in from .au(why not really?), how can i tell what exactly did he do when he logged on to the server? As root has full access to your system (i.e., can change file contents and system state at will), and you gave him root access: you can't. And he made sure to remove things such as .bash_history and the syslog contents, I guess. At least that's what I'd have done to prove a point. -- --- Heiko. From wuwei23 at gmail.com Wed Jun 5 07:11:21 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 04:11:21 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: <773d7832-cbad-4caf-a62e-588478658b71@ua8g2000pbb.googlegroups.com> On Jun 5, 9:07?pm, ???????? ?????? wrote: > Btw, since history doesnt show me his history comamnds when he logged in from .au(why not really?) http://lmgtfy.com/?q=centos+clear+command+line+history You're welcome. From nikos.gr33k at gmail.com Wed Jun 5 07:19:30 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 04:19:30 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> ?? ???????, 5 ??????? 2013 2:14:34 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: > Am 05.06.2013 13:07, schrieb ???????????????????????? ??????????????????: > > >Btw, since history doesnt show me his history comamnds when he logged in > >from .au(why not really?), how can i tell what exactly did he do when he > >logged on to the server? > As root has full access to your system (i.e., can change file contents > and system state at will), and you gave him root access: you can't. And > he made sure to remove things such as .bash_history and the syslog > contents, I guess. At least that's what I'd have done to prove a point. I see. Thanks. Is there some logging utility i can use next time iam offering root access to someone(if i do it) or perhaps logging a normal's account activity? From modelnine at modelnine.org Wed Jun 5 07:37:28 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Wed, 05 Jun 2013 13:37:28 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> Message-ID: <51AF22F8.9000005@modelnine.org> Am 05.06.2013 13:19, schrieb ???????? ??????: > Is there some logging utility i can use next time iam offering root access to someone(if i do it) or perhaps logging a normal's account activity? Short answer: Not for root, no. Long answer: as I've already said: root can change file contents, or more explicitly _any_ system state, and (s)he can do that at will, and as such you can't ever be sure that what any form of logging is telling you will be the "truth" in some form or another if you've had a malicious root user on your system. Now: think again why it's such a plain stupid and incredibly bad idea to hand out root credentials to people you shouldn't trust, and why people (like me) keep telling you that you're naive and a fool to even consider handing out root logins. PS: the same is true for normal logins. You don't know whether some form of privilege escalation exists on your system, so even by handing out supposedly safe non-root accounts, your installation might get compromised due to insecure SUID software or due to privilege escalation bugs in the kernel. -- --- Heiko. From rosuav at gmail.com Wed Jun 5 12:33:50 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 02:33:50 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 9:19 PM, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 2:14:34 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: >> Am 05.06.2013 13:07, schrieb ???????????????????????? ??????????????????: >> >> >Btw, since history doesnt show me his history comamnds when he logged in >> >from .au(why not really?), how can i tell what exactly did he do when he >> >logged on to the server? > >> As root has full access to your system (i.e., can change file contents >> and system state at will), and you gave him root access: you can't. And >> he made sure to remove things such as .bash_history and the syslog >> contents, I guess. At least that's what I'd have done to prove a point. In fact, I didn't even bother fiddling with syslog. All I did was .bash_history. Of course, I wasn't worried about you getting my IP addresses (one of them is public anyway, and the other isn't mine any longer than I'm using it), and nothing I did there was sufficiently serious to be worth hiding, but I just did the history so I could point out how easy this is. > I see. Thanks. > Is there some logging utility i can use next time iam offering root access to someone(if i do it) or perhaps logging a normal's account activity? You could log a normal user fairly easily, because root trumps normal users. To log root access, there are a few options: 1) Don't actually give unrestricted roots, but require the use of sudo, which logs. Not 100% perfect unless you actually restrict the commands that can be executed, but it'd at least let you have some idea that things were tampered with. 2) Provide a special bouncer. This is a little complex to describe, so bear with me. Imagine you have *two* computers, WebHost and Bouncer. You want to give root access to WebHost, so you invite someone to ssh to webroot at bouncer - the shell of that user establishes a secondary connection to root at webhost and passes everything on, but also logs it. Since *no* access to Bouncer has been granted, the logs can't be tampered with. This can be complicated to set up and secure, but it's certainly possible. However, I think it is beyond your ability, at least at the moment. 3) Provide a hacked-up root shell that logs to a network location, and disable all other shell usage. Imperfect but would probably work. 4) Require that all root shell access be done through screen/tmux, and monitor it. You can probably think of a few others, too. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 13:02:48 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 10:02:48 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> Message-ID: <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> ?? ???????, 5 ??????? 2013 7:33:50 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Wed, Jun 5, 2013 at 9:19 PM, ???????? ?????? wrote: > > > ?? ???????, 5 ??????? 2013 2:14:34 ?.?. UTC+3, ? ??????? Heiko Wundram ??????: > > >> Am 05.06.2013 13:07, schrieb ???????????????????????? ??????????????????: > > >> > > >> >Btw, since history doesnt show me his history comamnds when he logged in > > >> >from .au(why not really?), how can i tell what exactly did he do when he > > >> >logged on to the server? > > > > > >> As root has full access to your system (i.e., can change file contents > >> and system state at will), and you gave him root access: you can't. And > >> he made sure to remove things such as .bash_history and the syslog > >> contents, I guess. At least that's what I'd have done to prove a point. > In fact, I didn't even bother fiddling with syslog. All I did was > .bash_history. Of course, I wasn't worried about you getting my IP > addresses (one of them is public anyway, and the other isn't mine any > longer than I'm using it), and nothing I did there was sufficiently > serious to be worth hiding, but I just did the history so I could > point out how easy this is. So, by executing .bash_history commands issued are cleared. okey. What abiut 'syslog' that Heiko mentioned. Since you didnt fiddle with syslog can the latter show me what commands have been executed, files opened, commands given, services started-stopped etc? > and nothing I did there was sufficiently serious to be worth hiding. Actually i believ you, because if you had malice in mind you could 'rm -rf /' or deface frontpages which you didnt do. But is there a way for me to see what commands have been issued? syslog perhaps as ia sk above? Since you didn't hurm the system why the need of wipe clean bash's history? From rosuav at gmail.com Wed Jun 5 13:16:46 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 03:16:46 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 3:02 AM, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 7:33:50 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >> In fact, I didn't even bother fiddling with syslog. All I did was >> .bash_history. Of course, I wasn't worried about you getting my IP >> addresses (one of them is public anyway, and the other isn't mine any >> longer than I'm using it), and nothing I did there was sufficiently >> serious to be worth hiding, but I just did the history so I could >> point out how easy this is. > > So, by executing .bash_history commands issued are cleared. okey. > What abiut 'syslog' that Heiko mentioned. Since you didnt fiddle with syslog can the latter show me what commands have been executed, files opened, commands given, services started-stopped etc? Poke around in /var/log - I didn't tamper with anything there, so you may well find log entries. But I don't know for sure what I did and what I didn't do. >> and nothing I did there was sufficiently serious to be worth hiding. > > Actually i believ you, because if you had malice in mind you could 'rm -rf /' or deface frontpages which you didnt do. > > But is there a way for me to see what commands have been issued? syslog perhaps as ia sk above? > Since you didn't hurm the system why the need of wipe clean bash's history? There won't be a full list of all commands, but you may find some hints. And why wipe it? Just to show how easily it could be done. Imagine if I'd: 1) Created a new user, with a home directory of /etc 2) Made a setuid root binary that gives me a shell 3) Removed all logfile traces of having done so I could then *retain full access* even after you change the root password. And you would not know what I'd done, if I do the logfile wipes correctly. You might see some hint (eg that logs were rotated prematurely), but it'd be extremely hard to figure out what I did. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 13:29:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 10:29:44 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> Message-ID: <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> ?? ???????, 5 ??????? 2013 8:16:46 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 3:02 AM, ???????? ?????? wrote: > > > ?? ???????, 5 ??????? 2013 7:33:50 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > > >> In fact, I didn't even bother fiddling with syslog. All I did was > > >> .bash_history. Of course, I wasn't worried about you getting my IP > > >> addresses (one of them is public anyway, and the other isn't mine any > > >> longer than I'm using it), and nothing I did there was sufficiently > > >> serious to be worth hiding, but I just did the history so I could > > >> point out how easy this is. > > > > > > So, by executing .bash_history commands issued are cleared. okey. > > > What abiut 'syslog' that Heiko mentioned. Since you didnt fiddle with syslog can the latter show me what commands have been executed, files opened, commands given, services started-stopped etc? > > > > Poke around in /var/log - I didn't tamper with anything there, so you > > may well find log entries. But I don't know for sure what I did and > > what I didn't do. > > > > >> and nothing I did there was sufficiently serious to be worth hiding. > > > > > > Actually i believ you, because if you had malice in mind you could 'rm -rf /' or deface frontpages which you didnt do. > > > > > > But is there a way for me to see what commands have been issued? syslog perhaps as ia sk above? > > > Since you didn't hurm the system why the need of wipe clean bash's history? > > > > There won't be a full list of all commands, but you may find some > > hints. And why wipe it? Just to show how easily it could be done. > > Imagine if I'd: > > > > 1) Created a new user, with a home directory of /etc > > 2) Made a setuid root binary that gives me a shell > > 3) Removed all logfile traces of having done so > > > > I could then *retain full access* even after you change the root > > password. And you would not know what I'd done, if I do the logfile > > wipes correctly. You might see some hint (eg that logs were rotated > > prematurely), but it'd be extremely hard to figure out what I did. Forensics is not my strong point, currently i'm learning linux hence i only have basic knowledge just to get some basic stuff up and running. Now about what you did to me. I wanted to tell you that I (and I am sure there are other people too) don't agree with what you did. I think it was pretty rotten -- you told me it was a bad idea to give out the root password and that was as far as you should have gone, you had no right to "prove" it by screwing with my system. In the US there is a law called the DMCA which I think would make what you did illegal, even though i have you a password, because i clearly gave you access to help me fix a problem, not to do what you did. Of course US law doesn't help in this case since you i live in Greece and you live in Australia... I decided a long time ago the certain people on the Python list were assholes, you leading the list followed by alex23, Mark Lawrence and several more. Your post about how you are a good Christian just confirms to me that you aren't -- people who brag about how moral they are are usually immoral. And besides the major assholes, there are lots of people there that will just agree with prevailing opinion without thinking for themselves. I still maintain my belief that most people are good and want to help rather than be destructive(which to your defense you weren't entirely. The mails you sent to my few customers though really pissed me off). And of course, i have no idea, if you ahve installed some kind of a backdoor utility that will grant you shell access via ssh to my system. I want to convince myself that you haven't done so. From rosuav at gmail.com Wed Jun 5 13:47:38 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 03:47:38 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 3:29 AM, ???????? ?????? wrote: > Now about what you did to me. I wanted to tell you that I (and I am sure there are other people too) don't agree with what you did. I think it was pretty rotten -- you told me it was a bad idea to give out the root password and that was as far as you should have gone, you had no right to "prove" it by screwing with my system. > > In the US there is a law called the DMCA which I think would make what > you did illegal, even though i have you a password, because i > clearly gave you access to help me fix a problem, not to do what you > did. Of course US law doesn't help in this case since you i live in Greece and you live in Australia... IANAL, but I don't think the DMCA has anything to do with this. (That is to say, I don't think it would even if everything were under US jurisdiction, which as you say isn't the case anyway.) What I did is no more illegal than you lending your car keys to a stranger with the request that he lock your door for you, and him then leafing through the contents of your car and telling your spouse what he found. If that causes your marriage to break up, the fault was with you for having something in your car that would break up your marriage, and for letting a stranger poke around in there. > I still maintain my belief that most people are good and want to help > rather than be destructive(which to your defense you weren't entirely. The mails you sent to my few customers though really pissed me off). The mails to your customers stop you from pretending to them that you know what you're doing. That's all. Now, you may be able to come back from this by making a public change of policy (you so far have a declared stance that you would give out the root password to someone else in future) and apologizing profusely to your customers, but if you can't, that is your problem and not mine. I was programming computers for eighteen years before I got a job doing it. Getting money for hosting people's web sites is something that you should see as a privilege for people who can demonstrably provide this service safely, and should not be something you strive for while you're learning the basics of Linux. > And of course, i have no idea, if you ahve installed some kind of a backdoor utility that will grant you shell access via ssh to my system. > I want to convince myself that you haven't done so. I can help with that convincing. No, I did not install any sort of backdoor. There is no way you can prove that statement, but you have my promise and pledge that your system is safe from me. All I did was: 1) Change the root password, storing the new one in a way that you could find it 2) Create the cookie file as proof of what I could do 3) Collect email addresses from /home/*/.contactemail 4) Inspect the index.html files in a few directories as a means of locating the web sites concerned 5) 'mv .bash_history .bash_history_old', and later mv it back There is no ongoing access, and now that you've changed the root password (btw, I hope you weren't silly enough to change it to the same password you emailed me), the system is under your control again. But you cannot be sure that the *other* people you've given root access to didn't do the same. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 14:08:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 11:08:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 8:47:38 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 3:29 AM, ???????? ?????? wrote: > > > Now about what you did to me. I wanted to tell you that I (and I am sure there are other people too) don't agree with what you did. I think it was pretty rotten -- you told me it was a bad idea to give out the root password and that was as far as you should have gone, you had no right to "prove" it by screwing with my system. > > > > > > In the US there is a law called the DMCA which I think would make what > > > you did illegal, even though i have you a password, because i > > > clearly gave you access to help me fix a problem, not to do what you > > > did. Of course US law doesn't help in this case since you i live in Greece and you live in Australia... > > > > IANAL, but I don't think the DMCA has anything to do with this. (That > > is to say, I don't think it would even if everything were under US > > jurisdiction, which as you say isn't the case anyway.) What I did is > > no more illegal than you lending your car keys to a stranger with the > > request that he lock your door for you, and him then leafing through > > the contents of your car and telling your spouse what he found. If > > that causes your marriage to break up, the fault was with you for > > having something in your car that would break up your marriage, and > > for letting a stranger poke around in there. > > > > > I still maintain my belief that most people are good and want to help > > > rather than be destructive(which to your defense you weren't entirely. The mails you sent to my few customers though really pissed me off). > > > > The mails to your customers stop you from pretending to them that you > > know what you're doing. That's all. Now, you may be able to come back > > from this by making a public change of policy (you so far have a > > declared stance that you would give out the root password to someone > > else in future) and apologizing profusely to your customers, but if > > you can't, that is your problem and not mine. > > > > I was programming computers for eighteen years before I got a job > > doing it. Getting money for hosting people's web sites is something > > that you should see as a privilege for people who can demonstrably > > provide this service safely, and should not be something you strive > > for while you're learning the basics of Linux. > > > > > And of course, i have no idea, if you ahve installed some kind of a backdoor utility that will grant you shell access via ssh to my system. > > > I want to convince myself that you haven't done so. > > > > I can help with that convincing. No, I did not install any sort of > > backdoor. There is no way you can prove that statement, but you have > > my promise and pledge that your system is safe from me. All I did was: > > > > 1) Change the root password, storing the new one in a way that you could find it > > 2) Create the cookie file as proof of what I could do > > 3) Collect email addresses from /home/*/.contactemail > > 4) Inspect the index.html files in a few directories as a means of > > locating the web sites concerned > > 5) 'mv .bash_history .bash_history_old', and later mv it back > > > > There is no ongoing access, and now that you've changed the root > > password (btw, I hope you weren't silly enough to change it to the > > same password you emailed me), the system is under your control again. > > But you cannot be sure that the *other* people you've given root > > access to didn't do the same. Every time i granted access to other folks when jobs done i alwaws 'passwd' as root to avoid unwanted access. All customers are also my friends and they like me and trust me. I also fix their computers too and use "TeamViewer" many times to help them from home. Still, all of your doing could be avoided if isntead of fiddlign with my clients, you would actually try to provide a helping had. Anyway, i should'n have given root access to you, i was a bit worried doing so, but i was also under stress of also correcting this damn encoding issue and i wanted to think you would be the one that finally help solving it. I was wrong. But no matter what you say i won't lose my beleif hat if for example i have given access to Steven, things could have turn into a positive solution. You shouldnt have gone "that far", just to prove a point. Its not that malicious activity didn't occur to me that migth happen, i just like to think that it wont. Any way, enough said. From rosuav at gmail.com Wed Jun 5 14:16:56 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 04:16:56 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:08 AM, ???????? ?????? wrote: > Anyway, i should'n have given root access to you, i was a bit worried doing so, but i was also under stress of also correcting this damn encoding issue and i wanted to think you would be the one that finally help solving it. > > You shouldnt have gone "that far", just to prove a point. > Its not that malicious activity didn't occur to me that migth happen, i just like to think that it wont. Sure, you'd like to think that nothing will ever go wrong. Trouble is, you can't depend on that. Maybe Steven D'Aprano would have solved your problem for you... maybe not. Maybe you would have picked someone who totally smashed your system, reputation, bank balance, and family pet. How would you know? The point of security is not to trust that most people will be fine. The point of security is to be secure. You may not be able to guard against everything, but you can certainly put some effort into not making it easy for an attacker. Treat the root password as a keyring with all of your keys on it, and assume that you're going on holidays overseas. Do you contact strangers to ask them to feed your cat? Or do you talk to a trusted friend? ChrisA From nikos.gr33k at gmail.com Wed Jun 5 14:22:43 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 11:22:43 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 9:16:56 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >Do you contact strangers to ask them to feed your cat? Or do you talk to a >trusted friend? Well i dont consider you a perfect stranger, because we kind of know each other since we speak here sometime. You know how much i was striving for help resolving this, and i was happy this morning thinking that Chris will fianlly put me out of this encoding misery.... From nikos.gr33k at gmail.com Wed Jun 5 14:34:30 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 11:34:30 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: Here is the mails you sent to my customers for the other members to see. ----------------------------------- Greetings. I apologize for this unsolicited email, but I feel that you have a right to know about the security of your server. ???????? ?????? (Nikos) has been in repeated communication with the members of python-list with regard to many issues he is having, and he has happily granted root access to his server to someone he has never met and has no reason to trust. This compromises your data and your web site. Fortunately for you, the person he gave his password is me, and I have no intention of causing damage. However, if I wanted to, I could do *anything* to his server. As a simple demonstration, I have placed a file called Hello_from_Rosuav in the root directory of each of your web sites, for instance: http://leonidasgkelos.com/Hello_from_Rosuav http://parking-byzantio.gr/Hello_from_Rosuav Your email addresses, too, I obtained from the server. If you are storing personal details of any of your customers, I could access those, but on principle I haven't looked. Please consider carefully who you trust with your hosting. There is no need to panic right now, as there has been no damage done (beyond the creation of the file I mentioned above, which you can easily delete). But be aware that Nikos is not a competent systems administrator, and I would not trust him with any of my data. You can find a large number of posts by Nikos on python-list here: http://news.gmane.org/gmane.comp.python.general http://mail.python.org/pipermail/python-list/2013-June/thread.html Feel free to contact me for further details. I apologize that I cannot communicate in Greek; I hope that this will not be a problem. I advise that you look to alternative web hosting. ----------------------------------- Thanks for screwing me up entirely and made me look what you made me look for all i did was to trust you. From rosuav at gmail.com Wed Jun 5 14:46:03 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 04:46:03 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:34 AM, ???????? ?????? wrote: > Here is the mails you sent to my customers for the other members to see. Yep, containing nothing I haven't said on-list. > Thanks for screwing me up entirely and made me look what you made me look for all i did was to trust you. Making you look like what? A systems administrator who can't be trusted? Because that is, quite frankly, entirely accurate. Suppose you go to a posh place that offers valet parking. You make sure that the person you're giving your car key to is employed by the club, and you let him take control of your car. Unbeknownst to you, he doesn't actually park your car, he calls out to the loafers, asking them to park it. He knows these guys, they're always hanging around. He gives the key to one of them, who gets in your car and looks around. That's what you've done. You violated the trust your clients placed in you, and your only response is to claim that a person (with whom you had no contractual arrangement or even verbal promise) violated your trust. It's like saying "I can keep a secret, it's just the folks I tell it to who can't". ChrisA From schesis at gmail.com Wed Jun 5 14:52:27 2013 From: schesis at gmail.com (Zero Piraeus) Date: Wed, 5 Jun 2013 14:52:27 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: : On 5 June 2013 14:34, ???????? ?????? wrote: > Here is the mails you sent to my customers for the other members to see. > ----------------------------------- > [...] > I advise that you look to alternative web hosting. > ----------------------------------- > > Thanks for screwing me up entirely and made me look what you made me look for all i did was to trust you. Chris has done your customers an important service (one which I would not have risked, given your propensity for badmouthing those with whom you come in contact). You are dangerously incompetent as a hosting provider, as you have demonstrated here repeatedly. Be thankful that the person you stupidly granted root access to has a sense of ethics, and learn your trade. -[]z. From nikos.gr33k at gmail.com Wed Jun 5 14:53:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 11:53:06 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: <97d1a8e7-ca2e-498d-93ed-722142f7e038@googlegroups.com> ?? ???????, 5 ??????? 2013 9:46:03 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 4:34 AM, ???????? ?????? wrote: > > > Here is the mails you sent to my customers for the other members to see. > > > > Yep, containing nothing I haven't said on-list. > > > > > Thanks for screwing me up entirely and made me look what you made me look for all i did was to trust you. > > > > Making you look like what? A systems administrator who can't be > > trusted? Because that is, quite frankly, entirely accurate. > > > > Suppose you go to a posh place that offers valet parking. You make > > sure that the person you're giving your car key to is employed by the > > club, and you let him take control of your car. Unbeknownst to you, he > > doesn't actually park your car, he calls out to the loafers, asking > > them to park it. He knows these guys, they're always hanging around. > > He gives the key to one of them, who gets in your car and looks > > around. > > > > That's what you've done. You violated the trust your clients placed in > > you, and your only response is to claim that a person (with whom you > > had no contractual arrangement or even verbal promise) violated your > > trust. It's like saying "I can keep a secret, it's just the folks I > > tell it to who can't". > > > > ChrisA Its funny how doing what you did you manage to turn the whole thing against me. WHY isntead of doing wht you did, dint you choose to actually *help* ? I'am beginning to dislkike you more and more as you speak. From rustompmody at gmail.com Wed Jun 5 14:55:46 2013 From: rustompmody at gmail.com (rusi) Date: Wed, 5 Jun 2013 11:55:46 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Jun 5, 11:34 pm, ???????? ?????? wrote: > Here is the mails you sent to my customers for the other members to see. In the normal run of things, I would say Chris has done a horrible thing. In this case however, let us remember: Many people -- hardly exclusively Chris -- tried to educate you 1. on technical matters 2. on methodological matters (eg how to debug) 3. on matters of minimum etiquette -- eg spellchecking 4. on basic security For the most part, you simply have not listened. Finally Chris warned you what he can do. Instead of listening, you whined: "I trust you!!" (Heres a kiss!) and gave him your password. He gently tapped you on your rather hard and impervious 'Ferrous Cranus' to let you understand the implications. Even now, instead of understanding that you were wrong throughout, you are still blaming Chris -- Good Grief! And you expect us to sympathize with you?!?! I dont know whether to laugh or cry... Please note Nikos: If you obdurately, obstinately, insistently, incessantly behave like an asshole, you leave no-one the choice but to treat you like an asshole. So... Are you an asshole?? One can only hope that you prove me wrong... From rosuav at gmail.com Wed Jun 5 15:03:42 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 05:03:42 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:55 AM, rusi wrote: > If you obdurately, obstinately, insistently, incessantly behave like > an asshole, you leave no-one the choice but to treat you like an > asshole. This is Python. We duck-type people. ChrisA From joel.goldstick at gmail.com Wed Jun 5 15:29:47 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Wed, 5 Jun 2013 15:29:47 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: Now, you were right about my bad mouth because iam going to tell you to sod off. >Well, if he had ethics he would have told me that his intentiosn were to screw my business and also he could actually tried to help me out. Many times I've seen people here give you their best advice and you come back seemingly having not even read what they had to say. You just whine and say someone should help you, even though many have already done that. You don't take the help. Now in this case, Chris more or less proved my point. I've been reading along, and he said exactly what he would do if you gave him root access to your account. He said he would write to your users and explain to them the peril of how you run your hosting service. He didn't say he would help you. Go back and read exactly what he said, and then take a deep breath and do some introspection of your own conduct. He basically said, don't touch the stove, its hot. And you touched the stove and then complained. You act very poorly here. Grow up >I'am not incompetentm i;m a beginner and i learn along the way, also i ahve a hostign company and 3rd level tech that support me when it come to system administration. I think you are incompetent. No one knows everything, and groups like this are a great place to learn more. But part of being competent is being careful. You are reckless. You work on a live server for which you have paying customers. You make endless changes to your code without taking the time to go off and google for information about the topic you are struggling with. Your live site should probably have been put together using a framework, but that would have required you to read about, experiment with and use a framework. You write html code in the midst of your python code. You have endless encoding/decoding issues, but you have never apparently read the many articles on how unicode works. Have some respect for the science and craft of making good software. On Wed, Jun 5, 2013 at 3:03 PM, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 4:55 AM, rusi wrote: > > If you obdurately, obstinately, insistently, incessantly behave like > > an asshole, you leave no-one the choice but to treat you like an > > asshole. > > This is Python. We duck-type people. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Wed Jun 5 15:03:34 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 12:03:34 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 9:55:46 ?.?. UTC+3, ? ??????? rusi ??????: > On Jun 5, 11:34 pm, ???????? ?????? wrote: > > > Here is the mails you sent to my customers for the other members to see. > > > > > > In the normal run of things, I would say Chris has done a horrible > > thing. > > In this case however, let us remember: > > Many people -- hardly exclusively Chris -- tried to educate you > > 1. on technical matters > > 2. on methodological matters (eg how to debug) > > 3. on matters of minimum etiquette -- eg spellchecking > > 4. on basic security > > > > For the most part, you simply have not listened. > > Finally Chris warned you what he can do. > > Instead of listening, you whined: "I trust you!!" (Heres a kiss!) and > > gave him your password. > > He gently tapped you on your rather hard and impervious 'Ferrous > > Cranus' to let you understand the implications. > > > > Even now, instead of understanding that you were wrong throughout, you > > are still blaming Chris -- Good Grief! > > > > And you expect us to sympathize with you?!?! I dont know whether to > > laugh or cry... > > > > Please note Nikos: > > If you obdurately, obstinately, insistently, incessantly behave like > > an asshole, you leave no-one the choice but to treat you like an > > asshole. > > > > So... Are you an asshole?? One can only hope that you prove me wrong... No, its your attitude that is beyond asshood. I decided a long time ago the certain people on the Python list were assholes, perhaps you are the leader here. From nikos.gr33k at gmail.com Wed Jun 5 14:58:51 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 11:58:51 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: <72903858-b5b4-414f-8ac5-958c436cf8eb@googlegroups.com> ?? ???????, 5 ??????? 2013 9:52:27 ?.?. UTC+3, ? ??????? Zero Piraeus ??????: > : > > > > On 5 June 2013 14:34, ???????? ?????? wrote: > > > Here is the mails you sent to my customers for the other members to see. > > > ----------------------------------- > > > [...] > > > I advise that you look to alternative web hosting. > > > ----------------------------------- > > > > > > Thanks for screwing me up entirely and made me look what you made me look for all i did was to trust you. > > > > Chris has done your customers an important service (one which I would > > not have risked, given your propensity for badmouthing those with whom > > you come in contact). You are dangerously incompetent as a hosting > > provider, as you have demonstrated here repeatedly. Be thankful that > > the person you stupidly granted root access to has a sense of ethics, > > and learn your trade. > > > > -[]z. Well, if he had ethics he would have told me that his intentiosn were to screw my business and also he could actually tried to help me out. I'am not incompetentm i;m a beginner and i learn along the way, also i ahve a hostign company and 3rd level tech that support me when it come to system administration. Now, you were right about my bad mouth because iam going to tell you to sod off. From rosuav at gmail.com Wed Jun 5 15:13:41 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 05:13:41 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <72903858-b5b4-414f-8ac5-958c436cf8eb@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> <72903858-b5b4-414f-8ac5-958c436cf8eb@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:58 AM, ???????? ?????? wrote: > Well, if he had ethics he would have told me that his intentiosn were to screw my business and also he could actually tried to help me out. I did. :) > I'am not incompetentm i;m a beginner and i learn along the way, also i ahve a hostign company and 3rd level tech that support me when it come to system administration. Beginners learning along the way do not run businesses. I wouldn't hire someone to build me a porch if he admits that he's still learning which end of the hammer to hit with. (That's understandable if it's a PHP hammer with claws on both ends, but I still wouldn't hire him.) And if I hired someone to build that porch and only afterward discovered that he didn't know a screw from a nail, I would be pretty miffed. Nikos, you are that carpenter. There's nothing wrong with being a beginner. We all start out that way. But a beginner plays with things that don't have major consequence. If you didn't have paying customers, you would not need to worry about what I might have done; at very worst, you just wipe the system and reinstall. (You DO have basic firewalling to make sure I can't damage any other box, right?) And even more so, if you didn't have paying customers, you would not be in a tizz about things. You could simply set the matter aside and come back later. This is safe. Don't do what you wouldn't stand for someone else doing. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 15:18:58 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 12:18:58 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> <72903858-b5b4-414f-8ac5-958c436cf8eb@googlegroups.com> Message-ID: <48ac4867-b257-4c84-a5cf-6f3f63ab320f@googlegroups.com> ?? ???????, 5 ??????? 2013 10:13:41 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 4:58 AM, ???????? ?????? wrote: > > > Well, if he had ethics he would have told me that his intentiosn were to screw my business and also he could actually tried to help me out. > > > > I did. :) > > > > > I'am not incompetentm i;m a beginner and i learn along the way, also i ahve a hostign company and 3rd level tech that support me when it come to system administration. > > > > Beginners learning along the way do not run businesses. I wouldn't > > hire someone to build me a porch if he admits that he's still learning > > which end of the hammer to hit with. (That's understandable if it's a > > PHP hammer with claws on both ends, but I still wouldn't hire him.) > > And if I hired someone to build that porch and only afterward > > discovered that he didn't know a screw from a nail, I would be pretty > > miffed. Nikos, you are that carpenter. > > > > There's nothing wrong with being a beginner. We all start out that > > way. But a beginner plays with things that don't have major > > consequence. If you didn't have paying customers, you would not need > > to worry about what I might have done; at very worst, you just wipe > > the system and reinstall. (You DO have basic firewalling to make sure > > I can't damage any other box, right?) And even more so, if you didn't > > have paying customers, you would not be in a tizz about things. You > > could simply set the matter aside and come back later. This is safe. > > > > Don't do what you wouldn't stand for someone else doing. I'll have you know that all 10 of my client webpages run unproblematically and i support them by mail and teamviewer for free. I have even bough Softaculous licenses for them to have joomla and Drupal install in an automatic way so things go smooth and easy for them because tehy can all build Joomla from scratch. If i couldnt host their webistes i woudlnt have done so, but i can. And when i find t hard their is always the webhost company that supports me by just openign a ticket. From rosuav at gmail.com Wed Jun 5 14:37:30 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 04:37:30 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 4:22 AM, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 9:16:56 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >>Do you contact strangers to ask them to feed your cat? Or do you talk to a >trusted friend? > > Well i dont consider you a perfect stranger, because we kind of know each other since we speak here sometime. > > You know how much i was striving for help resolving this, and i was happy this morning thinking that Chris will fianlly put me out of this encoding misery.... See, that's the thing. All you know about me is that I happen to answer a lot of questions here. Now, if you ask around on this list, you'll probably learn a lot about me, but the most important thing right now is that I told you up-front that I was not intending to help, yet you still gave me the root password. You get so stuck on your own problems that you are unable to see anyone else's. In fact, you are very much in the position of Alice Liddell at the time of American McGee's game, "Alice: Madness Returns". (It's a decent game, but don't buy anything from EA Games.) The problem isn't so much what you're doing, as what you're not doing. Slow down, take a step back. Give yourself some breathing space. If you had a test computer to play around on before deploying things to your live server, you would not be panicked by little problems; and you could take a bit of time to (a) polish your posts before hitting Send, and (b) read the responses more thoroughly. Between those two, you could avoid a lot of trouble fairly easily. ChrisA From rurpy at yahoo.com Wed Jun 5 20:57:46 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Wed, 5 Jun 2013 17:57:46 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> Message-ID: <5e0cbea0-52dc-498c-9ceb-05dd020eee26@googlegroups.com> On 06/05/2013 05:19 PM, Dennis Lee Bieber wrote: > On Wed, 5 Jun 2013 10:29:44 -0700 (PDT), ???????? ?????? > declaimed the following in > gmane.comp.python.general: >> >> In the US there is a law called the DMCA which I think would make what >> you did illegal, even though i have you a password, because i >> clearly gave you access to help me fix a problem, not to do what you >> did. Of course US law doesn't help in this case since you i live in Greece and you live in Australia... >> > I doubt it... DMCA mainly concerns itself with the breaking of > copyright restrictions applied to media -- for example, e-books that are > keyed to single user's account. The "CA" part is "copyright act" > (without googling, I think the "DM" is "digital millenium"); the key is > "copyright". No copyrights were violated in this teaching... >From vague memory (and without enough interest in the subject to research it), I recall hearing several news stories over the years where people where convicted (or at least charged with) violating the DMCA (or perhaps equally draconian followup U.S. laws) even though they clearly penetrated the system to point out security flaws. > But what you did was the equivalent of handing out the key to > strangers (on the Barnes&Noble Nook, the "key" is the combination of an > email address and a credit card number -- if you are willing to hand > your email and CC# to a perfect stranger they can legitimately open the > e-book file you gave them). > > In short, you "said": I give you total control over my server; do > anything you want with it though I'd like for you to clean up my mess. No he didn't -- as I read his posts he was clearly offering access for the purpose of having someone help him fix his problems. That I give you my car keys (even if you're a stranger) does not mean I am giving you permission to do whatever you want with my car. Nor does the fact that I think you shouldn't pick up hitchikers permit me to teach you a lesson by getting picked up by you and then robbing you. But a bunch of legally ignorant programmers (including myself) speculating about the subject here is about as informative as a group of 6-graders thoughts on Einstein's theory of relativity. From python.list at tim.thechases.com Wed Jun 5 22:02:19 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Wed, 5 Jun 2013 21:02:19 -0500 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <5e0cbea0-52dc-498c-9ceb-05dd020eee26@googlegroups.com> References: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> <5e0cbea0-52dc-498c-9ceb-05dd020eee26@googlegroups.com> Message-ID: <20130605210219.794420fa@bigbox.christie.dr> On 2013-06-05 17:57, rurpy at yahoo.com wrote: > On 06/05/2013 05:19 PM, Dennis Lee Bieber wrote: > stories over the years where people where convicted (or > at least charged with) violating the DMCA (or perhaps > equally draconian followup U.S. laws) even though they > clearly penetrated the system to point out security flaws. I suspect you read "CFAA" (Computer Fraud & Abuse Act) and thought "DMCA" (Digital Millennium Copyright Act), as there have been a number of prosecutions under the CFAA (including the whole Aaron Swartz ordeal) for nebulous "exceeding authorization". -tkc From rurpy at yahoo.com Thu Jun 6 14:03:02 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Thu, 6 Jun 2013 11:03:02 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> <1496e27c-7870-48d2-afb0-1bf626e24b5f@googlegroups.com> <83de920f-dea8-49ad-9f6e-e25d3b2d8446@googlegroups.com> <501f3d4e-bbe3-45e8-afce-96cedabe2bef@googlegroups.com> <5e0cbea0-52dc-498c-9ceb-05dd020eee26@googlegroups.com> Message-ID: <441ee22b-878b-44e9-945b-9dc7f2fa0c8e@googlegroups.com> On 06/05/2013 08:02 PM, Tim Chase wrote: > On 2013-06-05 17:57, rurpy at yahoo.com wrote: >> stories over the years where people where convicted (or >> at least charged with) violating the DMCA (or perhaps >> equally draconian followup U.S. laws) even though they >> clearly penetrated the system to point out security flaws. > > I suspect you read "CFAA" (Computer Fraud & Abuse Act) and thought > "DMCA" (Digital Millennium Copyright Act), as there have been a > number of prosecutions under the CFAA (including the whole Aaron > Swartz ordeal) for nebulous "exceeding authorization"/ Yes, thanks for correcting that. From rosuav at gmail.com Wed Jun 5 12:24:19 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 02:24:19 +1000 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 9:07 PM, ???????? ?????? wrote: > I will understand by his attitude in general if he is likely to help me or not. How much of my attitude did you read before you decided I would trust you? Posts like this: http://mail.python.org/pipermail/python-list/2013-June/648428.html http://mail.python.org/pipermail/python-list/2013-June/648496.html and especially this: http://mail.python.org/pipermail/python-list/2013-June/648459.html state fairly clearly what I'm intending. I was NOT planning to solve your problem. I was planning all along to do exactly what I did: search for some proof that I had full access, email it to the persons concerned, then leave without doing any actual damage. So if you were *that wrong* about me, what makes you think you can judge someone else safely? ChrisA From joel.goldstick at gmail.com Wed Jun 5 12:35:48 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Wed, 5 Jun 2013 12:35:48 -0400 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 12:24 PM, Chris Angelico wrote: > On Wed, Jun 5, 2013 at 9:07 PM, ???????? ?????? > wrote: > > I will understand by his attitude in general if he is likely to help me > or not. > > How much of my attitude did you read before you decided I would trust > you? Posts like this: > > http://mail.python.org/pipermail/python-list/2013-June/648428.html > http://mail.python.org/pipermail/python-list/2013-June/648496.html > > and especially this: > > http://mail.python.org/pipermail/python-list/2013-June/648459.html > > state fairly clearly what I'm intending. I was NOT planning to solve > your problem. I was planning all along to do exactly what I did: > search for some proof that I had full access, email it to the persons > concerned, then leave without doing any actual damage. > > So if you were *that wrong* about me, what makes you think you can > judge someone else safely? > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list > To solve the OPs problems once and for all, I believe we need to know his social security number and his mother's maiden name. (Yes, i know SSN is for US but... ) -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Wed Jun 5 13:07:30 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 10:07:30 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <2aef9194-ef36-45db-8c77-9510d3f14ebe@googlegroups.com> <8df8a9df-dbb9-4f35-a6a3-b45aa32a848b@googlegroups.com> Message-ID: <918c0187-f4a1-4b06-8526-5c33843aa571@googlegroups.com> ?? ???????, 5 ??????? 2013 7:35:48 ?.?. UTC+3, ? ??????? Joel Goldstick ??????: >To solve the OPs problems once and for all, I believe we need to know his >social security number and his mother's maiden name.? (Yes, i know SSN is for US >but... ) Even if i gibe you that info, what can you possibly expect to happen? Gain access to my Gmail account because you stuck in its security question? From wuwei23 at gmail.com Wed Jun 5 04:59:28 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 01:59:28 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> Message-ID: On Jun 5, 6:41?pm, Chris Angelico wrote: > This matter is far more serious than you seem to be giving it > consideration for. You complain that I violated your trust; you > violated the trust of people who are paying you money. I think the term I'm looking for here is: EPIC WIN :D From nikos.gr33k at gmail.com Wed Jun 5 05:06:51 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 02:06:51 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> Message-ID: <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> ?? ???????, 5 ??????? 2013 11:59:28 ?.?. UTC+3, ? ??????? alex23 ??????: > On Jun 5, 6:41?pm, Chris Angelico wrote: > > > This matter is far more serious than you seem to be giving it > > > consideration for. You complain that I violated your trust; you > > > violated the trust of people who are paying you money. > > > > I think the term I'm looking for here is: EPIC WIN :D I didnt violate anything. Chris violated my treust. There would have been no violation if he just look into en encoding issue and not meddled with my customers mail and data. Alex23, you are the *WORST* character i ever encountered in this list and forums in gernal. Idiot and ignorant too not knowing that ~/www is a symlink to ~/public_html and pretending to help. Fuck you too and sod off. From antoon.pardon at rece.vub.ac.be Wed Jun 5 07:06:30 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Wed, 05 Jun 2013 13:06:30 +0200 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> Message-ID: <51AF1BB6.8000100@rece.vub.ac.be> Op 05-06-13 11:06, ???????? ?????? schreef: > ?? ???????, 5 ??????? 2013 11:59:28 ?.?. UTC+3, ? ??????? alex23 ??????: >> On Jun 5, 6:41 pm, Chris Angelico wrote: >> >>> This matter is far more serious than you seem to be giving it >>> consideration for. You complain that I violated your trust; you >>> violated the trust of people who are paying you money. >> >> >> I think the term I'm looking for here is: EPIC WIN :D > I didnt violate anything. Chris violated my treust. > There would have been no violation if he just look into en encoding issue and not meddled with my customers mail and data. Yes you violated peoples trust. People trust you to act in a way to keep their data safe. Mailing your root password to someone you only know from a mailinglist/newsgroup is acting irresponsibly. That Chris has violated your trust, doesn't make your own irresponsible behaviour dissappear. Not only that, you made it public you would continue to act the same way in the future. If I had trusted you with my data, I would have felt my trust to be violated. Your actions are similar to someone who keeps a credit card for an organisation, gives the security code to a stranger and then complains the stranger moved a lot of money from one bank account to another (although all owned by you). Sure the stranger had no business doing that, but you sure were violating the trust of the organisation by acting so irresponsibly. -- Antoon Pardon From breamoreboy at yahoo.co.uk Wed Jun 5 09:16:46 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 14:16:46 +0100 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> Message-ID: On 05/06/2013 10:06, ???????? ?????? wrote: > Fuck you too and sod off. > You've got a bloody nerve. You're charging people when you haven't the faintest idea what you're doing, won't pay for technical support, and then have the audacity to complain when people do try to help. As I've said before, it's hardly surprising that the Greek economy is in such a mess if you're an example of what the workforce has to offer. I was going to say professionally, except that word is clearly not applicable here. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From nikos.gr33k at gmail.com Wed Jun 5 10:35:41 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 07:35:41 -0700 (PDT) Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com> <2ecc95c4-6114-49a6-ad47-df7bae4adfde@googlegroups.com> <592c84d8-2e86-4480-b784-c3ccadc8360d@googlegroups.com> <06fd6c2e-0979-4d61-b75a-6d9df7c1b624@googlegroups.com> <70390d65-5313-46bf-8110-b25f5fc9f76f@googlegroups.com> <8d52505a-7252-419b-8b4f-61e5ee56a78a@googlegroups.com> <979d5b16-a84b-486c-a6db-86c0c755c8f5@googlegroups.com> Message-ID: ?? ???????, 5 ??????? 2013 4:16:46 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: > On 05/06/2013 10:06, ???????????????????????? ?????????????????? wrote: > > > > > Fuck you too and sod off. > > > > > > > You've got a bloody nerve. You're charging people when you haven't the > > faintest idea what you're doing, won't pay for technical support, and > > then have the audacity to complain when people do try to help. As I've > > said before, it's hardly surprising that the Greek economy is in such a > > mess if you're an example of what the workforce has to offer. I was > > going to say professionally, except that word is clearly not applicable > > here. When you invented meat, Greeks were already suffering from cholesterol. From carlosnepomuceno at outlook.com Tue Jun 4 07:58:28 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:58:28 +0300 Subject: Apache and suexec issue that wont let me run my python script In-Reply-To: <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> References: <20a49aac-3867-481f-96d4-c95a050781ed@googlegroups.com>, >,>,, ,,> , >,<, <51AD2564.6080707@gmail.com>, ,,> , >,<, <51AD70E8.70506@gmail.com>, ,,> , >, <, <6c0ed9da-0f29-4b6b-a804-771763454dd4@googlegroups.com>, , >, , > <,,,,> , >, <4ed43a69-0dfe-4078-a836-db5201811761@googlegroups.com>, , <2e1dbdc2-6bca-4c4e-93b0-4c0cddb72bc1@googlegroups.com> Message-ID: > Date: Tue, 4 Jun 2013 04:36:06 -0700 > Subject: Re: Apache and suexec issue that wont let me run my python script > From: nikos.gr33k at gmail.com > To: python-list at python.org > > ?? ?????, 4 ??????? 2013 2:27:25 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > > The httpd processes are run by user 'nobody'. You have to change your httpd.conf to assign the correct user or change the owner of the log file to nobody. > > > > On httpd.conf look for the following directives: > > User root > > Group root > > Why some httpd run as root(first two) and the rest as nobody? The root processes are run by init during startup. The nobody processes are started by the first httpd processes based on httpd.conf settings. > What is user 'nobody' anyways? Just a user with no shell access. > root at nikos [/home/nikos/www/data/apps]# nano /usr/local/apache/conf/httpd.conf > root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'User root' > root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'user root' > root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'group root' > root at nikos [/home/nikos/www/data/apps]# cat /usr/local/apache/conf/httpd.conf | grep 'Group root' > > Doesn't seem to be there. You have to edit httpd.conf and change the User and Group directives. They currently are set to nobody, so you have to look for ' User nobody' and ' Group nobody'. Take care while editing httpd.conf. Make a backup copy just in case. ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Sat Jun 1 11:44:36 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 08:44:36 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) Message-ID: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> /home/nikos/public_html/cgi-bin/metrites.py in () 217 template = htmldata + counter 218 elif page.endswith('.py'): => 219 htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' + page ) 220 template = htmldata.decode('utf-8').replace( 'Content-type: text/html; charset=utf-8', '' ) + counter 221 htmldata undefined, subprocess = , subprocess.check_output = , page = 'files.py' /opt/python3/lib/python3.3/subprocess.py in check_output(timeout=None, *popenargs=('/home/nikos/public_html/cgi-bin/files.py',), **kwargs={}) 584 retcode = process.poll() 585 if retcode: => 586 raise CalledProcessError(retcode, process.args, output=output) 587 return output 588 global CalledProcessError = , retcode = 1, process = , process.args = '/home/nikos/public_html/cgi-bin/files.py', output = b'Content-type: text/html; charset=utf-8\n\n\n\n' CalledProcessError: Command '/home/nikos/public_html/cgi-bin/files.py' returned non-zero exit status 1 args = (1, '/home/nikos/public_html/cgi-bin/files.py') cmd = '/home/nikos/public_html/cgi-bin/files.py' output = b'Content-type: text/html; charset=utf-8\n\n\n\n' returncode = 1 with_traceback = The above error message happened when i tried to reanme one of my filenames from its greeklish name to greek charcters. files.py is a script that allows users to downlaod fiels form my server. But i wish to presnt filename sin Greek and not in Greeklish http://superhost.gr/?page=files.py as it is now. What can i do to make pth script accept greek filenames too? Why does subprocess is complaining? From nikos.gr33k at gmail.com Sun Jun 2 02:02:59 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 1 Jun 2013 23:02:59 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: <9a5d5817-8179-4cc7-9cc1-4483051a1385@googlegroups.com> ?? ???????, 1 ??????? 2013 6:44:36 ?.?. UTC+3, ? ??????? ???????? ?????? ??????: > /home/nikos/public_html/cgi-bin/metrites.py in () > > 217 template = htmldata + counter > > 218 elif page.endswith('.py'): > > => 219 htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' + page ) > > 220 template = htmldata.decode('utf-8').replace( 'Content-type: text/html; charset=utf-8', '' ) + counter > > 221 > > htmldata undefined, subprocess = , subprocess.check_output = , page = 'files.py' > > /opt/python3/lib/python3.3/subprocess.py in check_output(timeout=None, *popenargs=('/home/nikos/public_html/cgi-bin/files.py',), **kwargs={}) > > 584 retcode = process.poll() > > 585 if retcode: > > => 586 raise CalledProcessError(retcode, process.args, output=output) > > 587 return output > > 588 > > global CalledProcessError = , retcode = 1, process = , process.args = '/home/nikos/public_html/cgi-bin/files.py', output = b'Content-type: text/html; charset=utf-8\n\n\n\n' > > CalledProcessError: Command '/home/nikos/public_html/cgi-bin/files.py' returned non-zero exit status 1 > > args = (1, '/home/nikos/public_html/cgi-bin/files.py') > > cmd = '/home/nikos/public_html/cgi-bin/files.py' > > output = b'Content-type: text/html; charset=utf-8\n\n\n\n' > > returncode = 1 > > with_traceback = > > > > > > The above error message happened when i tried to reanme one of my filenames from > > > > its greeklish name to greek charcters. > > > > files.py is a script that allows users to downlaod fiels form my server. > > But i wish to presnt filename sin Greek and not in Greeklish > > > > http://superhost.gr/?page=files.py > > as it is now. > > > > What can i do to make pth script accept greek filenames too? > > Why does subprocess is complaining? i tried encode and decode elif page.endswith('.py'): htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' + page ) template = htmldata.decode('utf-8') + counter bu still same error when i rename a filename with greek letters. Any ideas? is this a bug? From giorgos.tzampanakis at gmail.com Sun Jun 2 03:01:50 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Sun, 2 Jun 2013 07:01:50 +0000 (UTC) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: > The above error message happened when i tried to reanme one of my > filenames from > > its greeklish name to greek charcters. > > files.py is a script that allows users to downlaod fiels form my server. > But i wish to presnt filename sin Greek and not in Greeklish > > http://superhost.gr/?page=files.py > as it is now. > > What can i do to make pth script accept greek filenames too? > Why does subprocess is complaining? You are not offering enough information, because you have not posted the contents of your files.py script. Thus it's difficult to help you. Please post your code to pastebin or somewhere similar because posting long lines on usenet is considered bad etiquette. Also, few here know what "greeklish" means, and most of us who know would like to forget. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ From breamoreboy at yahoo.co.uk Sun Jun 2 03:22:20 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sun, 02 Jun 2013 08:22:20 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: On 02/06/2013 08:01, Giorgos Tzampanakis wrote: > > You are not offering enough information, because you have not posted the > contents of your files.py script. Thus it's difficult to help you. Please > post your code to pastebin or somewhere similar because posting long lines > on usenet is considered bad etiquette. > I would much prefer to have a code snippet that shows the problem inline. Plus, what happens in six months time if someone finds this thread but can't find the code online as it's expired? -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From bouncingcats at gmail.com Sun Jun 2 04:11:37 2013 From: bouncingcats at gmail.com (David) Date: Sun, 2 Jun 2013 18:11:37 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: On 02/06/2013, Mark Lawrence wrote: > On 02/06/2013 08:01, Giorgos Tzampanakis wrote: >> >> You are not offering enough information, because you have not posted the >> contents of your files.py script. Thus it's difficult to help you. Please >> post your code to pastebin or somewhere similar because posting long >> lines >> on usenet is considered bad etiquette. >> > > I would much prefer to have a code snippet that shows the problem > inline. Plus, what happens in six months time if someone finds this > thread but can't find the code online as it's expired? I agree, and this is also the policy enforced in freenode #bash. Please do not encourage people to pastebin entire scripts, because very few people will bother to read them. The ideal approach is to post a minimal code snippet that allows us to comprehend or reproduce the problem. This encourages the question to be well-framed. Otherwise idiots will dump their entire scripts into a pastebin and write to us "why it not work?". From nikos.gr33k at gmail.com Sun Jun 2 10:35:24 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 07:35:24 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> ?? ???????, 2 ??????? 2013 10:01:50 ?.?. UTC+3, ? ??????? Giorgos Tzampanakis ??????: OK George, nd the rest fo the guys here it is the snippet of files.py responsible to print the greek filenames: for row in data: (url, hits, host, lastvisit) = row shorturl = url.replace( '/home/nikos/www/data/apps/', '' ) lastvisit = lastvisit.strftime('%A %e %b, %H:%M') print('''
%s
%s
%s ''' % (shorturl, hits, host, lastvisit) ) and here is the the metrites.py snipper that calls files.py via subproccess to run: if page.endswith('.html'): with open('/home/nikos/public_html/' + page, encoding='utf-8') as f: htmldata = f.read() htmldata = htmldata % (quote, music) template = htmldata + counter elif page.endswith('.py'): htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' + page ) template = htmldata.decode('utf-8') + counter print( template ) From giorgos.tzampanakis at gmail.com Sun Jun 2 10:36:57 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Sun, 2 Jun 2013 14:36:57 +0000 (UTC) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: On 2013-06-02, ???????? ?????? wrote: [snip unreadable code] Okay, this sounds like a homework exercise. Also, it doesn't appear like you've spent any amount of time researching a solution yourself. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ From breamoreboy at yahoo.co.uk Sun Jun 2 10:51:31 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sun, 02 Jun 2013 15:51:31 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: On 02/06/2013 15:36, Giorgos Tzampanakis wrote: > On 2013-06-02, ???????? ?????? wrote: > > [snip unreadable code] > > Okay, this sounds like a homework exercise. Also, it doesn't appear like > you've spent any amount of time researching a solution yourself. > You've obviously arrived very late at the party. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From carlosnepomuceno at outlook.com Sun Jun 2 11:18:33 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sun, 2 Jun 2013 18:18:33 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com>, , <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com>, , Message-ID: ---------------------------------------- > To: python-list at python.org > From: breamoreboy at yahoo.co.uk > Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) > Date: Sun, 2 Jun 2013 15:51:31 +0100 [...] > "Steve is going for the pink ball - and for those of you who are > watching in black and white, the pink is next to the green." Snooker > commentator 'Whispering' Ted Lowe. > > Mark Lawrence > > -- > http://mail.python.org/mailman/listinfo/python-list looooooooooooe+666l From nikos.gr33k at gmail.com Sun Jun 2 11:02:07 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 08:02:07 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: ?? ???????, 2 ??????? 2013 5:36:57 ?.?. UTC+3, ? ??????? Giorgos Tzampanakis ??????: > On 2013-06-02, ???????? ?????? wrote: > > > > [snip unreadable code] > > > > Okay, this sounds like a homework exercise. Also, it doesn't appear like > you've spent any amount of time researching a solution yourself. I have spent days looking for a solution to this. Why you say it is unreadable? What is it that you do not understand? What would you want to be shown? From nikos.gr33k at gmail.com Sun Jun 2 11:04:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 08:04:44 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: ?? ???????, 2 ??????? 2013 5:51:31 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: > You've obviously arrived very late at the party. Apart from the "funny" commenting, can you for once contribute towards to an actual solution or this is the best you can do to prove yourself smart in here by talking down on me? From rosuav at gmail.com Sun Jun 2 11:15:16 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 01:15:16 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 1:04 AM, ???????? ?????? wrote: > ?? ???????, 2 ??????? 2013 5:51:31 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: > >> You've obviously arrived very late at the party. > > Apart from the "funny" commenting, can you for once contribute towards to an actual solution or this is the best you can do to prove yourself smart in here by talking down on me? What makes you think you can demand that we contribute to your problems? I'm serious. Why do you feel entitled to assistance, when you won't even put some effort into your posts? You loudly proclaim that you've "spent days looking for a solution" to some problem, yet you can't spend thirty seconds polishing your post before you hit Send? I call bogus (others may use some other b-word) on the whole "spent days" bit. If you had, you'd have found something. ChrisA From breamoreboy at yahoo.co.uk Sun Jun 2 11:24:10 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sun, 02 Jun 2013 16:24:10 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: On 02/06/2013 16:04, ???????? ?????? wrote: > ?? ???????, 2 ??????? 2013 5:51:31 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: > >> You've obviously arrived very late at the party. > > Apart from the "funny" commenting, can you for once contribute towards to an actual solution or this is the best you can do to prove yourself smart in here by talking down on me? > The only thing I'll contribute is that if you're looking to run a commercial venture, you wouldn't be the last on my list for services, you'd never get on it. Further I'll point out that you never give any indication at all of ever doing any research before you ask a question. You simply fire off email after email in the hope that you'll get a response. Luckily for you a substantial number of people have come to your rescue. Unfortunately for you, you've exhausted the patience of a number who might well have been extremely helpful *IF* you'd put in a little effort. That is just too much to ask of course. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From carlosnepomuceno at outlook.com Sun Jun 2 15:44:05 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sun, 2 Jun 2013 22:44:05 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com>, , <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com>, , , , Message-ID: Hey guys! Come on!!! Repeat with me: "Googsfraba!" http://www.youtube.com/watch?v=Fscuv4PIjws lol ---------------------------------------- > To: python-list at python.org > From: breamoreboy at yahoo.co.uk > Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) > Date: Sun, 2 Jun 2013 16:24:10 +0100 > > On 02/06/2013 16:04, ???????? ?????? wrote: >> ?? ???????, 2 ??????? 2013 5:51:31 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: >> >>> You've obviously arrived very late at the party. >> >> Apart from the "funny" commenting, can you for once contribute towards to an actual solution or this is the best you can do to prove yourself smart in here by talking down on me? >> > > The only thing I'll contribute is that if you're looking to run a > commercial venture, you wouldn't be the last on my list for services, > you'd never get on it. > > Further I'll point out that you never give any indication at all of ever > doing any research before you ask a question. You simply fire off email > after email in the hope that you'll get a response. Luckily for you a > substantial number of people have come to your rescue. Unfortunately > for you, you've exhausted the patience of a number who might well have > been extremely helpful *IF* you'd put in a little effort. That is just > too much to ask of course. > > -- > "Steve is going for the pink ball - and for those of you who are > watching in black and white, the pink is next to the green." Snooker > commentator 'Whispering' Ted Lowe. > > Mark Lawrence > > -- > http://mail.python.org/mailman/listinfo/python-list From nagia.retsina at gmail.com Sun Jun 2 15:51:59 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Sun, 2 Jun 2013 12:51:59 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com>,> , > <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com>, > , > , > , > Message-ID: <514e1984-d8df-4f03-aca7-de7962c76f67@googlegroups.com> ?? ???????, 2 ??????? 2013 10:44:05 ?.?. UTC+3, ? ??????? Carlos Nepomuceno ??????: > Hey guys! Come on!!! > Repeat with me: "Googsfraba!" You are not and Jack Nicholson and this is not an Anger Management lesson (which was a great movie btw). I'am the one that i should chant that mantra because instead of receiving helpfull replies i get that kind of responses. Now, is anyone willing to help me on this please? I also accept hints on how to solve this! From rosuav at gmail.com Sun Jun 2 16:46:59 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 06:46:59 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <514e1984-d8df-4f03-aca7-de7962c76f67@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <514e1984-d8df-4f03-aca7-de7962c76f67@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 5:51 AM, wrote: > Now, is anyone willing to help me on this please? > I also accept hints on how to solve this! Hints I can do. Here, I've set up a scavenger hunt for you. You'll go to a number of web sites that I nominate, type in keywords, and hit enter. The first web site is Google: www.google.com Type in: suexec The second web site is DuckDuckGo: www.duckduckgo.com Type in: paid apache technical support The third web site is ESR Question (not its official name): http://www.catb.org/esr/faqs/smart-questions.html Unlike the other two, this one is so smart (it says it right in the URL!) that it doesn't need you to type anything in! Read through these pages. You will find clues scattered throughout; some of them will be solved by typing them into one of the first two web sites. When you complete the scavenger hunt, you will find your prize. ChrisA From nikos.gr33k at gmail.com Mon Jun 3 00:59:52 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 21:59:52 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <514e1984-d8df-4f03-aca7-de7962c76f67@googlegroups.com> Message-ID: <0a154b18-ea67-48a9-908a-0334c6af29fa@googlegroups.com> I did all the google searh i could, but iwht no luxk, this is no suexec issue. Why you say it is one? The other problem i had was 'suexec' related, not this one, this is a subprocess issue. From nikos.gr33k at gmail.com Sun Jun 2 11:23:23 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 08:23:23 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: <7c5a226b-8217-4b3c-a368-57b69e5f3a33@googlegroups.com> ?? ???????, 2 ??????? 2013 6:15:16 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >> Apart from the "funny" commenting, can you for once contribute towards to an >> actual solution or this is the best you can do to prove yourself smart in here >> by talking down on me? > What makes you think you can demand that we contribute to your problems? I'am an OP like everybody else in here and i don't demand anything. But ome people instead of being helpfull or even ignore, think its better to belittle me. You are a special case, because you do both(you ahve actually provided me hits manh times), but that is not the case of some other regulars. > I'm serious. Why do you feel entitled to assistance, when you won't > even put some effort into your posts? You loudly proclaim that you've > "spent days looking for a solution" to some problem, yet you can't > spend thirty seconds polishing your post before you hit Send? I'm clipping my posts from googles '/n' addition and i'am quoating too. > I call bogus (others may use some other b-word) on the whole "spent > days" bit. If you had, you'd have found something. Yes i have and i wasn't able to find something other that this maybe be a bug. If i had i wouldn't be asking here. From nikos.gr33k at gmail.com Sun Jun 2 11:36:10 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 08:36:10 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: ?? ???????, 2 ??????? 2013 6:24:10 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: Nikos wrote: > > Apart from the "funny" commenting, can you for once contribute towards to an actual solution or this is the best you can do to prove yourself smart in here by talking down on me? > The only thing I'll contribute is that if you're looking to run a > commercial venture, you wouldn't be the last on my list for services, > you'd never get on it. I wouldn't want you as i client either. > Further I'll point out that you never give any indication at all of ever > doing any research before you ask a question. You simply fire off email > after email in the hope that you'll get a response. Luckily for you a > substantial number of people have come to your rescue. Unfortunately > for you, you've exhausted the patience of a number who might well have > been extremely helpful *IF* you'd put in a little effort. That is just > too much to ask of course. *IF* ? So, you think i'm not putting any effort? Almost always i post out snippets of what i have tried in my numerous attempts to solve some issue i've encountered. Putting forward effort and being able to actually solve a problem is two difeerent things. Where is your attemps to provide an actual help to me for once It is not obligatory of course but a matter of good will, but instead of doing that, you choose not only to not help or at least ignore, but consistently making fun at my expense. From breamoreboy at yahoo.co.uk Sun Jun 2 11:55:31 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sun, 02 Jun 2013 16:55:31 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: On 02/06/2013 16:36, ???????? ?????? wrote > > *IF* ? > So, you think i'm not putting any effort? > > Almost always i post out snippets of what i have tried in my numerous attempts to solve some issue i've encountered. > > Putting forward effort and being able to actually solve a problem is two difeerent things. > > Where is your attemps to provide an actual help to me for once > It is not obligatory of course but a matter of good will, but instead of doing that, you choose not only to not help or at least ignore, but consistently making fun at my expense. > I don't think, I know. How can you be putting in any effort when you give yourself no thinking time? When you ask for a response maybe two hours after you've first posted? Basically you're using this group as a *FREE* technical support service. If you want something done to suit you, either put the effort in first, show some patience, or *PAY* for support. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From nikos.gr33k at gmail.com Sun Jun 2 12:21:19 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 09:21:19 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> Message-ID: <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> ?? ???????, 2 ??????? 2013 6:55:31 ?.?. UTC+3, ? ??????? Mark Lawrence ??????: > I don't think, I know. How can you be putting in any effort when you > give yourself no thinking time? When you ask for a response maybe two > hours after you've first posted? Basically you're using this group as a > *FREE* technical support service. If you want something done to suit > you, either put the effort in first, show some patience, or *PAY* for > support. Certainly *not you*, since you not proven yourself knowlengeable to me or in the case you are, certainly not helpfull but ironic instead. This is a a *free* python list. Everybody receiving help in here does nto have to pay. this might be a simple trick like the other issues i had with the pymysql connector where it needed 'charser='utf8'' instead of 'charser='utf-8'' which is what i was trying. Couldn't think of the dash because in any other case i happened to make use of 'utf-8' in my scripts, it was mentioned with a dash inside the statements like: print( '''Content-type: text/html; charset=utf-8\n''' open('/home/nikos/public_html/' + page, encoding='utf-8') as f: So i assumed, 'charset=utf-8' too, didn't occured to me an other symbolism. Paying for someone to just remove a dash to get the script working is too much to ask for, but paying for someone from this list to convert my scripts to Django, and i will at some point because this site advertises webhosting is logically. I want the scripts to user latest versions of python and the best code it can be done so, to be quick and functional. I cannot of course expect someone to do the conversion for me for free. From rosuav at gmail.com Sun Jun 2 12:31:25 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 02:31:25 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 2:21 AM, ???????? ?????? wrote: > Paying for someone to just remove a dash to get the script working is too much to ask for One dash: 1c Knowing where to remove it: $99.99 Total bill: $100.00 Knowing that it ought really to be "utf8mb4" and giving hints that the docs should be read rather than just taking this simple example and plugging it in: Priceless. ChrisA From gheskett at wdtv.com Sun Jun 2 13:11:17 2013 From: gheskett at wdtv.com (Gene Heskett) Date: Sun, 2 Jun 2013 13:11:17 -0400 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> Message-ID: <201306021311.17717.gheskett@wdtv.com> On Sunday 02 June 2013 13:10:30 Chris Angelico did opine: > On Mon, Jun 3, 2013 at 2:21 AM, ???????? ?????? wrote: > > Paying for someone to just remove a dash to get the script working is > > too much to ask for > > One dash: 1c > Knowing where to remove it: $99.99 > Total bill: $100.00 > > Knowing that it ought really to be "utf8mb4" and giving hints that the > docs should be read rather than just taking this simple example and > plugging it in: Priceless. > > ChrisA Chuckle. Chris, I do believe you have topped yourself. Love it. Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) My web page: is up! My views Unnamed Law: If it happens, it must be possible. A pen in the hand of this president is far more dangerous than 200 million guns in the hands of law-abiding citizens. From nikos.gr33k at gmail.com Sun Jun 2 12:44:07 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 09:44:07 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> Message-ID: <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> ?? ???????, 2 ??????? 2013 7:31:25 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Mon, Jun 3, 2013 at 2:21 AM, ???????? ?????? wrote: > > > Paying for someone to just remove a dash to get the script working is too much to ask for > One dash: 1c > Knowing where to remove it: $99.99 > Total bill: $100.00 > Knowing that it ought really to be "utf8mb4" and giving hints that th > docs should be read rather than just taking this simple example and > plugging it in: Priceless. I agree. So how much to solve this issue too Chris? And would you spare me the charge for the dash(-) problem which you pointed out and solved? :-) From rosuav at gmail.com Sun Jun 2 13:05:32 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 03:05:32 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 2:44 AM, ???????? ?????? wrote: > ?? ???????, 2 ??????? 2013 7:31:25 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >> On Mon, Jun 3, 2013 at 2:21 AM, ???????? ?????? wrote: >> >> > Paying for someone to just remove a dash to get the script working is too much to ask for > >> One dash: 1c >> Knowing where to remove it: $99.99 >> Total bill: $100.00 > >> Knowing that it ought really to be "utf8mb4" and giving hints that th >> docs should be read rather than just taking this simple example and >> plugging it in: Priceless. > > I agree. > So how much to solve this issue too Chris? > And would you spare me the charge for the dash(-) problem which you pointed out and solved? :-) A programmer chooses his own clients, and you are the Atherton Wing to my Inara Serra. ChrisA From timothy.c.delaney at gmail.com Sun Jun 2 19:10:09 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Mon, 3 Jun 2013 09:10:09 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: > > A programmer chooses his own clients, and you are the Atherton Wing to > my Inara Serra. > I've just been watching this train wreck (so glad I didn't get involved at the start) but I have to say - that's brilliant Chris. Thank you for starting my week off so well. Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From timothy.c.delaney at gmail.com Sun Jun 2 19:13:08 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Mon, 3 Jun 2013 09:13:08 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: On 3 June 2013 09:10, Tim Delaney wrote: > A programmer chooses his own clients, and you are the Atherton Wing to >> my Inara Serra. >> > > I've just been watching this train wreck (so glad I didn't get involved at > the start) but I have to say - that's brilliant Chris. Thank you for > starting my week off so well. > And I just realised I missed a shiny opportunity to wrangle "train job" in there ... Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Mon Jun 3 01:02:47 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 15:02:47 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 9:10 AM, Tim Delaney wrote: >> A programmer chooses his own clients, and you are the Atherton Wing to >> my Inara Serra. > > > I've just been watching this train wreck (so glad I didn't get involved at > the start) but I have to say - that's brilliant Chris. Thank you for > starting my week off so well. That went well. *sighs happily* ChrisA From nikos.gr33k at gmail.com Mon Jun 3 01:05:28 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 22:05:28 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> Chris can you please help me solve this problem? Why subprocess fails when it has to deal with a greek flename? and that an indirect call too.... From nikos.gr33k at gmail.com Mon Jun 3 01:22:33 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 22:22:33 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> Message-ID: <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> Ok, this email is something of a recital of how I approached this. The apache error log: I restarted the apache: /etc/init.d/httpd restart Then a: ps axf gave me the PID of a running httpd. Examining its open files: lsof -p 9287 shows me: httpd 9287 nobody 2w REG 0,192 12719609 56510510 /usr/local/apache/logs/error_log httpd 9287 nobody 7w REG 0,192 7702310 56510512 /usr/local/apache/logs/access_log among many others. So, to monitor these logs: tail -F /usr/local/apache/logs/error_log /usr/local/apache/logs/access_log & placing the tail in the background so I can still use that shell. Watching the log while fetching the page: http://superhost.gr/ says: ==> /usr/local/apache/logs/error_log <== [Tue Apr 23 12:11:40 2013] [error] [client 54.252.27.86] suexec policy violation: see suexec log for more details [Tue Apr 23 12:11:40 2013] [error] [client 54.252.27.86] Premature end of script headers: metrites.py [Tue Apr 23 12:11:40 2013] [error] [client 54.252.27.86] File does not exist: /home/nikos/public_html/500.shtml [Tue Apr 23 12:11:43 2013] [error] [client 107.22.40.41] suexec policy violation: see suexec log for more details [Tue Apr 23 12:11:43 2013] [error] [client 107.22.40.41] Premature end of script headers: metrites.py [Tue Apr 23 12:11:43 2013] [error] [client 107.22.40.41] File does not exist: /home/nikos/public_html/500.shtml [Tue Apr 23 12:11:45 2013] [error] [client 79.125.63.121] suexec policy violation: see suexec log for more details [Tue Apr 23 12:11:45 2013] [error] [client 79.125.63.121] Premature end of script headers: metrites.py [Tue Apr 23 12:11:45 2013] [error] [client 79.125.63.121] File does not exist: /home/nikos/public_html/500.shtml So: You're using suexec in your Apache. This greatly complicates your debugging. Suexec seems to be a facility for arranging that CGI script run as the user who owns them. Because that has a lot of potential for ghastly security holes, suexec performs a large number of strict checks on CGI script locations, permissions and locations before running a CGI script. At a guess the first hurdle would be that metrites.py is owned by root. Suexec is very picky about what users it is prepared to become. "root" is not one of them, as you might imagine. I've chowned metrites.py to nikos:nikos. Suexec not lets it run, producing this: Traceback (most recent call last): File "metrites.py", line 9, in sys.stderr = open('/home/nikos/public_html/cgi.err.out', 'a') PermissionError: [Errno 13] Permission denied: '/home/nikos/public_html/cgi.err.out' That file is owned by root. metrites.py is being run as nikos. So: chown nikos:nikos /home/nikos/public_html/cgi.err.out A page reload now shows this: Error in sys.excepthook: UnicodeEncodeError: 'ascii' codec can't encode characters in position 2334-2342: ordinal not in range(128) Original exception was: Traceback (most recent call last): File "metrites.py", line 226, in print( template ) UnicodeEncodeError: 'ascii' codec can't encode characters in position 30-38: ordinal not in range(128) This shows you writing the string in template to stdout. The default encoding for stdout is 'ascii', accepting only characters of values 0..127. I expect template contains more than this, since the ASCII range is very US Anglocentric; Greek characters for example won't encode into ascii. As mentioned in the thread on python-list, python will adopt your terminal's encoding it used interactively but will be pretty conservation if the output is not a terminal; ascii as you see above. What you want is probably UTF-8 in the output byte stream. But let's check what the HTTP headers are saying, because _they_ tell the browser the byte stream encoding. The headers and your program's encoding must match. So: % wget -S -O - http://superhost.gr/ --2013-04-23 19:34:38-- http://superhost.gr/ Resolving superhost.gr (superhost.gr)... 82.211.30.133 Connecting to superhost.gr (superhost.gr)|82.211.30.133|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Tue, 23 Apr 2013 09:34:46 GMT Server: Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Length: unspecified [text/html] Saving to: ?STDOUT? --> --> So, the Content-Type: header says: "text/html; charset=utf-8". So that's good. So I've imported codecs and added this line: sys.stdout = os.fdopen(1, 'w', encoding='utf-8') under the setting of sys.stderr. If the cgi libraries run under python 3 there is probably a cleaner way to do this but i don't know how. This just opens UNIX file descriptor 1 (standard output) from scratch for write ('w') using the 'utf-8' encoding. And now your CGI script runs, accepting strings sent to print(). sys.stdout now takes care of transcoding those strings (Unicode character code points inside Python) into the utf-8 encoding required in the output bytes. From nikos.gr33k at gmail.com Mon Jun 3 01:31:53 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 22:31:53 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> Message-ID: <3e4caaa7-99d7-4d4e-b589-3214f1474a69@googlegroups.com> But still when it comes to subprocess trying to call files.py which in turn tries to call a greek filename i get the same response i posted at my initial post. From torriem at gmail.com Mon Jun 3 01:45:56 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 02 Jun 2013 23:45:56 -0600 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> Message-ID: <51AC2D94.2030602@gmail.com> On 06/02/2013 11:22 PM, ???????? ?????? wrote: > Ok, this email is something of a recital of how I approached this. Excellent. You're making progress. Keep doing research, and learn how to debug your python programs. One thing I've done as a last resort when I just can't get good error reporting because of subprocess or something else, is to have my script open a file in /tmp and write messages to it as the program executes. Sometimes I write out what the standard input was so I know for doing a standalone run. There's your free hint for the day. From nikos.gr33k at gmail.com Mon Jun 3 02:11:10 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 23:11:10 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> Message-ID: <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> Thankls Michael, are these two behave the same in your opinion? sys.stdout = os.fdopen(1, 'w', encoding='utf-8') which is what i have now opposed to this one import ocdecs sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) Which one should i keep and why? From breamoreboy at yahoo.co.uk Mon Jun 3 05:00:23 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Mon, 03 Jun 2013 10:00:23 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> Message-ID: On 03/06/2013 07:11, ???????? ?????? wrote: > Thankls Michael, > > are these two behave the same in your opinion? > > sys.stdout = os.fdopen(1, 'w', encoding='utf-8') > > which is what i have now > opposed to this one > > import ocdecs > sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) > > Which one should i keep and why? > import ocdecs? Sums up perfectly the amount of effort you put in. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From rosuav at gmail.com Mon Jun 3 05:05:28 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 19:05:28 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 7:00 PM, Mark Lawrence wrote: > On 03/06/2013 07:11, ???????? ?????? wrote: >> >> Thankls Michael, >> >> are these two behave the same in your opinion? >> >> sys.stdout = os.fdopen(1, 'w', encoding='utf-8') >> >> which is what i have now >> opposed to this one >> >> import ocdecs >> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) >> >> Which one should i keep and why? >> > > import ocdecs? > > Sums up perfectly the amount of effort you put in. If he imported a little more OCD, it might help a lot. ChrisA From nikos.gr33k at gmail.com Mon Jun 3 05:32:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 3 Jun 2013 02:32:42 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> Message-ID: <29bc5bfa-4bfd-4339-b78e-2c1b7f443980@googlegroups.com> Here is the whole code of files.py in case someone wants to comment on somethign about how to properly encode/decode the filanames, which seems to be the problem. http://pastebin.com/qXasy5iU From steve+comp.lang.python at pearwood.info Mon Jun 3 19:04:00 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 23:04:00 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <08d3f040-8f29-414c-a24e-c728cd387278@googlegroups.com> <1e3ee6bc-f14c-4ffd-861b-7bab16e8b750@googlegroups.com> <29bc5bfa-4bfd-4339-b78e-2c1b7f443980@googlegroups.com> Message-ID: <51ad20df$0$11118$c3e8da3@news.astraweb.com> On Mon, 03 Jun 2013 02:32:42 -0700, ???????? ?????? wrote: > Here is the whole code of files.py in case someone wants to comment on > somethign about how to properly encode/decode the filanames, which seems > to be the problem. > > http://pastebin.com/qXasy5iU Second line in the file says: import cgi, re, os, sys, socket, datetime, pymysql, locale but there is no pymysql module available. Fix that problem, and then we can look at the next problem. -- Steven From steve+comp.lang.python at pearwood.info Mon Jun 3 02:46:46 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 06:46:46 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> Message-ID: <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> On Sun, 02 Jun 2013 22:05:28 -0700, ???????? ?????? wrote: > Why subprocess fails when it has to deal with a greek flename? and that > an indirect call too.... It doesn't. The command you are calling fails, not subprocess. The code you show is this: /home/nikos/public_html/cgi-bin/metrites.py in () 217 template = htmldata + counter 218 elif page.endswith('.py'): => 219 htmldata = subprocess.check_output( '/home/nikos/ public_html/cgi-bin/' + page ) 220 template = htmldata.decode('utf-8').replace ( 'Content-type: text/html; charset=utf-8', '' ) + counter The first step is to inspect the value of the file name. Normally I would just call print, but since this is live code, and a web server, you probably don't want to use print directly. But you can print to a file, and then inspect the file. Using logging is probably better, but here's a real quick and dirty way to get the same result: elif page.endswith('.py'): name = '/home/nikos/public_html/cgi-bin/' + page print(name, file=open('/home/nikos/out.txt', 'w')) htmldata = subprocess.check_output(name) Now inspect /tmp/out.txt using the text editor of your choice. What does it contain? Is the file name of the executable what you expect? Does it exist, and is it executable? The next step, after checking that, is to check the executable .py file. It may contain a bug which is causing this problem. However, I think I can guess what the nature of the problem is. The output you show includes: cmd = '/home/nikos/public_html/cgi-bin/files.py' output = b'Content-type: text/html; charset=utf-8\n\n\n\n' My *guess* of your problem is this: your file names have invalid bytes in them, when interpreted as UTF-8. Remember, on a Linux system, file names are stored as bytes. So the file- name-as-a-string need to be *encoded* into bytes. My *guess* is that somehow, when renaming your files, you gave them a name which may be correctly encoded in some other encoding, but not in UTF-8. Then, when you try to read the file names in UTF-8, you hit an illegal byte, half of a surrogate pair perhaps, and everything blows up. Something like this: py> s = "???????? ??????" py> b = s.encode('ISO-8859-7') # Oh oh, wrong encoding! py> print(b) b'\xcd\xe9\xea\xfc\xeb\xe1\xef\xf2 \xca\xef\xfd\xf1\xe1\xf2' py> b.decode('UTF-8') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 0: invalid continuation byte Obviously the error is a little different, because the original string is different. If I am right, the solution is to fix the file names to ensure that they are all valid UTF-8 names. If you view the directory containing these files in a file browser that supports UTF-8, do you see any file names containing Mojibake? http://en.wikipedia.org/wiki/Mojibake Fix those file names, and hopefully the problem will go away. -- Steven From rosuav at gmail.com Mon Jun 3 03:36:39 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 17:36:39 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Mon, Jun 3, 2013 at 4:46 PM, Steven D'Aprano wrote: > Then, when > you try to read the file names in UTF-8, you hit an illegal byte, half of > a surrogate pair perhaps, and everything blows up. Minor quibble: Surrogates are an artifact of UTF-16, so they're 16-bit values like 0xD808 or 0xDF45. Possibly what you're talking about here is a continuation byte, which in UTF-8 are used only after a lead byte. For instance: 0xF0 0x92 0x8D 0x85 is valid UTF-8, but 0x41 0x92 is not. There is one other really annoying thing to deal with, and that's the theoretical UTF-8 encoding of a UTF-16 surrogate. (I say "theoretical" because strictly, these are invalid; UTF-8 does not encode invalid codepoints.) 0xED 0xA0 0x88 and 0xED 0xBD 0x85 encode the two I mentioned above. Depending on what's reading the filename, you might actually have these throw errors, or maybe not. Python's decoder is correctly strict: >>> str(b'\xed\xa0\x88','utf-8') Traceback (most recent call last): File "", line 1, in str(b'\xed\xa0\x88','utf-8') UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-2: invalid continuation byte Actually, I'm not sure here, but I think that error message may be wrong, or at least unclear. It's perfectly possible to decode those bytes using the UTF-8 algorithm; you end up with the value 0xD808, which you then reject because it's a surrogate. But maybe the Python UTF-8 decoder simplifies some of that. ChrisA From nikos.gr33k at gmail.com Mon Jun 3 05:12:31 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 3 Jun 2013 02:12:31 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> Message-ID: ?? ???????, 3 ??????? 2013 9:46:46 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > If I am right, the solution is to fix the file names to ensure that they > are all valid UTF-8 names. If you view the directory containing these > files in a file browser that supports UTF-8, do you see any file names > containing Mojibake? > Fix those file names, and hopefully the problem will go away. You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' => 'E??? ??? ?????.mp3' and here is how it appears the filename directory listing via Chrome. http://superhost.gr/data/apps/ I doesn't display the file with proper Greek characters but with *Mojibake* instead. So, as you correctly said when files.py need to actually open that file, it cannot decode its stored byte stream from the hdd to proper 'utf-8' charset. So, how will files.py be able to open these files then?!?! From rustompmody at gmail.com Mon Jun 3 08:54:30 2013 From: rustompmody at gmail.com (rusi) Date: Mon, 3 Jun 2013 05:54:30 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> Message-ID: <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> On Jun 3, 2:12?pm, ???????? ?????? wrote: > You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' => 'E??? ??? ?????.mp3' and? Is that how you renamed your file? In any case thats what I see!! [Dont whether to say: Its greek to me or its not greek to me!!] From nagia.retsina at gmail.com Mon Jun 3 09:48:51 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Mon, 3 Jun 2013 06:48:51 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> Message-ID: <40d41d2e-0dc5-4160-9c52-e65781ed1170@googlegroups.com> ?? ???????, 3 ??????? 2013 3:54:30 ?.?. UTC+3, ? ??????? rusi ??????: > Is that how you renamed your file? > In any case thats what I see! > [Dont whether to say: Its greek to me or its not greek to me!!] Now! that weird again. I rename sit using proper Greek letters but as it appears to you it also appears to me via Chrome. Also this is how it looks like via linux cmd listing: nikos at superhost.gr [~/www/cgi-bin]# ls -l ../data/apps/ total 368548 drwxr-xr-x 2 nikos nikos 4096 Jun 3 12:07 ./ drwxr-xr-x 6 nikos nikos 4096 May 26 21:13 ../ -rwxr-xr-x 1 nikos nikos 13157283 Mar 17 12:57 100\ Mythoi\ tou\ Aiswpou.pdf* -rwxr-xr-x 1 nikos nikos 29524686 Mar 11 18:17 Anekdotologio.exe* -rw-r--r-- 1 nikos nikos 42413964 Jun 2 20:29 Battleship.exe -rwxr-xr-x 1 nikos nikos 66896732 Mar 17 13:13 Kosmas\ o\ Aitwlos\ -\ Profiteies .pdf* -rw-r--r-- 1 nikos nikos 51819750 Jun 2 20:04 Luxor\ Evolved.exe -rw-r--r-- 1 nikos nikos 60571648 Jun 2 14:59 Monopoly.exe -rwxr-xr-x 1 nikos nikos 1788164 Mar 14 11:31 Online\ Movie\ Player.zip* -rw-r--r-- 1 nikos nikos 5277287 Jun 1 18:35 O\ Nomos\ tou\ Merfy\ v1-2-3.zip -rwxr-xr-x 1 nikos nikos 16383001 Jun 22 2010 Orthodoxo\ Imerologio.exe* -rw-r--r-- 1 nikos nikos 6084806 Jun 1 18:22 Pac-Man.exe -rw-r--r-- 1 nikos nikos 25476584 Jun 2 19:50 Scrabble\ 2013.exe -rw-r--r-- 1 nikos nikos 236032 Jun 2 19:31 Skepsou\ enan\ arithmo!.exe -rwxr-xr-x 1 nikos nikos 49141166 Mar 17 12:48 To\ 1o\ mou\ vivlio\ gia\ to\ ska ki.pdf* -rwxr-xr-x 1 nikos nikos 3298310 Mar 17 12:45 Vivlos\ gia\ Atheofovous.pdf* -rw-r--r-- 1 nikos nikos 1764864 May 29 21:50 V-Radio\ v2.4.msi -rw-r--r-- 1 nikos nikos 3511233 Jun 3 12:07 ?? ???\ ? ???.mp3 nikos at superhost.gr [~/www/cgi-bin]# Why doesnt the name of the ? file doesnt appear in proper Greek letter neither from cmd nor for Chrome too? It's no wonder files.py cant decode it in 'utf-8' How can i make the filanems appear properly or at least decode from byte strea,m to utf-8 properly so they can be opened via the python script without error? From steve+comp.lang.python at pearwood.info Mon Jun 3 18:37:37 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 22:37:37 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> Message-ID: <51ad1ab1$0$11118$c3e8da3@news.astraweb.com> (Note: this post is sent using UTF-8. If anyone reading this sees mojibake, please make sure your email or news client is set to use UTF-8.) On Mon, 03 Jun 2013 05:54:30 -0700, rusi wrote: > On Jun 3, 2:12?pm, ???????? ?????? wrote: >> You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' => >> 'E??? ??? ?????.mp3' and? > > Is that how you renamed your file? > In any case thats what I see!! rusi, whatever program you are using to read these posts is buggy. Nicholas (please excuse me ASCII-fying his name, but given that we are discussing encoding problems, it is probably for the best) sent his post with a header line: charset=ISO-8859-7 If your client honoured that charset line, you would see: E??? ??? ?????.mp3 It looks like your client is ignoring the charset header, and interpreting the bytes as Latin-1 when they are actually ISO-8859-7. py> s = 'E??? ??? ?????.mp3' py> print(s.encode('ISO-8859-7').decode('latin-1')) E??? ??? ?????.mp3 which matches what you see. If you can manually tell your client to use ISO-8859-7, you should see it correctly. -- Steven From rustompmody at gmail.com Tue Jun 4 00:35:13 2013 From: rustompmody at gmail.com (rusi) Date: Mon, 3 Jun 2013 21:35:13 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> <51ad1ab1$0$11118$c3e8da3@news.astraweb.com> Message-ID: <780fb4b4-26c1-408a-a40e-82d3f6d8564f@pd6g2000pbc.googlegroups.com> On Jun 4, 3:37?am, Steven D'Aprano wrote: > (Note: this post is sent using UTF-8. If anyone reading this sees > mojibake, please make sure your email or news client is set to use UTF-8.) > > On Mon, 03 Jun 2013 05:54:30 -0700, rusi wrote: > > On Jun 3, 2:12?pm, ???????? ?????? wrote: > >> You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' => > >> 'E??? ??? ?????.mp3' and? > > > Is that how you renamed your file? > > In any case thats what I see!! > > rusi, whatever program you are using to read these posts is buggy. When you go to the python mailing list archive and look at Nikos mail http://mail.python.org/pipermail/python-list/2013-June/648301.html I see [Not claiming to understand all this unicode stuff...] From steve+comp.lang.python at pearwood.info Tue Jun 4 01:48:55 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 05:48:55 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> <51ad1ab1$0$11118$c3e8da3@news.astraweb.com> <780fb4b4-26c1-408a-a40e-82d3f6d8564f@pd6g2000pbc.googlegroups.com> Message-ID: <51ad7fc7$0$11118$c3e8da3@news.astraweb.com> On Mon, 03 Jun 2013 21:35:13 -0700, rusi wrote: > On Jun 4, 3:37?am, Steven D'Aprano +comp.lang.pyt... at pearwood.info> wrote: >> (Note: this post is sent using UTF-8. If anyone reading this sees >> mojibake, please make sure your email or news client is set to use >> UTF-8.) >> >> On Mon, 03 Jun 2013 05:54:30 -0700, rusi wrote: >> > On Jun 3, 2:12?pm, ???????? ?????? wrote: >> >> You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' >> >> => 'E??? ??? ?????.mp3' and? >> >> > Is that how you renamed your file? >> > In any case thats what I see!! >> >> rusi, whatever program you are using to read these posts is buggy. > > When you go to the python mailing list archive and look at Nikos mail > http://mail.python.org/pipermail/python-list/2013-June/648301.html I see > You're looking at the encoding of the HTML page which displays only the body and a few selected headers, copied from Nikos' post. It has no connection to the encoding of the post itself. If you're using Thunderbird, or some other mail/news client, there is usually an option to View Raw Post or View Entire Message or something similar. Use that on the original post, not the web archive. > [Not claiming to understand all this unicode stuff...] :-) Start here: http://www.joelonsoftware.com/articles/Unicode.html http://nedbatchelder.com/text/unipain.html -- Steven From nikos.gr33k at gmail.com Tue Jun 4 02:43:52 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 3 Jun 2013 23:43:52 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51ad1ab1$0$11118$c3e8da3@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <8e6d9391-2afd-406d-af3c-933e0dbb1c02@ks18g2000pbb.googlegroups.com> <51ad1ab1$0$11118$c3e8da3@news.astraweb.com> Message-ID: ?? ?????, 4 ??????? 2013 1:37:37 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: >It looks like your client is ignoring the charset header, and >interpreting the bytes as Latin-1 when they are actually ISO-8859-7. >py> s = 'E??? ??? ?????.mp3' >py> print(s.encode('ISO-8859-7').decode('latin-1')) >E??? ??? ?????.mp3 >which matches what you see. If you can manually tell your client to use >ISO-8859-7, you should see it correctly. I think is this is the case too steven, but it suprises me that Chrome ignores the charset header. Actually when i toild explicitly Chrome to display everythign as utf-8 it presented the filanem properly. py> print(s.encode('ISO-8859-7').decode('latin-1')) Why you are encoding the 's' string to greek-iso? Isn't it by itself in greek-iso since it uses greek letters? From steve+comp.lang.python at pearwood.info Mon Jun 3 18:46:53 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 22:46:53 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> On Mon, 03 Jun 2013 02:12:31 -0700, ???????? ?????? wrote: > ?? ???????, 3 ??????? 2013 9:46:46 ?.?. UTC+3, ? ??????? Steven D'Aprano > ??????: > >> If I am right, the solution is to fix the file names to ensure that >> they are all valid UTF-8 names. If you view the directory containing >> these files in a file browser that supports UTF-8, do you see any file >> names containing Mojibake? > >> Fix those file names, and hopefully the problem will go away. > > You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' => > 'E??? ??? ?????.mp3' and here is how it appears the filename directory > listing via Chrome. > > http://superhost.gr/data/apps/ > > I doesn't display the file with proper Greek characters but with > *Mojibake* instead. Not so -- it actually shows correctly, provided you use the right encoding. Tell your browser to view the page as UTF-8, and the file name is displayed correctly. By default, my browser Iceweasel views the page as Latin-1, which displays like this: ???????? ?????? ??????????.mp3 so the first thing you need to fix is to find some way to tell Apache to include a UTF-8 encoding line in its automatically generated pages. Then at least it will display correctly for visitors. I now tentatively believe that the file names are correct, using the UTF-8 encoding. But you can help confirm this: * What operating system are you using? If Linux, what distro and version? * What is the output of the locale command? -- Steven From nagia.retsina at gmail.com Tue Jun 4 02:28:21 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Mon, 3 Jun 2013 23:28:21 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: ?? ?????, 4 ??????? 2013 1:46:53 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > Not so -- it actually shows correctly, provided you use the right > encoding. Tell your browser to view the page as UTF-8, and the file name > is displayed correctly. I can't believe Chrome whcih by default uses utf8 chosed iso-8859-1 to presnt the filenames. You were right Steven, when i explicitly told him to presnt page sin utf8 it then started to show tha filesname correctly. > I now tentatively believe that the file names are correct, using the UTF-8 > encoding. But you can help confirm this: > * What operating system are you using? If Linux, what distro and version? > * What is the output of the locale command? First of all thank you very much for being so cooperative, i appreciate it. Here is some of my system insight you wanted to see. nikos at superhost.gr [~]# uname -a Linux nikos.superhost.gr 2.6.32-042stab075.2 #1 SMP Tue May 14 20:38:14 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux nikos at superhost.gr [~]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= nikos at superhost.gr [~]# I'am using CentOS v6.4 becaue it is the only linux OS that supports cPanel which my clients need to administer their websites. Hese is also how the terminal presents my filenames. nikos at superhost.gr [~]# ls -l www/data/apps/ total 368548 drwxr-xr-x 2 nikos nikos 4096 Jun 3 12:07 ./ drwxr-xr-x 6 nikos nikos 4096 May 26 21:13 ../ -rwxr-xr-x 1 nikos nikos 13157283 Mar 17 12:57 100\ Mythoi\ tou\ Aiswpou.pdf* -rwxr-xr-x 1 nikos nikos 29524686 Mar 11 18:17 Anekdotologio.exe* -rw-r--r-- 1 nikos nikos 42413964 Jun 2 20:29 Battleship.exe -rwxr-xr-x 1 nikos nikos 66896732 Mar 17 13:13 Kosmas\ o\ Aitwlos\ -\ Profiteies .pdf* -rw-r--r-- 1 nikos nikos 51819750 Jun 2 20:04 Luxor\ Evolved.exe -rw-r--r-- 1 nikos nikos 60571648 Jun 2 14:59 Monopoly.exe -rwxr-xr-x 1 nikos nikos 1788164 Mar 14 11:31 Online\ Movie\ Player.zip* -rw-r--r-- 1 nikos nikos 5277287 Jun 1 18:35 O\ Nomos\ tou\ Merfy\ v1-2-3.zip -rwxr-xr-x 1 nikos nikos 16383001 Jun 22 2010 Orthodoxo\ Imerologio.exe* -rw-r--r-- 1 nikos nikos 6084806 Jun 1 18:22 Pac-Man.exe -rw-r--r-- 1 nikos nikos 25476584 Jun 2 19:50 Scrabble\ 2013.exe -rw-r--r-- 1 nikos nikos 236032 Jun 2 19:31 Skepsou\ enan\ arithmo!.exe -rwxr-xr-x 1 nikos nikos 49141166 Mar 17 12:48 To\ 1o\ mou\ vivlio\ gia\ to\ ska ki.pdf* -rwxr-xr-x 1 nikos nikos 3298310 Mar 17 12:45 Vivlos\ gia\ Atheofovous.pdf* -rw-r--r-- 1 nikos nikos 1764864 May 29 21:50 V-Radio\ v2.4.msi -rw-r--r-- 1 nikos nikos 3511233 Jun 3 12:07 ?? ???\ ? ???.mp3 nikos at superhost.gr [~]# Its wird, because as locale showed from above terminal is set to 'utf-8' but the greek filename cannot be viewed properly. I must say though, that i have renamed it from my Windows 8 system and then uploaded via FileZilla to my remote webhost server. Maybe windows 8 is causing this? I'll try renaming it via terminal too. f you want to see soemhtign else please ask me to show you Steven. From rosuav at gmail.com Tue Jun 4 03:35:31 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 17:35:31 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Tue, Jun 4, 2013 at 4:28 PM, wrote: > ?? ?????, 4 ??????? 2013 1:46:53 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > >> Not so -- it actually shows correctly, provided you use the right >> encoding. Tell your browser to view the page as UTF-8, and the file name >> is displayed correctly. > > I can't believe Chrome whcih by default uses utf8 chosed iso-8859-1 to presnt the filenames. What do you mean, "by default uses UTF-8"? Chrome uses whatever it's told. In this case, you have no encoding specified in the page, and your HTTP headers include: Content-Type:text/html;charset=ISO-8859-1 I wonder what effect that'll have... I wonder. Quit blaming Chrome for what's not its fault. (There's enough that is, but that's true of every browser.) ChrisA From nobody at nowhere.com Tue Jun 4 03:39:08 2013 From: nobody at nowhere.com (Nobody) Date: Tue, 04 Jun 2013 08:39:08 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Mon, 03 Jun 2013 23:28:21 -0700, nagia.retsina wrote: > I can't believe Chrome whcih by default uses utf8 chosed iso-8859-1 to > presnt the filenames. Chrome didn't choose ISO-8859-1, the server did; the HTTP response says: Content-Type: text/html;charset=ISO-8859-1 From nikos.gr33k at gmail.com Tue Jun 4 03:58:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 00:58:42 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: ?? ?????, 4 ??????? 2013 10:39:08 ?.?. UTC+3, ? ??????? Nobody ??????: > Chrome didn't choose ISO-8859-1, the server did; the HTTP response says: > Content-Type: text/html;charset=ISO-8859-1 >From where do you see this: i receivf this when trying from terminal: nikos at superhost.gr [~/www/data/apps]# wget -S -O - http://www.superhost.gr --2013-06-04 10:58:05-- http://www.superhost.gr/ Resolving www.superhost.gr... 82.211.30.133 Connecting to www.superhost.gr|82.211.30.133|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Server: ApacheBooster/1.6 Date: Tue, 04 Jun 2013 07:58:05 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding {!r}

'''.format( old_path, new_path ) ) else: print( '''
Renaming {!r} ---> {!r}

'''.format( old_path, new_path ) ) os.rename( old_path, new_path ) sys.exit(0) ------------------------- and the output can be seen here: http://superhost.gr/cgi-bin/files.py We are in test mode so i dont know if when renaming actually take place what the encodings will be. Shall i switch off test mode and try it for real? From python at mrabarnett.plus.com Thu Jun 6 08:50:52 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 06 Jun 2013 13:50:52 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> Message-ID: <51B085AC.2030400@mrabarnett.plus.com> On 06/06/2013 13:04, ???????? ?????? wrote: > First of all thank you for helping me MRAB. > After make some alternation to your code ia have this: > > ---------------------------------------- > # Give the path as a bytestring so that we'll get the filenames as bytestrings > path = b"/home/nikos/public_html/data/apps/" > > # Setting TESTING to True will make it print out what renamings it will do, but not actually do them > TESTING = True > > # Walk through the files. > for root, dirs, files in os.walk( path ): > for filename in files: > try: > # Is this name encoded in UTF-8? > filename.decode('utf-8') > except UnicodeDecodeError: > # Decoding from UTF-8 failed, which means that the name is not valid UTF-8 > # It appears that the filenames are encoded in ISO-8859-7, so decode from that and re-encode to UTF-8 > new_filename = filename.decode('iso-8859-7').encode('utf-8') > > old_path = os.path.join(root, filename) > new_path = os.path.join(root, new_filename) > if TESTING: > print( '''
Will rename {!r} ---> {!r}

'''.format( old_path, new_path ) ) > else: > print( '''
Renaming {!r} ---> {!r}

'''.format( old_path, new_path ) ) > os.rename( old_path, new_path ) > sys.exit(0) > ------------------------- > > and the output can be seen here: http://superhost.gr/cgi-bin/files.py > > We are in test mode so i dont know if when renaming actually take place what the encodings will be. > > Shall i switch off test mode and try it for real? > The first one is '/home/nikos/public_html/data/apps/???? ??? ?????.mp3'. The second one is '/home/nikos/public_html/data/apps/?????? ???? ??????.exe'. These names are currently encoded in ISO-8859-7, but will be encoded in UTF-8 if you turn off test mode. If you're happy for that change to happen, then go ahead. From nikos.gr33k at gmail.com Thu Jun 6 14:13:45 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 11:13:45 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> Message-ID: <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> ?? ??????, 6 ??????? 2013 3:50:52 ?.?. UTC+3, ? ??????? MRAB ??????: > If you're happy for that change to happen, then go ahead. I have made some modifications to the code you provided me but i think something that doesnt accur to me needs fixing. for example i switched: # Give the path as a bytestring so that we'll get the filenames as bytestrings path = b"/home/nikos/public_html/data/apps/" # Walk through the files. for root, dirs, files in os.walk( path ): for filename in files: to: # Give the path as a bytestring so that we'll get the filenames as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for fullpath in path # Grabbing just the filename from path filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) I dont know if it has the same effect: Here is the the whole snippet: ============================================= # Give the path as a bytestring so that we'll get the filenames as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for fullpath in path # Grabbing just the filename from path filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) try: # Is this name encoded in utf-8? filename.decode('utf-8') except UnicodeDecodeError: # Decoding from UTF-8 failed, which means that the name is not valid utf-8 # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 new_filename = filename.decode('iso-8859-7').encode('utf-8') # rename filename form greek bytestream-> utf-8 bytestream old_path = os.path.join(root, filename) new_path = os.path.join(root, new_filename) os.rename( old_path, new_path ) #============================================================ # Compute a set of current fullpaths path = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for fullpath in path: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) data = cur.fetchone() #URL is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (fullpath, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) ================================================================== The error is: [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] File "files.py", line 64 [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] for fullpath in path [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] ^ [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax Doesn't os.listdir( ...) returns a list with all filenames? But then again when replacing take place to shert the fullpath to just the filane i think it doesn't not work because the os.listdir was opened as bytestring and not as a string.... What am i doing wrong? From lele at metapensiero.it Thu Jun 6 15:03:02 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 21:03:02 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> Message-ID: <87sj0v6p09.fsf@nautilus.nautilus> ???????? ?????? writes: > ... > # Load'em > for fullpath in path: > try: > ... > > The error is: > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] File "files.py", line 64 > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] for fullpath in path > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] ^ > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > > > Doesn't os.listdir( ...) returns a list with all filenames? You should *read* and *understand* the error message! This is the same kind of confusion you had when I pointed you at the missing closing bracket some day ago, when you missed the meaning of the error and assume it's source is related to something completely different... In the specific case, your line 64 is missing an ending colon (":"). ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Thu Jun 6 15:17:16 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 12:17:16 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> Message-ID: <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> ?? ??????, 6 ??????? 2013 10:03:02 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > ???????? ?????? writes: > > > > > ... > > > # Load'em > > > for fullpath in path: > > > try: > > > ... > > > > > > The error is: > > > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] File "files.py", line 64 > > > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] for fullpath in path > > > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] ^ > > > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > > > > > > > > > Doesn't os.listdir( ...) returns a list with all filenames? > > > > You should *read* and *understand* the error message! > > > > This is the same kind of confusion you had when I pointed you at the > > missing closing bracket some day ago, when you missed the meaning of the > > error and assume it's source is related to something completely > > different... > > > > In the specific case, your line 64 is missing an ending colon (":"). > > > > ciao, lele. Oh my God, was that simple and i was smashing my head to see where did i made a synatx error. Missed the colon! Well the error shoudl ahve said "Hey man, you missed a colon!", that would help a lot. Now the error afetr fixithg that transformed to: [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] TypeError: expected bytes, bytearray or buffer compatible object but htats becaus eof these lines: # Give the path as a bytestring so that we'll get the filenames as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for fullpath in path: # Grabbing just the filename from path filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) i can remove the bianry openign from os.listdir but then this will not work. MRAB has told me that i need to open those paths and filenames as bytestreams and not as unicode strings. From lele at metapensiero.it Thu Jun 6 16:25:15 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 22:25:15 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> Message-ID: <87k3m76l78.fsf@nautilus.nautilus> ???????? ?????? writes: > Now the error afetr fixithg that transformed to: > > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] TypeError: expected bytes, bytearray or buffer compatible object > > MRAB has told me that i need to open those paths and filenames as bytestreams and not as unicode strings. Yes, that way the function will return a list of bytes instances. Knowing that, consider the following example, that should ring a bell: $ python3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 09:59:04) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> path = b"some/path" >>> path.replace('some', '') Traceback (most recent call last): File "", line 1, in TypeError: expected bytes, bytearray or buffer compatible object >>> path.replace(b'some', b'') b'/path' >>> ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Thu Jun 6 16:39:56 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:39:56 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> Message-ID: ?? ??????, 6 ??????? 2013 11:25:15 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > ???????? ?????? writes: > > > > > Now the error afetr fixithg that transformed to: > > > > > > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) > > > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] TypeError: expected bytes, bytearray or buffer compatible object > > > > > > MRAB has told me that i need to open those paths and filenames as bytestreams and not as unicode strings. > > > > Yes, that way the function will return a list of bytes > > instances. Knowing that, consider the following example, that should > > ring a bell: > > > > $ python3 > > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 09:59:04) > > [GCC 4.7.2] on linux > > Type "help", "copyright", "credits" or "license" for more information. > > >>> path = b"some/path" > > >>> path.replace('some', '') > > Traceback (most recent call last): > > File "", line 1, in > > TypeError: expected bytes, bytearray or buffer compatible object > > >>> path.replace(b'some', b'') > > b'/path' Ah yes, very logical, i should have though of that. Tahnks here is what i have up until now with many corrections. #======================================================== # Get filenames of the apps directory as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for filename in path: # Grabbing just the filename from path try: # Is this name encoded in utf-8? filename.decode('utf-8') except UnicodeDecodeError: # Decoding from UTF-8 failed, which means that the name is not valid utf-8 # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 new_filename = filename.decode('iso-8859-7').encode('utf-8') # rename filename form greek bytestreams --> utf-8 bytestreams old_path = b'/home/nikos/public_html/data/apps/' + b'filename') new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') os.rename( old_path, new_path ) #======================================================== # Get filenames of the apps directory as unicode path = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in path: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() #URL is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== # Empty set that will be filled in with 'path/to/filename' of path dir urls = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in path url = '/home/nikos/public_html/data/apps/' + filename urls.add( url ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's urls against path's urls for url in data: if url not in urls cur.execute('''DELETE FROM files WHERE url = %s''', (url,) ) ================================== I think its ready! But i want to hear from you, before i try it! :) From nikos.gr33k at gmail.com Thu Jun 6 16:56:36 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:56:36 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> Message-ID: <05418431-0881-4271-9683-367070b99ab5@googlegroups.com> Has some errors: #======================================================== # Get filenames of the apps directory as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for filename in path: # Grabbing just the filename from path try: # Is this name encoded in utf-8? filename.decode('utf-8') except UnicodeDecodeError: # Decoding from UTF-8 failed, which means that the name is not valid utf-8 # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 new_filename = filename.decode('iso-8859-7').encode('utf-8') # rename filename form greek bytestreams --> utf-8 bytestreams old_path = b'/home/nikos/public_html/data/apps/' + b'filename') new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') os.rename( old_path, new_path ) #======================================================== # Get filenames of the apps directory as unicode path = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in path: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() #filename is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== path = os.listdir( '/home/nikos/public_html/data/apps/' ) filenames = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in path filenames.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for filename in data: if filename not in filenames cur.execute('''DELETE FROM files WHERE url = %s''', (filename,) ) ------------------------------- The only problem now is the bytestrings: nikos at superhost.gr [~/www/cgi-bin]# [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] File "files.py", line 78 [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] old_path = b'/home/nikos/public_html/data/apps/' + b'filename') [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] ^ [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax Dont know how to add a bytestremed path to a bytestream filename From nikos.gr33k at gmail.com Thu Jun 6 16:59:31 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:59:31 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <05418431-0881-4271-9683-367070b99ab5@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <05418431-0881-4271-9683-367070b99ab5@googlegroups.com> Message-ID: I'm very sorry for continuous pastes. Didnt include the whole thing before. Here it is: #======================================================== # Get filenames of the path dir as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for filename in path: # Grabbing just the filename from path try: # Is this name encoded in utf-8? filename.decode('utf-8') except UnicodeDecodeError: # Decoding from UTF-8 failed, which means that the name is not valid utf-8 # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 new_filename = filename.decode('iso-8859-7').encode('utf-8') # rename filename form greek bytestreams --> utf-8 bytestreams old_path = b'/home/nikos/public_html/data/apps/' + b'filename') new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') os.rename( old_path, new_path ) #======================================================== # Get filenames of the apps directory as unicode path = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in path: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() #filename is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== path = os.listdir( '/home/nikos/public_html/data/apps/' ) filenames = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in path filenames.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for filename in data: if filename not in filenames cur.execute('''DELETE FROM files WHERE url = %s''', (filename,) ) ===================================== Just the bytestream error and then i belive its ready this time. From lele at metapensiero.it Thu Jun 6 17:15:19 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 23:15:19 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <05418431-0881-4271-9683-367070b99ab5@googlegroups.com> Message-ID: <877gi76ivs.fsf@nautilus.nautilus> ???????? ?????? writes: > The only problem now is the bytestrings: *One*, not the *only*. > > nikos at superhost.gr [~/www/cgi-bin]# [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] File "files.py", line 78 > [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] old_path = b'/home/nikos/public_html/data/apps/' + b'filename') > [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] ^ > [Thu Jun 06 23:50:42 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > > > Dont know how to add a bytestremed path to a bytestream filename Come on Niklos, either you learn from what I (and others) try to teach you, or I'm afraid you won't get more hints... this list cannot become your remote editor tool! *Read* the error message, *look* at the arrow (i.e. the caret character "^"), *understand* what that is trying to tell you... ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From steve+comp.lang.python at pearwood.info Thu Jun 6 21:29:18 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 01:29:18 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <05418431-0881-4271-9683-367070b99ab5@googlegroups.com> Message-ID: <51b1376e$0$29966$c3e8da3$5496439d@news.astraweb.com> On Thu, 06 Jun 2013 13:56:36 -0700, ???????? ?????? wrote: > SyntaxError: invalid syntax > > > Dont know how to add a bytestremed path to a bytestream filename Nikos, READ THE ERROR MESSAGE!!! The error doesn't say anything about *adding*. It is a SyntaxError. Please stop flooding us with dozens and dozens of trivial posts asking the same questions over and over again. There are well over 120 posts in this thread, it is impossible for anyone to keep track of it. * Do not send a new post every time you make a small change to the code. * Do not send a new post every time you make a typo and get a SyntaxError. * READ THE ERROR MESSAGES and try to understand them first. * SyntaxError means YOU HAVE MADE A TYPING MISTAKE. * SyntaxError means that your code is not executed at all. Not a single line of code is run. If no code is running, the problem cannot possibly be with "add" or some other operation. If your car will not start, the problem cannot be with the brakes. If your program will not start, the problem cannot be with adding two byte strings. * You can fix syntax errors yourself. READ THE CODE that has the syntax error and LOOK FOR WHAT IS WRONG. Then fix it. * Don't tell us when you have fixed it. Nobody cares. Just fix it. Here is the line of code again: old_path = b'/home/nikos/public_html/data/apps/' + b'filename') There is a syntax error in this line of code. Hint: here are some simple examples of the same syntax error: a = b + c) x = y * z) alist.sort()) assert 1+1 == 2) Can you see the common factor? Each of those lines will give the same syntax error as your line. -- Steven From lele at metapensiero.it Thu Jun 6 17:07:37 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 23:07:37 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> Message-ID: <87bo7j6j8m.fsf@nautilus.nautilus> ???????? ?????? writes: > Tahnks here is what i have up until now with many corrections. I'm afraid many more are needed :-) > ... > # rename filename form greek bytestreams --> utf-8 bytestreams > old_path = b'/home/nikos/public_html/data/apps/' + b'filename') > new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') > os.rename( old_path, new_path ) a) there are two syntax errors, you have spurious close brackets there b) you are basically assigning *constant* expressions to both variables, most probably not what you meant ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From python at mrabarnett.plus.com Thu Jun 6 17:57:42 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 06 Jun 2013 22:57:42 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <87bo7j6j8m.fsf@nautilus.nautilus> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <87bo7j6j8m.fsf@nautilus.nautilus> Message-ID: <51B105D6.4050907@mrabarnett.plus.com> On 06/06/2013 22:07, Lele Gaifax wrote: > ???????? ?????? writes: > >> Tahnks here is what i have up until now with many corrections. > > I'm afraid many more are needed :-) > >> ... >> # rename filename form greek bytestreams --> utf-8 bytestreams >> old_path = b'/home/nikos/public_html/data/apps/' + b'filename') >> new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') >> os.rename( old_path, new_path ) > > a) there are two syntax errors, you have spurious close brackets there > b) you are basically assigning *constant* expressions to both variables, > most probably not what you meant > Yet again, he's changed things unnecessarily, and the code was meant only as a one-time fix to correct the encoding of some filenames. :-( From steve+comp.lang.python at pearwood.info Thu Jun 6 21:25:40 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 01:25:40 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> Message-ID: <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> On Thu, 06 Jun 2013 12:17:16 -0700, ???????? ?????? wrote: > i can remove the bianry openign from os.listdir but then this will not > work. MRAB has told me that i need to open those paths and filenames as > bytestreams and not as unicode strings. Do you understand why? If you do not understand *why* we tell you to do a thing, then you have no understanding and are doing Cargo Cult programming: http://en.wikipedia.org/wiki/Cargo_cult_programming http://en.wikipedia.org/wiki/Cargo_cult MRAB tells you to work with the bytes, because the file names' bytes are invalid when used as UTF-8. If you fix the file names by renaming using a terminal set to UTF-8, then they will be valid and you can forget about working with bytes. Working with bytes is only for when the file names are turned to garbage. Your file names (some of them) are turned to garbage. Fix them, and then use file names as strings. -- Steven From nagia.retsina at gmail.com Fri Jun 7 02:35:33 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Thu, 6 Jun 2013 23:35:33 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> ?? ?????????, 7 ??????? 2013 4:25:40 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > MRAB tells you to work with the bytes, because the filenames' bytes are > invalid decoded as UTF-8. If you fix the file names by renaming using a > terminal set to UTF-8, then they will be valid and you can forget about > working with bytes. Yes, but but 'putty' seems to always forget when i tell it to use utf8 for displaying and always picks up the Win8's default charset and it doesnt have a save options dialog. I cant always remember to switch to utf8 charset or renaming all the time from termnal so many greek filenames. > Working with bytes is only for when the file names are turned to garbage. > Your file names (some of them) are turned to garbage. Fix them, and then > use file names as strings. Can't '~/data/apps/' is filled every day with more and more files which are uploaded via FileZilla client, which i think it behaves pretty much like putty, uploading filenames as greek-iso bytes. So that garbage will happen every day due to 'Putty' & 'FileZilla' clients. So files.py before doing their stuff must do the automatic conversions from greek bytes to utf-8 bytes. Here is what i have up until now. ================================================= # Collect filenames of the path dir as bytes filename_bytes = os.listdir( b'/home/nikos/public_html/data/apps/' ) # Iterate over all filenames in the path dir for filename in filenames_bytes: # Compute 'path/to/filename' in bytes filepath_bytes = b'/home/nikos/public_html/data/apps/' + b'filename' try: filepath = filepath_bytes.decode('utf-8') except UnicodeDecodeError: try: filepath = filepath_bytes.decode('iso-8859-7') # Rename filename from greek bytes => utf-8 bytes os.rename( filepath_bytes filepath.encode('utf-8') ) except UnicodeDecodeError: print "I give up! This filename is unreadable!" ========================================= This is the best i can come up with, but after: nikos at superhost.gr [~/www/cgi-bin]# python files.py File "files.py", line 75 os.rename( filepath_bytes filepath.encode('utf-8') ) ^ SyntaxError: invalid syntax nikos at superhost.gr [~/www/cgi-bin]# ============================================ I am seeign the caret pointing at filepath but i cant follow what it tries to tell me. No parenthesis missed or added this time due to speed and tireness. This rename statement tries to convert the greek byted filepath to utf-8 byted filepath. I can't see whay this is wrong though. From rosuav at gmail.com Fri Jun 7 02:46:53 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 16:46:53 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 4:35 PM, wrote: > Yes, but but 'putty' seems to always forget when i tell it to use utf8 for displaying and always picks up the Win8's default charset and it doesnt have a save options dialog. I cant always remember to switch to utf8 charset or renaming all the time from termnal so many greek filenames. I use PuTTY too (though that'll change when I next upgrade Traal, as I'll no longer have any Windows clients), and it's set to UTF-8 in the Winoow|Translation page. Far as I know, those settings are all saved into the Saved Sessions settings, back on the Session page. ChrisA From lele at metapensiero.it Fri Jun 7 03:09:29 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Fri, 07 Jun 2013 09:09:29 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> Message-ID: <87ehcee6s6.fsf@nautilus.nautilus> nagia.retsina at gmail.com writes: > File "files.py", line 75 > os.rename( filepath_bytes filepath.encode('utf-8') ) > ^ > SyntaxError: invalid syntax > > I am seeign the caret pointing at filepath but i cant follow what it > tries to tell me. As already explained, often a SyntaxError is introduced by *preceeding* "text", so you must look at your code with a "wider eye". > This rename statement tries to convert the greek byted filepath to > utf-8 byted filepath. Yes: and that usually imply that the *function* accepts (at least) *two* arguments, specifically the source and the target names, right? How many arguments are you actually giving to the os.rename() function above? > I can't see whay this is wrong though. Try stronger, I won't be give you further indications to your SyntaxErrors, you *must* learn how to detect and fix those by yourself. ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Fri Jun 7 03:08:38 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 00:08:38 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> Message-ID: <33b6b4e7-ee8a-4bf6-8d31-e58975b4e71b@googlegroups.com> ?? ?????????, 7 ??????? 2013 9:46:53 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Fri, Jun 7, 2013 at 4:35 PM, wrote: > > > Yes, but but 'putty' seems to always forget when i tell it to use utf8 for displaying and always picks up the Win8's default charset and it doesnt have a save options dialog. I cant always remember to switch to utf8 charset or renaming all the time from termnal so many greek filenames. > > > > > > I use PuTTY too (though that'll change when I next upgrade Traal, as > > I'll no longer have any Windows clients), and it's set to UTF-8 in the > > Winoow|Translation page. Far as I know, those settings are all saved > > into the Saved Sessions settings, back on the Session page. > > > > ChrisA Session settings afaik is for putty to remember hosts to connect to, not terminal options. I might be worng though. No matter how many times i change its options next time i run it always defaults back. I'll google Traal right now. You should also take o look on 'Secure Shell' extension for Chrome i just found out. Seems a great plugin for Chrome. You'll definately like it, i did! From rosuav at gmail.com Fri Jun 7 03:24:22 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 17:24:22 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <33b6b4e7-ee8a-4bf6-8d31-e58975b4e71b@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <33b6b4e7-ee8a-4bf6-8d31-e58975b4e71b@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 5:08 PM, ???????? ?????? wrote: > I'll google Traal right now. The one thing you're actually willing to go research, and it's actually something that won't help you. Traal is the name of my personal laptop. Spend your Googletrons on something else. :) ChrisA From roel at roelschroeven.net Sat Jun 8 05:19:57 2013 From: roel at roelschroeven.net (Roel Schroeven) Date: Sat, 08 Jun 2013 11:19:57 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <33b6b4e7-ee8a-4bf6-8d31-e58975b4e71b@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <33b6b4e7-ee8a-4bf6-8d31-e58975b4e71b@googlegroups.com> Message-ID: ???????? ?????? schreef: > Session settings afaik is for putty to remember hosts to connect to, > not terminal options. I might be worng though. No matter how many times > i change its options next time i run it always defaults back. Putty can most definitely remember its settings: - Start PuTTY; you should get the "PuTTY Configuration" window - Select a session in the list of sessions - Click Load - Change any setting you want to change - Go back to Session in the Category treeview - Click Save HTH -- "People almost invariably arrive at their beliefs not on the basis of proof but on the basis of what they find attractive." -- Pascal Blaise roel at roelschroeven.net From nikos.gr33k at gmail.com Fri Jun 7 03:32:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 00:32:06 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> Message-ID: <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> ?? ?????????, 7 ??????? 2013 10:09:29 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > As already explained, often a SyntaxError is introduced by *preceeding* > "text", so you must look at your code with a "wider eye". That what i ahte aabout error reporting. You have some syntax error someplace and error reports you another line, so you have to check the whole code again. Well i just did, i see no syntactical errors. > Yes: and that usually imply that the *function* accepts (at least) *two* > arguments, specifically the source and the target names, right? How many > arguments are you actually giving to the os.rename() function above? i'm giving it two. os.rename( filepath_bytes filepath.encode('utf-8') ) 1st = filepath_bytes 2nd = filepath.encode('utf-8') Source and Target respectively. From michael.weylandt at gmail.com Fri Jun 7 03:42:43 2013 From: michael.weylandt at gmail.com (Michael Weylandt) Date: Fri, 7 Jun 2013 08:42:43 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> Message-ID: <5FFE659B-8271-4AF7-9116-96B763972F95@gmail.com> On Jun 7, 2013, at 8:32, ???????? ?????? wrote: > ?? ?????????, 7 ??????? 2013 10:09:29 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > >> As already explained, often a SyntaxError is introduced by *preceeding* >> "text", so you must look at your code with a "wider eye". > > That what i ahte aabout error reporting. You have some syntax error someplace and error reports you another line, so you have to check the whole code again. > Well i just did, i see no syntactical errors. > >> Yes: and that usually imply that the *function* accepts (at least) *two* >> arguments, specifically the source and the target names, right? How many >> arguments are you actually giving to the os.rename() function above? > > i'm giving it two. > os.rename( filepath_bytes filepath.encode('utf-8') Missing comma, which is, after all, just a matter of syntax so it can't matter, right? > > 1st = filepath_bytes > 2nd = filepath.encode('utf-8') > > Source and Target respectively. > -- > http://mail.python.org/mailman/listinfo/python-list From nikos.gr33k at gmail.com Fri Jun 7 04:10:47 2013 From: nikos.gr33k at gmail.com (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Fri, 07 Jun 2013 11:10:47 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <5FFE659B-8271-4AF7-9116-96B763972F95@gmail.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> <5FFE659B-8271-4AF7-9116-96B763972F95@gmail.com> Message-ID: <51B19587.8030801@gmail.com> On 7/6/2013 10:42 ??, Michael Weylandt wrote: > > os.rename( filepath_bytes filepath.encode('utf-8') > Missing comma, which is, after all, just a matter of syntax so it can't matter, right? > I doubted that os.rename arguments must be comma seperated. But ater reading the docs. s.rename(/src/,/dst/) Rename the file or directory/src/to/dst/. If/dst/is a directory,OSError will be raised. On Unix, if/dst/exists and is a file, it will be replaced silently if the user has permission. The operation may fail on some Unix flavors if/src/and/dst/are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). On Windows, if/dst/already exists,OSError will be raised even if it is a file; there may be no way to implement an atomic rename when/dst/names an existing file. Availability: Unix, Windows. Indeed it has to be: os.rename( filepath_bytes, filepath.encode('utf-8') 'mv source target' didn't require commas so i though it was safe to assume that os.rename did not either. I'am happy to announce that after correcting many idiotic error like commas, missing colons and declaring of variables, this surrogate erro si the last i get. I still dont understand what surrogate means. In english means replacement. Here is the code: #======================================================== # Collect filenames of the path dir as bytes filename_bytes = os.listdir( b'/home/nikos/public_html/data/apps/' ) # Iterate over all filenames in the path dir for filename in filename_bytes: # Compute 'path/to/filename' in bytes filepath_bytes = b'/home/nikos/public_html/data/apps/' + b'filename' try: filepath = filepath_bytes.decode('utf-8') except UnicodeDecodeError: try: filepath = filepath_bytes.decode('iso-8859-7') # Rename current filename from greek bytes => utf-8 bytes os.rename( filepath_bytes, filepath.encode('utf-8') ) except UnicodeDecodeError: print( '''I give up! This filename is unreadable! ''') #======================================================== # Get filenames of the apps directory as unicode filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() #filename is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filenames = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filenames.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for filename in data: if filename not in filenames: cur.execute('''DELETE FROM files WHERE url = %s''', (filename,) ) ================================= [Fri Jun 07 11:08:17 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 88, in [Fri Jun 07 11:08:17 2013] [error] [client 79.103.41.173] cur.execute('''SELECT url FROM files WHERE url = %s''', filename ) [Fri Jun 07 11:08:17 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute [Fri Jun 07 11:08:17 2013] [error] [client 79.103.41.173] query = query.encode(charset) [Fri Jun 07 11:08:17 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcce' in position 35: surrogates not allowed -- Webhost && Weblog -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.weylandt at gmail.com Fri Jun 7 04:52:47 2013 From: michael.weylandt at gmail.com (R. Michael Weylandt) Date: Fri, 7 Jun 2013 09:52:47 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51B19587.8030801@gmail.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> <5FFE659B-8271-4AF7-9116-96B763972F95@gmail.com> <51B19587.8030801@gmail.com> Message-ID: On Fri, Jun 7, 2013 at 9:10 AM, ???????? ?????? wrote: > On 7/6/2013 10:42 ??, Michael Weylandt wrote: > >>> os.rename( filepath_bytes filepath.encode('utf-8') > >> Missing comma, which is, after all, just a matter of syntax so it can't >> matter, right? > > I doubted that os.rename arguments must be comma seperated. All function calls in Python require commas if you are putting in more than one argument. [0] > But ater reading the docs. > > s.rename(src, dst) > > Rename the file or directory src to dst. If dst is a directory, OSError will > be raised. On Unix, if dst exists and is a file, it will be replaced > silently if the user has permission. The operation may fail on some Unix > flavors if src and dst are on different filesystems. If successful, the > renaming will be an atomic operation (this is a POSIX requirement). On > Windows, if dst already exists, OSError will be raised even if it is a file; > there may be no way to implement an atomic rename when dst names an existing > file. > > Availability: Unix, Windows. > > Indeed it has to be: > > os.rename( filepath_bytes, filepath.encode('utf-8') Parenthesis missing here as well. > > 'mv source target' didn't require commas so i though it was safe to assume > that os.rename did not either. > That's for shell programming -- different language entirely. The surrogate business is back to Unicode, which ain't my specialty so I'll leave that to more able programmers. MW [0] You could pass multiple arguments by way of a tuple or dictionary using */** but if you want arguments that aren't in the container being passed, you're back to needing commas. From cs at zip.com.au Fri Jun 7 04:56:26 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 7 Jun 2013 18:56:26 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51B19587.8030801@gmail.com> References: <51B19587.8030801@gmail.com> Message-ID: <20130607085626.GA32754@cskk.homeip.net> On 07Jun2013 11:10, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | On 7/6/2013 10:42 ??, Michael Weylandt wrote: | >os.rename( filepath_bytes filepath.encode('utf-8') | >Missing comma, which is, after all, just a matter of syntax so it can't matter, right? | | I doubted that os.rename arguments must be comma seperated. Why? Every other python function separates arguments with commas. | 'mv source target' didn't require commas so i though it was safe to assume that os.rename did not either. "mv" is shell syntax. os.rename is Python syntax. Two totally separate languages. -- Cameron Simpson Cynic, n. A blackguard whose faulty vision sees things as they are, not as they ought to be. Ambrose Bierce (1842-1914), U.S. author. The Devil's Dictionary (1881-1906). From steve+comp.lang.python at pearwood.info Sat Jun 8 03:57:05 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 08 Jun 2013 07:57:05 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> Message-ID: <51b2e3d0$0$29966$c3e8da3$5496439d@news.astraweb.com> On Thu, 06 Jun 2013 23:35:33 -0700, nagia.retsina wrote: >> Working with bytes is only for when the file names are turned to >> garbage. Your file names (some of them) are turned to garbage. Fix >> them, and then use file names as strings. > > Can't '~/data/apps/' is filled every day with more and more files which > are uploaded via FileZilla client, which i think it behaves pretty much > like putty, uploading filenames as greek-iso bytes. Well, that is certainly a nuisance. Try something like this: # Untested. dir = b'/home/nikos/public_html/data/apps/' # This must be bytes. files = os.listdir(dir) for name in files: pathname_as_bytes = dir + name for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): try: pathname = pathname_as_bytes.decode(encoding) except UnicodeDecodeError: continue # Rename to something valid in UTF-8. if encoding != 'utf-8': os.rename(pathname_as_bytes, pathname.encode('utf-8')) assert os.path.exists(pathname) break else: # This only runs if we never reached the break. raise ValueError('unable to clean filename %r'%pathname_as_bytes) -- Steven From rustompmody at gmail.com Thu Jun 6 23:13:48 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 20:13:48 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> Message-ID: <2d975e67-fe9b-44e0-86d1-c7790fba1af7@s2g2000pbz.googlegroups.com> On Jun 7, 12:03?am, Lele Gaifax wrote: > You should *read* and *understand* the error message! When you *shout* at the deaf, the non-deaf get deaf . From python at mrabarnett.plus.com Thu Jun 6 15:42:25 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 06 Jun 2013 20:42:25 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> Message-ID: <51B0E621.5000206@mrabarnett.plus.com> An HTML attachment was scrubbed... URL: From nikos.gr33k at gmail.com Thu Jun 6 16:05:29 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:05:29 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> Message-ID: <99bfe749-a9fc-4b89-add9-70400b0c1e9a@googlegroups.com> ?? ??????, 6 ??????? 2013 10:42:25 ?.?. UTC+3, ? ??????? MRAB ??????: > On 06/06/2013 19:13, ???????????????????????? ?????????????????? > wrote: > > > > ?????? ??????????????????, 6 ????????????????????? 2013 3:50:52 ???.???. UTC+3, ??? ????????????????????? MRAB ??????????????????: > > > If you're happy for that change to happen, then go ahead. > > I have made some modifications to the code you provided me but i think something that doesnt accur to me needs fixing. > > > for example i switched: > > # Give the path as a bytestring so that we'll get the filenames as bytestrings > path = b"/home/nikos/public_html/data/apps/" > > # Walk through the files. > for root, dirs, files in os.walk( path ): > for filename in files: > > to: > > # Give the path as a bytestring so that we'll get the filenames as bytestrings > path = os.listdir( b'/home/nikos/public_html/data/apps/' ) > > > os.listdir returns a list of the names of the objects in the given > directory. > > > > > # iterate over all filenames in the apps directory > > > Exactly, all the names. > > > > > for fullpath in path > # Grabbing just the filename from path > > > The name is a bytestring. Note, name, NOT full path. > > > > The following line will fail because the name is a bytestring, > and you can't mix bytestrings with Unicode strings: > > > filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) > > ??? ??? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ^ bytestring????????? > ????????????????????????????????? ^ Unicode string?????????????????????????????? ??? > ????????????????????????????????????????????????????????????????????????????????????????????????????????? ^ Unicode string > > > I dont know if it has the same effect: > Here is the the whole snippet: > > > ============================================= > # Give the path as a bytestring so that we'll get the filenames as bytestrings > path = os.listdir( b'/home/nikos/public_html/data/apps/' ) > > # iterate over all filenames in the apps directory > for fullpath in path > # Grabbing just the filename from path > filename = fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) > try: > # Is this name encoded in utf-8? > filename.decode('utf-8') > except UnicodeDecodeError: > # Decoding from UTF-8 failed, which means that the name is not valid utf-8 > > # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 > new_filename = filename.decode('iso-8859-7').encode('utf-8') > > # rename filename form greek bytestream-> utf-8 bytestream > old_path = os.path.join(root, filename) > new_path = os.path.join(root, new_filename) > os.rename( old_path, new_path ) > > > #============================================================ > # Compute a set of current fullpaths > path = os.listdir( '/home/nikos/public_html/data/apps/' ) > > # Load'em > for fullpath in path: > try: > # Check the presence of a file against the database and insert if it doesn't exist > cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) > data = cur.fetchone() #URL is unique, so should only be one > > if not data: > # First time for file; primary key is automatic, hit is defaulted > cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (fullpath, host, lastvisit) ) > except pymysql.ProgrammingError as e: > print( repr(e) ) > ================================================================== > > The error is: > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] File "files.py", line 64 > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] for fullpath in path > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] ^ > [Thu Jun 06 21:10:23 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > > > Doesn't os.listdir( ...) returns a list with all filenames? > > But then again when replacing take place to shert the fullpath to just the filane i think it doesn't not work because the os.listdir was opened as bytestring and not as a string.... > > What am i doing wrong? > > > You're changing things without checking what they do! Ah yes, it retruens filenames, not path/to/filenames #======================================================== # Give the path as a bytestring so that we'll get the filenames as bytestrings path = os.listdir( b'/home/nikos/public_html/data/apps/' ) # iterate over all filenames in the apps directory for filename in path: # Grabbing just the filename from path try: # Is this name encoded in utf-8? filename.decode('utf-8') except UnicodeDecodeError: # Decoding from UTF-8 failed, which means that the name is not valid utf-8 # It appears that this filename is encoded in greek-iso, so decode from that and re-encode to utf-8 new_filename = filename.decode('iso-8859-7').encode('utf-8') # rename filename form greek bytestream-> utf-8 bytestream old_path = os.path.join(root, filename) new_path = os.path.join(root, new_filename) os.rename( old_path, new_path ) #======================================================== # Compute a set of current fullpaths path = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in path: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() #URL is unique, so should only be one if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() for fullpath in data: if fullpath not in "What should be written here in place of ditched set" cur.execute('''DELETE FROM files WHERE url = %s''', (fullpath,) ) ============================= a) Is it correct that the first time i open os.listdir() as binary to grab the fileenames as bytestring and the 2nd normally to grab the filanems as unicode strings? b) My spurious procedure is messed up now that i ditch the set fullpaths() From nikos.gr33k at gmail.com Thu Jun 6 16:21:12 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:21:12 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <99bfe749-a9fc-4b89-add9-70400b0c1e9a@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <99bfe749-a9fc-4b89-add9-70400b0c1e9a@googlegroups.com> Message-ID: <181b4472-c233-45b5-b93f-cf805862128f@googlegroups.com> Actually about the Spurious procedure iam happy with myelf that came up with this: # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() for filename in path url = '/home/nikos/public_html/data/apps/' + filename urls.add( url ) for url in data: if url not in urls cur.execute('''DELETE FROM files WHERE url = %s''', (url,) ) Ddint try it yet though, need to anwer previous post's a) Is it correct that the first time i open os.listdir() as binary to grab the fileenames as bytestring and the 2nd normally to grab the filanems as unicode strings? From cs at zip.com.au Thu Jun 6 19:08:28 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 7 Jun 2013 09:08:28 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> References: <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> Message-ID: <20130606230828.GA17982@cskk.homeip.net> On 06Jun2013 05:04, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | We are in test mode so i dont know if when renaming actually take place what the encodings will be. | Shall i switch off test mode and try it for real? I would make a copy. Since you're renaming stuff, hard links would do: cp -rpl original-dir test-dir Then test stuff in test-dir. -- Cameron Simpson Too much of a good thing is never enough. - Luba From cs at zip.com.au Thu Jun 6 06:24:16 2013 From: cs at zip.com.au (Cameron Simpson) Date: Thu, 6 Jun 2013 20:24:16 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> References: <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> Message-ID: <20130606102416.GA66528@cskk.homeip.net> On 05Jun2013 11:43, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ???????, 5 ??????? 2013 9:32:15 ?.?. UTC+3, ? ??????? MRAB ??????: | > Using Python, I think you could get the filenames using os.listdir, | > passing the directory name as a bytestring so that it'll return the | > names as bytestrings. | | > Then, for each name, you could decode from its current encoding and | > encode to UTF-8 and rename the file, passing the old and new paths to | > os.rename as bytestrings. | | Iam not sure i follow: | | Change this: | | # Compute a set of current fullpaths | fullpaths = set() | path = "/home/nikos/public_html/data/apps/" | | for root, dirs, files in os.walk(path): [...] Have a read of this: http://docs.python.org/3/library/os.html#os.listdir The UNIX API accepts bytes for filenames and paths. Python 3 strs are sequences of Unicode code points. If you try to open a file or directory on a UNIX system using a Python str, that string must be converted to a sequence of bytes before being handed to the OS. This is done implicitly using your locale settings if you just use a str. However, if you pass a bytes to open or listdir, this conversion does not take place. You put bytes in and in the case of listdir you get bytes out. You can work on pathnames in bytes and never concern yourself with encode/decode at all. In this way you can write code that does not care about the translation between Unicode and some arbitrary byte encoding. Of course, the issue will still arise when accepting user input; your shell has done exactly this kind of thing when you renamed your MP3 file. But it is possible to write pure utility code that doesn't care about filenames as Unicode or str if you work purely in bytes. Regarding user filenames, the common policy these days is to use utf-8 throughout. Of course you need to get everything into that regime to start with. -- Cameron Simpson ...but C++ gloggles the cheesewad, thus causing a type conflict. - David Jevans, jevans at apple.com From nikos.gr33k at gmail.com Thu Jun 6 07:16:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 04:16:44 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> Message-ID: <36673128-ddbc-472c-8377-0c279afdc4eb@googlegroups.com> ?? ??????, 6 ??????? 2013 1:24:16 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 05Jun2013 11:43, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | ?? ???????, 5 ??????? 2013 9:32:15 ?.?. UTC+3, ? ??????? MRAB ??????: > > | > Using Python, I think you could get the filenames using os.listdir, > > | > passing the directory name as a bytestring so that it'll return the > > | > names as bytestrings. > > | > > | > Then, for each name, you could decode from its current encoding and > > | > encode to UTF-8 and rename the file, passing the old and new paths to > > | > os.rename as bytestrings. > > | > > | Iam not sure i follow: > > | > > | Change this: > > | > > | # Compute a set of current fullpaths > > | fullpaths = set() > > | path = "/home/nikos/public_html/data/apps/" > > | > > | for root, dirs, files in os.walk(path): > > [...] > > > > Have a read of this: > > > > http://docs.python.org/3/library/os.html#os.listdir > > > > The UNIX API accepts bytes for filenames and paths. > > > > Python 3 strs are sequences of Unicode code points. If you try to > > open a file or directory on a UNIX system using a Python str, that > > string must be converted to a sequence of bytes before being handed > > to the OS. > > > > This is done implicitly using your locale settings if you just use a str. > > > > However, if you pass a bytes to open or listdir, this conversion > > does not take place. You put bytes in and in the case of listdir > > you get bytes out. > > > > You can work on pathnames in bytes and never concern yourself with > > encode/decode at all. > > > > In this way you can write code that does not care about the translation > > between Unicode and some arbitrary byte encoding. > > > > Of course, the issue will still arise when accepting user input; > > your shell has done exactly this kind of thing when you renamed > > your MP3 file. But it is possible to write pure utility code that > > doesn't care about filenames as Unicode or str if you work purely > > in bytes. > > Regarding user filenames, the common policy these days is to use > > utf-8 throughout. Of course you need to get everything into that > > regime to start with ?? ??????, 6 ??????? 2013 1:24:16 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 05Jun2013 11:43, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | ?? ???????, 5 ??????? 2013 9:32:15 ?.?. UTC+3, ? ??????? MRAB ??????: > > | > Using Python, I think you could get the filenames using os.listdir, > > | > passing the directory name as a bytestring so that it'll return the > > | > names as bytestrings. > > | > > | > Then, for each name, you could decode from its current encoding and > > | > encode to UTF-8 and rename the file, passing the old and new paths to > > | > os.rename as bytestrings. > > | > > | Iam not sure i follow: > > | > > | Change this: > > | > > | # Compute a set of current fullpaths > > | fullpaths = set() > > | path = "/home/nikos/public_html/data/apps/" > > | > > | for root, dirs, files in os.walk(path): > > [...] > > > > Have a read of this: > > > > http://docs.python.org/3/library/os.html#os.listdir > > > > The UNIX API accepts bytes for filenames and paths. > > > > Python 3 strs are sequences of Unicode code points. If you try to > > open a file or directory on a UNIX system using a Python str, that > > string must be converted to a sequence of bytes before being handed > > to the OS. > > > > This is done implicitly using your locale settings if you just use a str. > > > > However, if you pass a bytes to open or listdir, this conversion > > does not take place. You put bytes in and in the case of listdir > > you get bytes out. > > > > You can work on pathnames in bytes and never concern yourself with > > encode/decode at all. > > > > In this way you can write code that does not care about the translation > > between Unicode and some arbitrary byte encoding. > > > > Of course, the issue will still arise when accepting user input; > > your shell has done exactly this kind of thing when you renamed > > your MP3 file. But it is possible to write pure utility code that > > doesn't care about filenames as Unicode or str if you work purely > > in bytes. > > > > Regarding user filenames, the common policy these days is to use > > utf-8 throughout. Of course you need to get everything into that > > regime to start with. So i i nee to use os.listdir() to grab those filenames into bytes. okey. So by changing this to: fullpaths = set() path = "/home/nikos/public_html/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) # Compute a set of current fullpaths fullpaths = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for fullpath in fullpaths: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) data = cur.fetchone() #URL is unique, so should only be one ----------------------------- [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] Original exception was: [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] Traceback (most recent call last): [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] File "files.py", line 67, in [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] query = query.encode(charset) [Thu Jun 06 14:15:38 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcc5' in position 35: surrogates not allowed From wxjmfauth at gmail.com Thu Jun 6 01:54:46 2013 From: wxjmfauth at gmail.com (jmfauth) Date: Wed, 5 Jun 2013 22:54:46 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> Message-ID: <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> On 5 juin, 19:43, ???????? ?????? wrote: > ?? ???????, 5 ??????? 2013 8:56:36 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > > Somehow, I don't know how because I didn't see it happen, you have one or > more files in that directory where the file name as bytes is invalid when > decoded as UTF-8, but your system is set to use UTF-8. So to fix this you > need to rename the file using some tool that doesn't care quite so much > about encodings. Use the bash command line to rename each file in turn > until the problem goes away. > > But renaming ia hsell access like 'mv 'Euxi tou Ihsou.mp3' '???? ??? ?????.mp3' leade to that unknown encoding of this bytestream '\305\365\367\336\ \364\357\365\ \311\347\363\357\375.mp3' > > But please tell me Steven what linux tool you think it can encode the weird filename to proper '???? ??? ?????.mp3' utf-8? > > or we cna write a script as i suggested to decode back the bytestream using all sorts of available decode charsets boiling down to the original greek letters. --------------- see http://bugs.python.org/issue13643, msg msg149949 - (view) Author: Antoine Pitrou (pitrou) Quote: So, you're complaining about something which works, kind of: $ touch h?h? $ LANG=C python3 -c "import os; print(os.listdir())" ['h\udcc3\udca9h\udcc3\udca9'] > This makes robustly working with non-ascii filenames on different > platforms needlessly annoying, given no modern nix should have problems > just using UTF-8 in these cases. So why don't these supposedly "modern" systems at least set the appropriate environment variables for Python to infer the proper character encoding? (since these "modern" systems don't have a well-defined encoding...) Answer: because they are not modern at all, they are antiquated, inadapted and obsolete pieces of software designed and written by clueless Anglo-American people. Please report bugs against these systems. The culprit is not Python, it's the Unix crap and the utterly clueless attitude of its maintainers ("filesystems are just bytes", yeah, whatever...). jmf From rosuav at gmail.com Thu Jun 6 02:11:30 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 16:11:30 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 3:54 PM, jmfauth wrote: > ("filesystems are just bytes", > yeah, whatever...). Sure. You tell me what a proper Unicode rendition of an animated GIF is. ChrisA From breamoreboy at yahoo.co.uk Thu Jun 6 04:53:15 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Thu, 06 Jun 2013 09:53:15 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> Message-ID: On 06/06/2013 07:11, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 3:54 PM, jmfauth wrote: >> ("filesystems are just bytes", >> yeah, whatever...). > > Sure. You tell me what a proper Unicode rendition of an animated GIF is. > > ChrisA > It's obviously one that doesn't use the flawed Python Flexible String Representation :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From nikos.gr33k at gmail.com Thu Jun 6 02:38:37 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 23:38:37 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <8e16c3b0-5d71-4857-971d-2e15dc575e43@j7g2000vbj.googlegroups.com> Message-ID: <35d6c1ae-13dd-4da9-9fbb-248d6afff0f0@googlegroups.com> Yes this is a linxu issue although locale is se to utf-8 root at nikos [~]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= root at nikos [~]# Since 'locale' is set to 'utf-8' why when i: 'mv 'Euxi tou Ihsou.mp3' '???? ??? ?????.mp3' lead to that unknown encoded bytestream '\305\365\367\336\\364\357\365\311\347\363\357\375.mp3' which isn't by default an utf-8 bytestream as locale indicated and python expected? how 'files.py' is supposed to read this file now using: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/public_html/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) ???? From lele at metapensiero.it Tue Jun 4 14:18:29 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Tue, 04 Jun 2013 20:18:29 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> Message-ID: <87r4ghhh8q.fsf@nautilus.nautilus> ???????? ?????? writes: > root at nikos [~]# [Tue Jun 04 19:50:16 2013] [error] [client 46.12.95.59] File "files.py", line 72 > [Tue Jun 04 19:50:16 2013] [error] [client 46.12.95.59] data = cur.fetchone() #URL is unique, so should only be one > [Tue Jun 04 19:50:16 2013] [error] [client 46.12.95.59] ^ > [Tue Jun 04 19:50:16 2013] [error] [client 46.12.95.59] SyntaxError: invalid syntax Some kind soul already said you the reason. What follows is the longest way I could think to spot your error: >>> from collections import Counter >>> stmt = "cur.execute('''SELECT url FROM files WHERE url = %s''', ( fullpath, )" >>> chars_count = Counter(stmt) >>> print("Number of '(': %d" % chars_count['(']) >>> print("Number of ')': %d" % chars_count[')']) Number of '(': 2 Number of ')': 1 ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Tue Jun 4 14:33:26 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 11:33:26 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> Message-ID: ?? ?????, 4 ??????? 2013 9:18:29 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > ???????? ?????? writes: > >>> from collections import Counter > >>> stmt = "cur.execute('''SELECT url FROM files WHERE url = %s''', ( fullpath, )" > >>> chars_count = Counter(stmt) > >>> print("Number of '(': %d" % chars_count['(']) > >>> print("Number of ')': %d" % chars_count[')']) > Number of '(': 2 > Number of ')': 1 Hello Lele, you have proven helpfull many times lets hope once more: # Compute a set of current fullpaths fullpaths = set() path = "/home/nikos/www/data/apps/" for root, dirs, files in os.walk(path): for fullpath in files: fullpaths.add( os.path.join(root, fullpath) ) stmt = "cur.execute('''SELECT url FROM files WHERE url = %s''', ( fullpath, )" chars_count = Counter(stmt) print("Number of '(': %d" % chars_count['(']) print("Number of ')': %d" % chars_count[')']) sys.exit(0) outputs this: http://superhost.gr/cgi-bin/files.py I dont even understand what that means though. From lele at metapensiero.it Tue Jun 4 15:31:20 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Tue, 04 Jun 2013 21:31:20 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> Message-ID: <87mwr5hdvb.fsf@nautilus.nautilus> ???????? ?????? writes: > ?? ?????, 4 ??????? 2013 9:18:29 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: >> ???????? ?????? writes: > >> >>> from collections import Counter >> >>> stmt = "cur.execute('''SELECT url FROM files WHERE url = %s''', ( fullpath, )" >> >>> chars_count = Counter(stmt) >> >>> print("Number of '(': %d" % chars_count['(']) >> >>> print("Number of ')': %d" % chars_count[')']) >> Number of '(': 2 >> Number of ')': 1 > > > Hello Lele, you have proven helpfull many times lets hope once more: With due respect, you need to *improve* your ability to *understand* what people answer to your questions, otherwise it is a double (at a minimum) waste of time. The code above was my (failed) attempt to focus your attention on why one of your scripts raised a SyntaxError: translating that code in plain english, that line (the "stmt" variable above) contains *two* open brackets, and *one* close bracket. ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Tue Jun 4 23:40:13 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 20:40:13 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> Message-ID: <9deeabde-bc00-400d-b11a-9cedfcba961d@googlegroups.com> ?? ?????, 4 ??????? 2013 10:31:20 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > The code above was my (failed) attempt to focus your attention on why > one of your scripts raised a SyntaxError: translating that code in plain > english, that line (the "stmt" variable above) contains *two* open > brackets, and *one* close bracket. Lele, iam sorry fot that these days i do nothing, all day long but try to solve 2 issues, one of it being fils.py which this encoding issues. i missed the parentheses because i was tired. Just added it. I believe that in order to be able to solve this i have to a) Find out the actual encoding of my greek filenames are into, after the rename took place from english to greek chars at the CentOS. How can i check that b) Findind out (a) will help tell python to decode 'fullpath' from the weird unknown yet to be discovered encoded bytestream to 'utf-8' like: cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath.decode('weird_bytestream') ) ) Is this the right aproach? I went to sleep yesterday and my mind was still bothered with this encoding problem i'm dealing with. From nikos.gr33k at gmail.com Tue Jun 4 04:05:11 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 01:05:11 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: <242a4dd5-c23f-46c4-8312-737cf7ad7c11@googlegroups.com> ?? ?????, 4 ??????? 2013 10:35:31 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > > I can't believe Chrome which by default uses 'utf-8' choosed 'iso-8859-1' to present the filenames. > What do you mean, "by default uses UTF-8"? Chrome uses whatever it's > told. In this case, you have no encoding specified in the page, and > your HTTP headers include: > Content-Type:text/html;charset=ISO-8859-1 >From where do you see this Chris? I have an encoding specified in every cgi script i use by stating this command: print( '''Content-type: text/html; charset=utf-8\n''' ) ( That is a browser directive to display python script's output using 'utf-8' charset, that is why i wonder where you Nobody see greek-iso) and also i'm using this: sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) (not sure what exactly it does though, but if i remove it from my cgi scipts no python3 script runs, they are all die prematurely) From steve+comp.lang.python at pearwood.info Tue Jun 4 04:47:01 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 08:47:01 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51ada984$0$11118$c3e8da3@news.astraweb.com> On Mon, 03 Jun 2013 23:28:21 -0700, nagia.retsina wrote: > nikos at superhost.gr [~]# locale > LANG=en_US.UTF-8 [...] Okay, this is good. This means that your system is currently using UTF-8. > Hese is also how the terminal presents my filenames. [...] > nikos at superhost.gr [~]# ls -l www/data/apps/ total 368548 > v2.4.msi -rw-r--r-- 1 nikos nikos 3511233 Jun 3 12:07 ?? ???\ ? > ???.mp3 Weirder and weirder. Please run these commands, and show what result they give: alias ls printf %q\\n *.mp3 ls -b *.mp3 > I'll try renaming it via terminal too. f you want to see soemhtign else > please ask me to show you Steven. If all else fails, you could just rename the troublesome file and hopefully the problem will go away: mv *?.mp3 1.mp3 mv 1.mp3 E??? ??? ?????.mp3 -- Steven From nikos.gr33k at gmail.com Tue Jun 4 05:00:43 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 02:00:43 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51ada984$0$11118$c3e8da3@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <51ada984$0$11118$c3e8da3@news.astraweb.com> Message-ID: ?? ?????, 4 ??????? 2013 11:47:01 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > Please run these commands, and show what result they give: nikos at superhost.gr [~/www/data/apps]# ls -l *.mp3 -rw-r--r-- 1 nikos nikos 3511233 Jun 3 12:07 \305\365\367\336\ \364\357\365\ \311\347\363\357\375\375.mp3 -rw-r--r-- 1 nikos nikos 3511233 Jun 4 11:54 ?? ???\ ? ???.mp3 nikos at superhost.gr [~/www/data/apps]# alias ls alias ls='/bin/ls $LS_OPTIONS' nikos at superhost.gr [~/www/data/apps]# printf %q\n\n *.mp3 $'\305\365\367\336 \364\357\365 \311\347\363\357\375\375.mp3'nn$'\316\225\317\205\317\207\316\256 \317\204\316\277\317\205 \316\231\316\267\317\203\316\277\317\215.mp3'nnnikos at superhost.gr [~/www/data/apps]# ls -b *.mp3 \305\365\367\336\ \364\357\365\ \311\347\363\357\375\375.mp3 ?? ???\ ? ???.mp3 please explain what this comamnd does. I deliberately placed the same .mp3 file twice. The first is after renaming it to greek chars and uploaded from within my Win8 machine via FileZilla to the webhost server The latter after renaming the file from within the remote linux machine. Seems that the way the system used to actually rename the file matters. > If all else fails, you could just rename the troublesome file and > hopefully the problem will go away: > mv *?.mp3 1.mp3 > mv 1.mp3 E??? ??? ?????.mp3 Yes, but why you are doing it it 2 steps and not as: mv *?.mp3 'E??? ??? ?????.mp3' From steve+comp.lang.python at pearwood.info Thu Jun 6 08:44:52 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 12:44:52 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <51ada984$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51b08444$0$29966$c3e8da3$5496439d@news.astraweb.com> On Tue, 04 Jun 2013 02:00:43 -0700, ???????? ?????? wrote: > ?? ?????, 4 ??????? 2013 11:47:01 ?.?. UTC+3, ? ??????? Steven D'Aprano > ??????: > >> Please run these commands, and show what result they give: [...] > nikos at superhost.gr [~/www/data/apps]# alias ls > alias ls='/bin/ls $LS_OPTIONS' And what does echo $LS_OPTIONS give? [...] > Seems that the way the system used to actually rename the file matters. Yes. This is where you get interactions between different systems that use different encodings, and they don't work well together. Some day, everything will use UTF-8, and these problems will go away. >> If all else fails, you could just rename the troublesome file and >> hopefully the problem will go away: >> mv *?.mp3 1.mp3 >> mv 1.mp3 E??? ??? ?????.mp3 > > Yes, but why you are doing it it 2 steps and not as: > > mv *?.mp3 'E??? ??? ?????.mp3' I don't remember. I had a reason that made sense at the time, but I can't remember what it was. I think I can reproduce your problem. If I open a terminal, set to use UTF-8, I can do this: [steve at ando ~]$ cd /tmp [steve at ando tmp]$ touch '999-E???-???-?????' [steve at ando tmp]$ ls 999* 999-E???-???-????? Now if I change the terminal to use Greek ISO-8859-7, and hit UP-ARROW to grab the previous command line from history, the *displayed* file name changes, but the actual file being touched remains the same: [steve at ando tmp]$ touch '999-E????-????-???????' [steve at ando tmp]$ ls 999* 999-E????-????-??????? In Python 3.3, I can demonstrate the same sort of thing: py> s = '999-E???-???-?????' py> bytes_as_utf8 = s.encode('utf-8') py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') py> print(t) 999-E????-????-??????? So that demonstrates part of your problem: even though your Linux system is using UTF-8, your terminal is probably set to ISO-8859-7. The interaction between these will lead to strange and disturbing Unicode errors. To continue, back in the terminal set to ISO-8859-7, if instead of using the history line, if I re-copy and paste the file name: [steve at ando tmp]$ touch '999-E???-???-?????' [steve at ando tmp]$ ls 999* 999-E???-???-????? 999-E????-????-??????? So now I end up with two files, one with a file name that is utter garbage bytes, and one that is only a little better, being mojibake. Resetting the terminal to use UTF-8 at least now restores the *display* of the earlier file's name: [steve at ando tmp]$ ls 999* 999-E???-???-????? 999-E???-???-????? [steve at ando tmp]$ ls -b 999* 999-E\365\367\336-\364\357\365-\311\347\363\357\375 999-E???-???-????? but the other file name is still made of garbage bytes. So I believe I understand how your file name has become garbage. To fix it, make sure that your terminal is set to use UTF-8, and then rename it. Do the same with every file in the directory until the problem goes away. (If one file has garbage bytes in the file name, chances are that more than one do.) -- Steven From nikos.gr33k at gmail.com Thu Jun 6 14:46:20 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 11:46:20 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b08444$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <51ada984$0$11118$c3e8da3@news.astraweb.com> <51b08444$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <92b14633-2c15-477f-93e3-d4a2eac9c76b@googlegroups.com> ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > py> s = '999-E???-???-?????' > py> bytes_as_utf8 = s.encode('utf-8') > py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') > py> print(t) > 999-E????-????-??????? errors='replace' mean dont break in case or error? You took the unicode 's' string you utf-8 bytestringed it. Then how its possible to ask for the utf8-bytestring to decode back to unicode string with the use of a different charset that the one used for encoding and thsi actually printed the filename in greek-iso? > So that demonstrates part of your problem: even though your Linux system > is using UTF-8, your terminal is probably set to ISO-8859-7. The > interaction between these will lead to strange and disturbing Unicode > errors. Yes i feel this is the problem too. Its a wonder to me why putty used by default greek-iso instead of utf-8 !! Please explain this t me because now that i begin to understand this encode/decode things i begin to like them! a) WHAT does it mean when a linux system is set to use utf-8? b) WHAT does it mean when a terminal client is set to use utf-8? c) WHAT happens when the two of them try to work together? > So I believe I understand how your file name has become garbage. To fix > it, make sure that your terminal is set to use UTF-8, and then rename it. > Do the same with every file in the directory until the problem goes away. nikos at superhost.gr [~/www/cgi-bin]# echo $LS_OPTIONS --color=tty -F -a -b -T 0 Is this okey? The '-b' option is for to display a filename in binary mode? Indeed i have changed putty to use 'utf-8' and 'ls -l' now displays the file in correct greek letters. Switching putty's encoding back to 'greek-iso' then the *displayed* filanames shows in mojabike. WHAT is being displayed and what is actually stored as bytes is two different thigns right? ???? ??? ?????.mp3 E????-????-??????? is the way the filaname is displayed in the terminal depending on the encoding the terminal uses, correct? But no matter *how* its being dislayed those two are the same file? From cs at zip.com.au Thu Jun 6 21:01:22 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 7 Jun 2013 11:01:22 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <92b14633-2c15-477f-93e3-d4a2eac9c76b@googlegroups.com> References: <92b14633-2c15-477f-93e3-d4a2eac9c76b@googlegroups.com> Message-ID: <20130607010122.GA91151@cskk.homeip.net> On 06Jun2013 11:46, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: | > py> s = '999-E???-???-?????' | > py> bytes_as_utf8 = s.encode('utf-8') | > py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') | > py> print(t) | > 999-E????-????-??????? | | errors='replace' mean dont break in case or error? Yes. The result will be correct for correct iso-8859-7 and slightly mangled for something that would not decode smoothly. | You took the unicode 's' string you utf-8 bytestringed it. | Then how its possible to ask for the utf8-bytestring to decode | back to unicode string with the use of a different charset that the | one used for encoding and thsi actually printed the filename in | greek-iso? It is easily possible, as shown above. Does it make sense? Normally not, but Steven is demonstrating how your "mv" exercises have behaved: a rename using utf-8, then a _display_ using iso-8859-7. | > So that demonstrates part of your problem: even though your Linux system | > is using UTF-8, your terminal is probably set to ISO-8859-7. The | > interaction between these will lead to strange and disturbing Unicode | > errors. | | Yes i feel this is the problem too. | Its a wonder to me why putty used by default greek-iso instead of utf-8 !! Putty will get its terminal setting from the system you came from. I suppose Windows of some kind. If you look at Putty's settings you may be able to specify UTF-8 explicitly; not sure. If you can, do that. At least there will be one less layer of confusion to debug. | Please explain this t me because now that i begin to understand | this encode/decode things i begin to like them! | | a) WHAT does it mean when a linux system is set to use utf-8? It means the locale settings _for the current process_ are set for UTF-8. The "locale" command will show you the current state. There will also be some system settings with defaults for stuff started up by the system. On CentOS and RedHat that is probably the file: /etc/sysconfig/i18n _However_, when you ssh in to the system using Putty or another ssh client, the settings at your local end are passes to the remote ssh session. In this way different people using different locales can ssh in and get the locales they expect to use. Of course, of the locale settings differ and these people are working on the same files and text, madness will ensue. | b) WHAT does it mean when a terminal client is set to use utf-8? It means the _display_ end of the terminal will render characters using UTF-8. Data comes from the remote system as a sequence of bytes. The terminal receives these bytes and _decodes_ them using utf-8 (or whatever) in order to decides what characters to display. | c) WHAT happens when the two of them try to work together? If everything matches, it is all good. If the locales do not match, the mismatch will result in an undesired bytes<->characters encode/decode step somewhere, and something will display incorrectly or be entered as input incorrectly. | > So I believe I understand how your file name has become garbage. To fix | > it, make sure that your terminal is set to use UTF-8, and then rename it. | > Do the same with every file in the directory until the problem goes away. | | nikos at superhost.gr [~/www/cgi-bin]# echo $LS_OPTIONS | --color=tty -F -a -b -T 0 | | Is this okey? The '-b' option is for to display a filename in binary mode? Probably. "man ls" will tell you. Personally, I "unalias ls" on RedHat systems (and any other system where an alias has been set up). I want ls to do what I say, not what someone else thought was a good idea. | Indeed i have changed putty to use 'utf-8' and 'ls -l' now displays | the file in correct greek letters. Switching putty's encoding back | to 'greek-iso' then the *displayed* filanames shows in mojabike. Exactly so. | WHAT is being displayed and what is actually stored as bytes is two different thigns right? Yes. Display requires the byte stream to be decoded. Wrong decoding display wrong characters/glyphs. | ???? ??? ?????.mp3 | E????-????-??????? | | is the way the filaname is displayed in the terminal depending | on the encoding the terminal uses, correct? But no matter *how* its | being dislayed those two are the same file? In principle, yes. Nothing has changed on the filesystem itself. Cheers, -- Cameron Simpson in rec.moto, jsh wrote: > Dan Nitschke wrote: > > Ged Martin wrote: > > > On Sat, 17 May 1997 16:53:33 +0000, Dan Nitschke scribbled: > > > >(And you stay *out* of my dreams, you deviant little > > > >weirdo.) > > > Yeah, yeah, that's what you're saying in _public_.... > > Feh. You know nothing of my dreams. I dream entirely in text (New Century > > Schoolbook bold oblique 14 point), and never in color. I once dreamed I > > was walking down a flowchart of my own code, and a waterfall of semicolons > > was chasing me. (I hid behind a global variable until they went by.) > You write code in a proportional serif? No wonder you got extra > semicolons falling all over the place. No, I *dream* about writing code in a proportional serif font. It's much more exciting than my real life. /* dan: THE Anti-Ged -- Ignorant Yank (tm) #1, none-%er #7 */ Dan Nitschke peDANtic at best.com nitschke at redbrick.com From nikos.gr33k at gmail.com Fri Jun 7 02:56:42 2013 From: nikos.gr33k at gmail.com (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Fri, 07 Jun 2013 09:56:42 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <20130607010122.GA91151@cskk.homeip.net> References: <92b14633-2c15-477f-93e3-d4a2eac9c76b@googlegroups.com> <20130607010122.GA91151@cskk.homeip.net> Message-ID: <51B1842A.30104@gmail.com> On 7/6/2013 4:01 ??, Cameron Simpson wrote: > On 06Jun2013 11:46, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > | ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > | > py> s = '999-E???-???-?????' > | > py> bytes_as_utf8 = s.encode('utf-8') > | > py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') > | > py> print(t) > | > 999-E????-????-??????? > | > | errors='replace' mean dont break in case or error? > > Yes. The result will be correct for correct iso-8859-7 and slightly mangled > for something that would not decode smoothly. How can it be correct? We have encoded out string in utf-8 and then we tried to decode it as greek-iso? How can this possibly be correct? > > | You took the unicode 's' string you utf-8 bytestringed it. > | Then how its possible to ask for the utf8-bytestring to decode > | back to unicode string with the use of a different charset that the > | one used for encoding and thsi actually printed the filename in > | greek-iso? > > It is easily possible, as shown above. Does it make sense? Normally > not, but Steven is demonstrating how your "mv" exercises have > behaved: a rename using utf-8, then a _display_ using iso-8859-7. Same as above, i don't understand it at all, since different charsets(encodings) used in the encode/decode process. > | > | a) WHAT does it mean when a linux system is set to use utf-8? > > It means the locale settings _for the current process_ are set for > UTF-8. The "locale" command will show you the current state. That means that, when a linux application needs to saved a filename to the linux filesystem, the app checks the filesytem's 'locale', so to encode the filename using the utf-8 charset ? And likewise when a linux application wants to decode a filename is also checking the filesystem's 'locale' setting so to know what charset must use to decode the filename correctly back to the original string? So locale is used for filesystem itself and linux apps to know how to read(decode) and write(enode) filenames from/into the system's hdd? > > > | c) WHAT happens when the two of them try to work together? > > If everything matches, it is all good. If the locales do not match, > the mismatch will result in an undesired bytes<->characters > encode/decode step somewhere, and something will display incorrectly > or be entered as input incorrectly. Cant quite grasp the idea: local end: Win8, locale = greek-iso remote end: CentOS 6.4, locale = utf-8 FileZilla by default uses "do not know what charset" to upload filenames Putty by default uses greek-iso to display filenames WHAT someone can expect to happen when all of the above work together? Mess of course, but i want to hear in detail each step of the mess as it emerges. -- Webhost && Weblog -------------- next part -------------- An HTML attachment was scrubbed... URL: From cs at zip.com.au Fri Jun 7 04:53:04 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 7 Jun 2013 18:53:04 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51B1842A.30104@gmail.com> References: <51B1842A.30104@gmail.com> Message-ID: <20130607085304.GA89830@cskk.homeip.net> On 07Jun2013 09:56, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | On 7/6/2013 4:01 ??, Cameron Simpson wrote: | >On 06Jun2013 11:46, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | >| ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: | >| > py> s = '999-E???-???-?????' | >| > py> bytes_as_utf8 = s.encode('utf-8') | >| > py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') | >| > py> print(t) | >| > 999-E????-????-??????? | >| | >| errors='replace' mean dont break in case or error? | > | >Yes. The result will be correct for correct iso-8859-7 and slightly mangled | >for something that would not decode smoothly. | | How can it be correct? We have encoded out string in utf-8 and then | we tried to decode it as greek-iso? How can this possibly be | correct? Ok, not correct. But consistent. Safe to call. If it is a valid iso-8859-7 sequence (which might cover everything, since I expect it is an 8-bit 1:1 mapping from bytes values to a set of codepoints, just like iso-8859-1) then it may decode to the "wrong" characters, but the reverse process (characters encoded as bytes) should produce the original bytes. With a mapping like this, errors='replace' may mean nothing; there will be no errors because the only Unicode characters in play are all from iso-8859-7 to start with. Of course another string may not be safe. | >| You took the unicode 's' string you utf-8 bytestringed it. | >| Then how its possible to ask for the utf8-bytestring to decode | >| back to unicode string with the use of a different charset that the | >| one used for encoding and thsi actually printed the filename in | >| greek-iso? | > | >It is easily possible, as shown above. Does it make sense? Normally | >not, but Steven is demonstrating how your "mv" exercises have | >behaved: a rename using utf-8, then a _display_ using iso-8859-7. | | Same as above, i don't understand it at all, since different | charsets(encodings) used in the encode/decode process. Visually, the names will be garbage. And if you go: mv '999-E????-????-???????.mp3' '999-E???-???-?????.mp3' while using the iso-8859-7 locale, the wrong thing will occur (assuming it even works, though I think it should because all these characters are represented in iso-8859-7, yes?) Why? In the iso-8859-7 locale, your (currently named under an utf-8 regime) file looks like '999-E????-????-???????.mp3' (because the Unicode byte sequence maps to those characters in iso-8859-7). Why you issue the about "mv" command, the new name will be the _iso-8859-7_ bytes encoding for '999-E???-???-?????.mp3'. Which, under an utf-8 regime will decode to _other_ characters. If you want to repair filenames, by which I mean, cause them to be correctly encoded for utf-8, you are best to work in utf-8 (using "mv" or python). Of course, the badly named files will then look wrong in your listing. If you _know_ the filenames were written using iso-8859-7 encoding, and that the names are "right" under that encoding, you can write python code to rename them to utf-8. Totally untested example code: import sys from binascii import hexlify for bytename in os.listdir( b'.' ): unicode_name = bytename.decode('iso-8859-7') new_bytename = unicode_name.encode('utf-8') print("%s: %s => %s" % (unicode_name, hexlify(bytename), hexlify(new_bytename)), file=sys.stderr) os.rename(bytename, new_bytename) That code should not care what locale you are using because it uses bytes for the file calls and is explicit about the encoding/decoding steps. | >| a) WHAT does it mean when a linux system is set to use utf-8? | > | >It means the locale settings _for the current process_ are set for | >UTF-8. The "locale" command will show you the current state. | | That means that, when a linux application needs to saved a filename | to the linux filesystem, the app checks the filesytem's 'locale', so | to encode the filename using the utf-8 charset ? At the command line, many will not. They'll just read and write bytes. Some will decode/encode. Those that do, should by default use the current locale. But broadly, it is GUI apps that care about this because they must translate byte sequences to glyphs: images of characters. So plenty of command line tools do not need to care; the terminal application is the one that presents the names to you; _it_ will decode them for display. And it is the terminal app that translates your keystrokes into bytes to feed to the command line. NOTE: it is NOT the filesystem's locale. It is the current process' locale, which is deduced from environment variables (which have defaults if they are not set). Under Windows I believe filesystems have locales; this can prevent you storing some files on some filesystems on Windows, because the filesystem doesn't cope. UNIX just takes bytes. | And likewise when a linux application wants to decode a filename is | also checking the filesystem's 'locale' setting so to know what | charset must use to decode the filename correctly back to the | original string? Again, NOT the filesystem's locale. The process' locale. The filesystem filenames are just bytes. | So locale is used for filesystem itself and linux apps to know how | to read(decode) and write(enode) filenames from/into the system's | hdd? NOT THE FILESYSTEM LOCALE. There is no filesystem locale. If you look at: http://docs.python.org/3/library/sys.html#sys.getfilesystemencoding you'll see if does not talk about a property of the filesystem, but the behaviour that will be used when storing filenames. | >| c) WHAT happens when the two of them try to work together? | > | >If everything matches, it is all good. If the locales do not match, | >the mismatch will result in an undesired bytes<->characters | >encode/decode step somewhere, and something will display incorrectly | >or be entered as input incorrectly. | | Cant quite grasp the idea: | | local end: Win8, locale = greek-iso | remote end: CentOS 6.4, locale = utf-8 What makes you think the remote end is utf-8? When you say "locale = utf-8", _exactly_ what does that mean to you? | FileZilla by default uses "do not know what charset" to upload filenames Then at a guess it uploaded the filenames as greek-iso byte sequences. The filenames on disc will be greek-iso byte sequences. | Putty by default uses greek-iso to display filenames Then it will look ok, superficially, I would expect. | WHAT someone can expect to happen when all of the above work together? | Mess of course, but i want to hear in detail each step of the mess | as it emerges. There are several steps, for example: FileZilla will pass filenames to the remote end (FTP, SFTP, maybe) as bytes. What those bytes will be will depend on FileZilla. The UNIX end probably accepts them as-is and uses them directly. So the filenames on disc would probably be greek-iso byte sequences. Running a /bin/ls ("ls" without the alias, with no special options) should present these byte sequences to the Terminal, which will decode them using its locale (greek-iso?) Running a "/bin/ls -b" (using the -b option from the ls alias) will "print octal escapes for nongraphic characters". So "ls" must decide what are nongraphic characters. It does this by decoding the filenames using the _remote_ locale (its own locale). So it will decode the greek-iso byet sequences as though they were utf-8. Anything in the ASCII range (1-127, which will represent the same characters in utf-8, iso-8859-1 or iso-8859-7), the boring Roman alphabet range, will be treated the same. But outside that range the byte sequence will be taken to mean different characters depending on the locale. So "ls -b" will decide some of the greek-iso byte sequences do not represent printable characters, and will decide to print octal. Experiment: LC_ALL=C ls -b LC_ALL=utf-8 ls -b LC_ALL=iso-8859-7 ls -b And the Terminal itself is decoding the output for display, and encoding your input keystrokes to feed as input to the command line. You would be best setting your Windows box to UTF-8, matching how you intend to work on the rmeote UNIX host. I do not know what ramifications that may have for your local efilesystems of text files. Cheers, -- Cameron Simpson Humans are incapable of securely storing high quality cryptographic keys and they have unacceptable speed and accuracy when performing cryptographic operations. (They are also large, expensive to maintain diffcult to manage and they pollute the environment.) It is astonishing that these devices continue to be manufactured and deployed. But they are suffciently pervasive that we must design our protocols around their limitations. - C Kaufman, R Perlman, M Speciner _Network Security: PRIVATE Communication in a PUBLIC World_, Prentice Hall, 1995, pp. 205. From wuwei23 at gmail.com Fri Jun 7 05:41:20 2013 From: wuwei23 at gmail.com (alex23) Date: Fri, 7 Jun 2013 02:41:20 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <51B1842A.30104@gmail.com> Message-ID: On Jun 7, 6:53?pm, Cameron Simpson wrote: > ? Experiment: > > ? ? LC_ALL=C ls -b > ? ? LC_ALL=utf-8 ls -b > ? ? LC_ALL=iso-8859-7 ls -b > > ? And the Terminal itself is decoding the output for display, and > ? encoding your input keystrokes to feed as input to the command > ? line. This reminded me of something I saw on stackoverflow recently: http://stackoverflow.com/questions/11735363/python3-unicodeencodeerror-only-when-run-from-crontab Script would run from shell but not from crontab, as the crontab environment had different locale settings. Solution was to prepend the correct LC_CTYPE to the command in the crontab. Would it be similar for httpd processes? From nikos.gr33k at gmail.com Fri Jun 7 07:53:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 04:53:42 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <51B1842A.30104@gmail.com> Message-ID: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> ?? ?????????, 7 ??????? 2013 11:53:04 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 07Jun2013 09:56, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | On 7/6/2013 4:01 ??, Cameron Simpson wrote: > > | >On 06Jun2013 11:46, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | >| ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > > | >| > py> s = '999-E???-???-?????' > > | >| > py> bytes_as_utf8 = s.encode('utf-8') > > | >| > py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') > > | >| > py> print(t) > > | >| > 999-E????-????-??????? > > | >| > > | >| errors='replace' mean dont break in case or error? > > | > > > | >Yes. The result will be correct for correct iso-8859-7 and slightly mangled > > | >for something that would not decode smoothly. > > | > > | How can it be correct? We have encoded out string in utf-8 and then > > | we tried to decode it as greek-iso? How can this possibly be > > | correct? > If it is a valid iso-8859-7 sequence (which might cover everything, > since I expect it is an 8-bit 1:1 mapping from bytes values to a > set of codepoints, just like iso-8859-1) then it may decode to the > "wrong" characters, but the reverse process (characters encoded as > bytes) should produce the original bytes. With a mapping like this, > errors='replace' may mean nothing; there will be no errors because > the only Unicode characters in play are all from iso-8859-7 to start > with. Of course another string may not be safe. > Visually, the names will be garbage. And if you go: > mv '999-E????-????-???????.mp3' '999-E???-???-?????.mp3' > while using the iso-8859-7 locale, the wrong thing will occur > (assuming it even works, though I think it should because all these > characters are represented in iso-8859-7, yes?) All the rest you i understood only the above quotes its still unclear to me. I cant see to understand it. Do you mean that utf-8, latin-iso, greek-iso and ASCII have the 1st 0-127 codepoints similar? For example char 'a' has the value of '65' for all of those character sets? Is hat what you mean? s = 'a' (This is unicode right? Why when we assign a string to a variable that string's type is always unicode and does not automatically become utf-8 which includes all available world-wide characters? Unicode is something different that a character set? ) utf8_byte = s.encode('utf-8') Now if we are to decode this back to utf8 we will receive the char 'a'. I beleive same thing will happen with latin, greek, ascii isos. Correct? utf8_a = utf8_byte.decode('iso-8859-7') latin_a = utf8_byte.decode('iso-8859-1') ascii_a = utf8_byte.decode('ascii') utf8_a = utf8_byte.decode('iso-8859-7') Is this correct? All of those decodes will work even if the encoded bytestring was of utf8 type? The characters that will not decode correctly are those that their codepoints are greater that > 127 ? for example if s = '?' (greek character equivalent to english 'a') Is this what you mean? -------------------------------- Now back to my almost ready files.py script please: #======================================================== # Collect filenames of the path dir as bytes greek_filenames = os.listdir( b'/home/nikos/public_html/data/apps/' ) for filename in greek_filenames: # Compute 'path/to/filename' in bytes greek_path = b'/home/nikos/public_html/data/apps/' + b'filename' try: filepath = greek_path.decode('iso-8859-7') # Rename current filename from greek bytes --> utf-8 bytes os.rename( greek_path, filepath.encode('utf-8') ) except UnicodeDecodeError: # Since its not a greek bytestring then its a proper utf8 bytestring filepath = greek_path.decode('utf-8') #======================================================== filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', filename ) data = cur.fetchone() if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filepaths = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filepaths.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for rec in data: if rec not in filepaths: cur.execute('''DELETE FROM files WHERE url = %s''', rec ) ======================= nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Error in sys.excepthook: [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] ValueError: underlying buffer has been detached [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Original exception was: [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Traceback (most recent call last): [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 71, in [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] os.rename( greek_path, filepath.encode('utf-8') ) [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] FileNotFoundError: [Errno 2] \\u0394\\u03b5\\u03bd \\u03c5\\u03c0\\u03ac\\u03c1\\u03c7\\u03b5\\u03b9 \\u03c4\\u03ad\\u03c4\\u03bf\\u03b9\\u03bf \\u03b1\\u03c1\\u03c7\\u03b5\\u03af\\u03bf \\u03ae \\u03ba\\u03b1\\u03c4\\u03ac\\u03bb\\u03bf\\u03b3\\u03bf\\u03c2: '/home/nikos/public_html/data/apps/filename' ????? From python at mrabarnett.plus.com Fri Jun 7 10:29:25 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 15:29:25 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: <51B1EE45.9040301@mrabarnett.plus.com> On 07/06/2013 12:53, ???????? ?????? wrote: [snip] > > #======================================================== > # Collect filenames of the path dir as bytes > greek_filenames = os.listdir( b'/home/nikos/public_html/data/apps/' ) > > for filename in greek_filenames: > # Compute 'path/to/filename' in bytes > greek_path = b'/home/nikos/public_html/data/apps/' + b'filename' > try: This is a worse way of doing it because the ISO-8859-7 encoding has 1 byte per codepoint, meaning that it's more 'tolerant' (if that's the word) of errors. A sequence of bytes that is actually UTF-8 can be decoded as ISO-8859-7, giving gibberish. UTF-8 is less tolerant, and it's the encoding that ideally you should be using everywhere, so it's better to assume UTF-8 and, if it fails, try ISO-8859-7 and then rename so that any names that were ISO-8859-7 will be converted to UTF-8. That's the reason I did it that way in the code I posted, but, yet again, you've changed it without understanding why! > filepath = greek_path.decode('iso-8859-7') > > # Rename current filename from greek bytes --> utf-8 bytes > os.rename( greek_path, filepath.encode('utf-8') ) > except UnicodeDecodeError: > # Since its not a greek bytestring then its a proper utf8 bytestring > filepath = greek_path.decode('utf-8') > [snip] From steve+comp.lang.python at pearwood.info Fri Jun 7 11:33:31 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 15:33:31 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: <51b1fd4b$0$9505$c3e8da3$5496439d@news.astraweb.com> On Fri, 07 Jun 2013 04:53:42 -0700, ???????? ?????? wrote: > Do you mean that utf-8, latin-iso, greek-iso and ASCII have the 1st > 0-127 codepoints similar? You can answer this yourself. Open a terminal window and start a Python interactive session. Then try it and see what happens: s = ''.join(chr(i) for i in range(128)) bytes_as_utf8 = s.encode('utf-8') bytes_as_latin1 = s.encode('latin-1') bytes_as_greek_iso = s.encode('ISO-8859-7') bytes_as_ascii = s.encode('ascii') bytes_as_utf8 == bytes_as_latin1 == bytes_as_greek_iso == bytes_as_ascii What result do you get? True or False? And now you know the answer, without having to ask. > For example char 'a' has the value of '65' for all of those character > sets? Is hat what you mean? You can answer that question yourself. c = 'a' for encoding in ('utf-8', 'latin-1', 'ISO-8859-7', 'ascii'): print(c.encode(encoding)) By the way, I believe that Python has made a strategic mistake in the way that bytes are printed. I think it leads to more confusion, not less. Better would be something like this: c = 'a' for encoding in ('utf-8', 'latin-1', 'ISO-8859-7', 'ascii'): print(hex(c.encode(encoding)[0])) For historical reasons, most (but not all) charsets are supersets of ASCII. That is, the first 128 characters in the charset are the same as the 128 characters in ASCII. > s = 'a' (This is unicode right? Why when we assign a string to a > variable that string's type is always unicode Strings in Python 3 are Unicode strings. That's just the way Python works. Unicode was chosen because Unicode includes over a million different characters (well, potentially over a million, most of them are currently unused), and is a strict superset of *all* common legacy codepages from the old DOS and Windows 95 days. > and does not automatically > become utf-8 which includes all available world-wide characters? Unicode > is something different that a character set? ) Unicode is a character set. It is an enormous set of over one million characters (technically "code point", but don't worry about the difference right now) which can be collected in strings. UTF-8 is an encoding that goes from a string using the Unicode character set into bytes, and back again. Sometimes, people are lazy and say "UTF-8" when they mean "Unicode", or visa versa. UTF-16 and UTF-32 are two different encodings for the same purpose, but for various technical reasons UTF-8 is better for files. '?' is a character which exists in some charsets but not others. It is not in the ASCII charset, nor is it in Latin-1, nor Big-5. It is in the ISO-8859-7 charset, and of course it is in Unicode. In ISO-8859-7, the character '?' is stored as byte 0xEB (decimal 235), just as the character 'a' is stored as byte 0x61 (decimal 97). In UTF-8, the character ? is stored as two bytes 0xCE 0xBB. In UTF-16 (big-endian), the character ? is stored as two bytes 0x03 0xBB. In UTF-32 (big-endian), the character ? is stored as four bytes 0x00 0x00 0x03 0xBB. That's four different ways of "spelling" the same character as bytes, just as "three", "trois", "drei", "????", "tr?s" are all different ways of spelling the same number 3. > utf8_byte = s.encode('utf-8') > > Now if we are to decode this back to utf8 we will receive the char 'a'. > I beleive same thing will happen with latin, greek, ascii isos. Correct? Why don't you try it for yourself and see? > The characters that will not decode correctly are those that their > codepoints are greater that > 127 ? Maybe, maybe not. It depends on which codepoint, and which encodings. Some encodings use the same bytes for the same characters. Some encodings use different bytes. It all depends on the encoding, just like American and English both spell 3 "three", while French spells it "trois". > for example if s = '?' (greek character equivalent to english 'a') In Latin-1, '?' does not exist: py> '?'.encode('latin-1') Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'latin-1' codec can't encode character '\u03b1' in position 0: ordinal not in range(256) In the old Windows Greek charset, ISO-8859-7, '?' is stored as byte 0xE1: py> '?'.encode('ISO-8859-7') b'\xe1' But in the old Windows *Russian* charset, ISO-8859-5, the byte 0xE1 means a completely different character, CYRILLIC SMALL LETTER ES: py> b'\xE1'.decode('ISO-8859-5') '?' (don't be fooled that this looks like the English c, it is not the same). In Unicode, '?' is always codepoint 0x3B1 (decimal 945): py> ord('?') 945 but before you can store that on a disk, or as a file name, it needs to be converted to bytes, and which bytes you get depends on which encoding you use: py> '?'.encode('utf-8') b'\xce\xb1' py> '?'.encode('utf-16be') b'\x03\xb1' py> '?'.encode('utf-32be') b'\x00\x00\x03\xb1' -- Steven From nikos.gr33k at gmail.com Fri Jun 7 14:52:24 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 11:52:24 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: ?? ?????????, 7 ??????? 2013 5:29:25 ?.?. UTC+3, ? ??????? MRAB ??????: > This is a worse way of doing it because the ISO-8859-7 encoding has 1 > byte per codepoint, meaning that it's more 'tolerant' (if that's the > word) of errors. A sequence of bytes that is actually UTF-8 can be > decoded as ISO-8859-7, giving gibberish. > UTF-8 is less tolerant, and it's the encoding that ideally you should > be using everywhere, so it's better to assume UTF-8 and, if it fails, > try ISO-8859-7 and then rename so that any names that were ISO-8859-7 > will be converted to UTF-8. Indeed iw asnt aware of that, at that time, i was under the impression that if a string was encoded to bytes using soem charset can only be switched back with the use of that and only that charset. Since this is the case here is my fixning: #======================================================== # Collect filenames of the path dir as bytes filename_bytes = os.listdir( b'/home/nikos/public_html/data/apps/' ) for filename in filename_bytes: # Compute 'path/to/filename' into bytes filepath_bytes = b'/home/nikos/public_html/data/apps/' + b'filename' flag = False try: # Assume current file is utf8 encoded filepath = filepath_bytes.decode('utf-8') flag = 'utf8' except UnicodeDecodeError: try: # Since current filename is not utf8 encoded then it has to be greek-iso encoded filepath = filepath_bytes.decode('iso-8859-7') flag = 'greek' except UnicodeDecodeError: print( '''I give up! File name is unreadable!''' ) if( flag = 'greek' ) # Rename filename from greek bytes --> utf-8 bytes os.rename( filepath_bytes, filepath.encode('utf-8') ) #======================================================== filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', filename ) data = cur.fetchone() if not data: # First time for file; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filepaths = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filepaths.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for rec in data: if rec not in filepaths: cur.execute('''DELETE FROM files WHERE url = %s''', rec ) ============================= nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 81 [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py ------------------------------- i dont know why that if statement errors. From schesis at gmail.com Fri Jun 7 15:31:26 2013 From: schesis at gmail.com (Zero Piraeus) Date: Fri, 7 Jun 2013 15:31:26 -0400 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: : On 7 June 2013 14:52, ???????? ?????? wrote: File "/home/nikos/public_html/cgi-bin/files.py", line 81 > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py > ------------------------------- > i dont know why that if statement errors. Oh for f... READ SOME DOCUMENTATION, FOR THE LOVE OF BOB!!! READ YOUR OWN EFFING CODE! Look at this: http://docs.python.org/2/tutorial/controlflow.html Read it now? Of course not. Go away and read it. Now have you read it? GO AND READ IT. What does an if statement end with? Hint: yep, that's it. -[]z. From python at mrabarnett.plus.com Fri Jun 7 16:45:29 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 21:45:29 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: <51B24669.8010003@mrabarnett.plus.com> On 07/06/2013 20:31, Zero Piraeus wrote: > : > > On 7 June 2013 14:52, ???????? ?????? wrote: > File "/home/nikos/public_html/cgi-bin/files.py", line 81 >> [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) >> [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ >> [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax >> [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py >> ------------------------------- >> i dont know why that if statement errors. > > Oh for f... READ SOME DOCUMENTATION, FOR THE LOVE OF BOB!!! READ YOUR > OWN EFFING CODE! > > Look at this: > > http://docs.python.org/2/tutorial/controlflow.html > > Read it now? Of course not. Go away and read it. > > Now have you read it? GO AND READ IT. > > What does an if statement end with? Hint: yep, that's it. > Have you noticed how the line in the traceback doesn't match the line in the post? From schesis at gmail.com Fri Jun 7 19:24:44 2013 From: schesis at gmail.com (Zero Piraeus) Date: Fri, 7 Jun 2013 19:24:44 -0400 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51B24669.8010003@mrabarnett.plus.com> References: <51B1842A.30104@gmail.com> <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <51B24669.8010003@mrabarnett.plus.com> Message-ID: : On 7 June 2013 16:45, MRAB wrote: > On 07/06/2013 20:31, Zero Piraeus wrote: >> [something exasperated, in capitals] > > Have you noticed how the line in the traceback doesn't match the line > in the post? Actually, I hadn't. It's not exactly a surprise at this point, though ... I learnt a new word today, while searching for an apt ending to the sentence "Reading Nikos' posts is the internet equivalent of ..." ... and that word is Dermatillomania. -[]z. From cs at zip.com.au Fri Jun 7 22:52:22 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 8 Jun 2013 12:52:22 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: <20130608025222.GA1843@cskk.homeip.net> On 07Jun2013 11:52, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 81 | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py | ------------------------------- | i dont know why that if statement errors. Python statements that continue (if, while, try etc) end in a colon, so: if flag == 'greek': Cheers, -- Cameron Simpson Hello, my name is Yog-Sothoth, and I'll be your eldritch horror today. - Heather Keith From nikos.gr33k at gmail.com Sat Jun 8 02:49:17 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 23:49:17 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: ?? ???????, 8 ??????? 2013 5:52:22 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 07Jun2013 11:52, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 81 > > | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) > > | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ > > | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax > > | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py > > | ------------------------------- > > | i dont know why that if statement errors. > > > > Python statements that continue (if, while, try etc) end in a colon, so: Oh iam very sorry. Oh my God i cant beleive i missed a colon *again*: I have corrected this: #======================================================== # Collect filenames of the path dir as bytes filename_bytes = os.listdir( b'/home/nikos/public_html/data/apps/' ) for filename in filename_bytes: # Compute 'path/to/filename' into bytes filepath_bytes = b'/home/nikos/public_html/data/apps/' + b'filename' flag = False try: # Assume current file is utf8 encoded filepath = filepath_bytes.decode('utf-8') flag = 'utf8' except UnicodeDecodeError: try: # Since current filename is not utf8 encoded then it has to be greek-iso encoded filepath = filepath_bytes.decode('iso-8859-7') flag = 'greek' except UnicodeDecodeError: print( '''I give up! File name is unreadable!''' ) if flag == 'greek': # Rename filename from greek bytes --> utf-8 bytes os.rename( filepath_bytes, filepath.encode('utf-8') ) ================================== Now everythitng were supposed to work but instead iam getting this surrogate error once more. What is this surrogate thing? Since i make use of error cathcing and handling like 'except UnicodeDecodeError:' then it utf8's decode fails for some reason, it should leave that file alone and try the next file? try: # Assume current file is utf8 encoded filepath = filepath_bytes.decode('utf-8') flag = 'utf8' except UnicodeDecodeError: This is what it supposed to do, correct? ================================== [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 94, in [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] query = query.encode(charset) [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcce' in position 35: surrogates not allowed From rosuav at gmail.com Sat Jun 8 02:58:41 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 8 Jun 2013 16:58:41 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: On Sat, Jun 8, 2013 at 4:49 PM, ???????? ?????? wrote: > Oh my God i cant beleive i missed a colon *again*: For most Python programmers, this is a matter of moments to solve. Run the program, get a SyntaxError, fix it. Non-interesting event. (Maybe even sooner than that, if the editor highlights it for you.) This is why you really need to start yourself a testbox. DO NOT PLAY ON YOUR LIVE SYSTEM. This is sysadminning 101. And Python programming 101: The error traceback points to the error, or just after it. Get to know how error messages work. This is not even Python-specific. *Every* language behaves this way. You look at the highlighted line, if you can't see an error there you look a little bit higher. You should not need to beg for help for such trivial problems. This is the mark of a novice. You ought no longer to be a novice, based on how long you've been doing this stuff. You ought not to behave like one. ChrisA From steve+comp.lang.python at pearwood.info Sat Jun 8 03:26:23 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 08 Jun 2013 07:26:23 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: Message-ID: <51b2dc9f$0$29966$c3e8da3$5496439d@news.astraweb.com> On Fri, 07 Jun 2013 23:49:17 -0700, ???????? ?????? wrote: [...] > Oh iam very sorry. > Oh my God i cant beleive i missed a colon *again*: > > I have corrected this: [snip code] Stop posting your code after every trivial edit!!! -- Steven From rosuav at gmail.com Sat Jun 8 03:40:14 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 8 Jun 2013 17:40:14 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b2dc9f$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <51b2dc9f$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sat, Jun 8, 2013 at 5:26 PM, Steven D'Aprano wrote: > On Fri, 07 Jun 2013 23:49:17 -0700, ???????? ?????? wrote: > > [...] >> Oh iam very sorry. >> Oh my God i cant beleive i missed a colon *again*: >> >> I have corrected this: > > [snip code] > > Stop posting your code after every trivial edit!!! I think he uses the python-list archives as ersatz source control. ChrisA From python at mrabarnett.plus.com Sat Jun 8 12:32:45 2013 From: python at mrabarnett.plus.com (MRAB) Date: Sat, 08 Jun 2013 17:32:45 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: <51B35CAD.8080309@mrabarnett.plus.com> On 08/06/2013 07:49, ???????? ?????? wrote: > ?? ???????, 8 ??????? 2013 5:52:22 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: >> On 07Jun2013 11:52, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: >> >> | nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 81 >> >> | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == 'greek' ) >> >> | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] ^ >> >> | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] SyntaxError: invalid syntax >> >> | [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] Premature end of script headers: files.py >> >> | ------------------------------- >> >> | i dont know why that if statement errors. >> >> >> >> Python statements that continue (if, while, try etc) end in a colon, so: > > Oh iam very sorry. > Oh my God i cant beleive i missed a colon *again*: > > I have corrected this: > > #======================================================== > # Collect filenames of the path dir as bytes > filename_bytes = os.listdir( b'/home/nikos/public_html/data/apps/' ) > > for filename in filename_bytes: > # Compute 'path/to/filename' into bytes > filepath_bytes = b'/home/nikos/public_html/data/apps/' + b'filename' > flag = False > > try: > # Assume current file is utf8 encoded > filepath = filepath_bytes.decode('utf-8') > flag = 'utf8' > except UnicodeDecodeError: > try: > # Since current filename is not utf8 encoded then it has to be greek-iso encoded > filepath = filepath_bytes.decode('iso-8859-7') > flag = 'greek' > except UnicodeDecodeError: > print( '''I give up! File name is unreadable!''' ) > > if flag == 'greek': > # Rename filename from greek bytes --> utf-8 bytes > os.rename( filepath_bytes, filepath.encode('utf-8') ) > ================================== > > Now everythitng were supposed to work but instead iam getting this surrogate error once more. > What is this surrogate thing? > > Since i make use of error cathcing and handling like 'except UnicodeDecodeError:' > > then it utf8's decode fails for some reason, it should leave that file alone and try the next file? > try: > # Assume current file is utf8 encoded > filepath = filepath_bytes.decode('utf-8') > flag = 'utf8' > except UnicodeDecodeError: > > This is what it supposed to do, correct? > > ================================== > [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 94, in > [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) > [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute > [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] query = query.encode(charset) > [Sat Jun 08 09:39:34 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcce' in position 35: surrogates not allowed > Look at the traceback. It says that the exception was raised by: query = query.encode(charset) which was called by: cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) But what is 'filename'? And what has it to do with the first code snippet? Does the traceback have _anything_ to do with the first code snippet? From nikos.gr33k at gmail.com Sat Jun 8 12:53:03 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 09:53:03 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: Sorry for th delay guys, was busy with other thigns today and i am still reading your resposes, still ahvent rewad them all just Cameron's: Here is what i have now following Cameron's advices: #======================================================== # Collect filenames of the path directory as bytes path = b'/home/nikos/public_html/data/apps/' filenames_bytes = os.listdir( path ) for filename_bytes in filenames_bytes: try: filename = filename_bytes.decode('utf-8) except UnicodeDecodeError: # Since its not a utf8 bytestring then its for sure a greek bytestring # Prepare arguments for rename to happen utf8_filename = filename_bytes.encode('utf-8') greek_filename = filename_bytes.encode('iso-8859-7') utf8_path = path + utf8_filename greek_path = path + greek_filename # Rename current filename from greek bytes --> utf8 bytes os.rename( greek_path, utf8_path ) ========================================== I know this is wrong though. Since filename_bytes is the current filename encoded as utf8 or greek-iso then i cannot just *encode* what is already encoded by doing this: utf8_filename = filename_bytes.encode('utf-8') greek_filename = filename_bytes.encode('iso-8859-7') From nikos.gr33k at gmail.com Sat Jun 8 13:35:25 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 10:35:25 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: Okey after reading also Steven post, i was relived form the previous suck position i was, so with an alternation of a few variable names here is the code now: #======================================================== # Collect directory and its filenames as bytes path = b'/home/nikos/public_html/data/apps/' files = os.listdir( path ) for filename in files: # Compute 'path/to/filename' filepath_bytes = path + filename for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): try: filepath = filepath_bytes.decode( encoding ) except UnicodeDecodeError: continue # Rename to something valid in UTF-8 if encoding != 'utf-8': os.rename( filepath_bytes, filepath.encode('utf-8') ) assert os.path.exists( filepath ) break else: # This only runs if we never reached the break raise ValueError( 'unable to clean filename %r' % filepath_bytes ) ================================= I dont know why it is still failing when it tried to decode stuff since it tries 3 ways of decoding. Here is the exact error. nikos at superhost.gr [~/www/cgi-bin]# [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] Error in sys.excepthook: [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] ValueError: underlying buffer has been detached [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] Original exception was: [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] Traceback (most recent call last): [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 78, in [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] assert os.path.exists( filepath ) [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/genericpath.py", line 18, in exists [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] os.stat(path) [Sat Jun 08 20:32:44 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'ascii' codec can't encode characters in position 34-37: ordinal not in range(128) From python at mrabarnett.plus.com Sat Jun 8 13:48:46 2013 From: python at mrabarnett.plus.com (MRAB) Date: Sat, 08 Jun 2013 18:48:46 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: <51B36E7E.4000607@mrabarnett.plus.com> On 08/06/2013 17:53, ???????? ?????? wrote: > Sorry for th delay guys, was busy with other thigns today and i am still reading your resposes, still ahvent rewad them all just Cameron's: > > Here is what i have now following Cameron's advices: > > > #======================================================== > # Collect filenames of the path directory as bytes > path = b'/home/nikos/public_html/data/apps/' > filenames_bytes = os.listdir( path ) > > for filename_bytes in filenames_bytes: > try: > filename = filename_bytes.decode('utf-8) > except UnicodeDecodeError: > # Since its not a utf8 bytestring then its for sure a greek bytestring > > # Prepare arguments for rename to happen > utf8_filename = filename_bytes.encode('utf-8') > greek_filename = filename_bytes.encode('iso-8859-7') > > utf8_path = path + utf8_filename > greek_path = path + greek_filename > > # Rename current filename from greek bytes --> utf8 bytes > os.rename( greek_path, utf8_path ) > ========================================== > > I know this is wrong though. Yet you did it anyway! > Since filename_bytes is the current filename encoded as utf8 or greek-iso > then i cannot just *encode* what is already encoded by doing this: > > utf8_filename = filename_bytes.encode('utf-8') > greek_filename = filename_bytes.encode('iso-8859-7') > Try reading and understanding the code I originally posted. From cs at zip.com.au Fri Jun 7 22:49:31 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 8 Jun 2013 12:49:31 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> Message-ID: <20130608024931.GA77888@cskk.homeip.net> On 07Jun2013 04:53, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ?????????, 7 ??????? 2013 11:53:04 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: | > | >| errors='replace' mean dont break in case or error? | > | > | >Yes. The result will be correct for correct iso-8859-7 and slightly mangled | > | >for something that would not decode smoothly. | > | > | How can it be correct? We have encoded out string in utf-8 and then | > | we tried to decode it as greek-iso? How can this possibly be | > | correct? | | > If it is a valid iso-8859-7 sequence (which might cover everything, | > since I expect it is an 8-bit 1:1 mapping from bytes values to a | > set of codepoints, just like iso-8859-1) then it may decode to the | > "wrong" characters, but the reverse process (characters encoded as | > bytes) should produce the original bytes. With a mapping like this, | > errors='replace' may mean nothing; there will be no errors because | > the only Unicode characters in play are all from iso-8859-7 to start | > with. Of course another string may not be safe. | | > Visually, the names will be garbage. And if you go: | > mv '999-E????-????-???????.mp3' '999-E???-???-?????.mp3' | > while using the iso-8859-7 locale, the wrong thing will occur | > (assuming it even works, though I think it should because all these | > characters are represented in iso-8859-7, yes?) | | All the rest you i understood only the above quotes its still unclear to me. | I cant see to understand it. | | Do you mean that utf-8, latin-iso, greek-iso and ASCII have the 1st 0-127 codepoints similar? Yes. It is certainly true for utf-8 and latin-iso and ASCII. I expect it to be so for greek-iso, but have not checked. They're all essentially the ASCII set plus a range of other character codepoints for the upper values. The 8-bit sets iso-8859-1 (which I take you to mean by "latin-iso") and iso-8859-7 (which I take you to mean by "greek-iso") are single byte mapping with the top half mapped to characters commonly used in a particular region. Unicode has a much greater range, but the UTF-8 encoding of Unicode deliberately has the bottom 0-127 identical to ASCII, and higher values represented by multibyte sequences commences with at least the first byte in the 128-255 range. In this way pure ASCII files are already in UTF-8 (and, in fact, work just fine for the iso-8859-x encodings as well). | For example char 'a' has the value of '65' for all of those character sets? | Is hat what you mean? Yes. | s = 'a' (This is unicode right? Why when we assign a string to | a variable that string's type is always unicode and does not | automatically become utf-8 which includes all available world-wide | characters? Unicode is something different that a character set? ) In Python 3, yes. Strings are unicode. Note that that means they are sequences of codepoints whose meaning is as for Unicode. "utf-8" is a byte encoding for Unicode strings. An external storage format, if you like. The first 0-127 codepoints are 1:1 with byte values, and the higher code points require multibyte sequences. | utf8_byte = s.encode('utf-8') Unicode string => utf-8 byte encoding. | Now if we are to decode this back to utf8 we will receive the char 'a'. Yes. | I beleive same thing will happen with latin, greek, ascii isos. Correct? | | utf8_a = utf8_byte.decode('iso-8859-7') | latin_a = utf8_byte.decode('iso-8859-1') | ascii_a = utf8_byte.decode('ascii') | utf8_a = utf8_byte.decode('iso-8859-7') | | Is this correct? Yes, because of the design decision about the 0-127 codepoints. | All of those decodes will work even if the encoded bytestring was of utf8 type? | | The characters that will not decode correctly are those that their codepoints are greater that > 127 ? | for example if s = '?' (greek character equivalent to english 'a') | Is this what you mean? Yes, exactly so. | -------------------------------- | | Now back to my almost ready files.py script please: | | | #======================================================== | # Collect filenames of the path dir as bytes | greek_filenames = os.listdir( b'/home/nikos/public_html/data/apps/' ) | | for filename in greek_filenames: | # Compute 'path/to/filename' in bytes | greek_path = b'/home/nikos/public_html/data/apps/' + b'filename' You don't mean b'filename', which is the literal word "filename". You mean: filename.encode('iso-8859-7') More probably, you mean: dirpath = b'/home/nikos/public_html/data/apps/' greek_filenames = os.listdir(dirpath) for greek_filename in greek_filenames: try: filename = greek_filename.decode('iso-8859-7') and then: greek_path = dirpath + greek_filename utf8_filename = filename.encode('utf-8') utf8_path = dirpath + utf8_filename | try: | filepath = greek_path.decode('iso-8859-7') | # Rename current filename from greek bytes --> utf-8 bytes | os.rename( greek_path, filepath.encode('utf-8') ) I would break this up into smaller pieces: filepath = greek_path.decode('iso-8859-7') # Rename current filename from greek bytes --> utf-8 bytes utf8_path = filepath.encode('utf-8') os.rename( greek_path, utf8_path ) That way if an exception it thrown you have a much better idea of exactly which line had a problem. | except UnicodeDecodeError: | # Since its not a greek bytestring then its a proper utf8 bytestring | filepath = greek_path.decode('utf-8') And here you have a logic error. The idea is ok, but the encode and os.rename are not relevant to your UnicodeDecodeError check. So do this: dirpath = b'/home/nikos/public_html/data/apps/' greek_filenames = os.listdir(dirpath) for greek_filename in greek_filenames: try: filename = greek_filename.decode('iso-8859-7') except UnicodeDecodeError: # Since its not a greek bytestring then its a proper utf8 bytestring # no need to rename it pass else: # Rename current filename from greek bytes --> utf-8 bytes utf8_filename = filename.encode('utf-8') greek_path = dirpath + greek_filename utf8_path = dirpath + utf8_filename os.rename( greek_path, utf8_path ) You should try/except only around exactly the code expected to raise an exception, not extra stuff. However, this code won't work. Because iso-8859-7 is an 8-bit character set, it will _never_ fail to decode. All the bytes are value bytes. So not UnicodeDecodeError raised. A better test might be to decode it as utf-8. If that fails, then _guess_ that it is iso-8859-7 and rename the file, otherwise do not touch it. However, the real test is by eye: your program cannot deduce if a filename is nonsense, but presumably a visual inspection will show nonsense or sensible names. So: write a standalone python program to fix a filename (provided as sys.argv[1]) using the code above get a utf-8 Putty terminal check the remote locale is utf-8 do an "ls" for each nonsense file, run: python3 fix_filename.py nonsense-filename You should augument your rename with a prior os.path.exists() test to make sure you do not replace an existing file. [...snip...] | nikos at superhost.gr [~/www/cgi-bin]# [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Error in sys.excepthook: | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] ValueError: underlying buffer has been detached | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Original exception was: | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] Traceback (most recent call last): | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 71, in | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] os.rename( greek_path, filepath.encode('utf-8') ) | [Fri Jun 07 14:53:17 2013] [error] [client 79.103.41.173] FileNotFoundError: [Errno 2] \\u0394\\u03b5\\u03bd \\u03c5\\u03c0\\u03ac\\u03c1\\u03c7\\u03b5\\u03b9 \\u03c4\\u03ad\\u03c4\\u03bf\\u03b9\\u03bf \\u03b1\\u03c1\\u03c7\\u03b5\\u03af\\u03bf \\u03ae \\u03ba\\u03b1\\u03c4\\u03ac\\u03bb\\u03bf\\u03b3\\u03bf\\u03c2: '/home/nikos/public_html/data/apps/filename' Well, I would guess 2 things are happening: - you construct a literal b'/home/nikos/public_html/data/apps/filename' at the top of your script see my earlier remarks therefore the complaint that it does not exist - I would guess that the \\uxxxx sequences are a Unicode transcription of the error message, transcribed as hex because they don't look "printable" in the current local Cheers, -- Cameron Simpson Louis Pasteur's theory of germs is ridiculous fiction. --Pierre Pachet, Professor of Physiology at Toulouse, 1872 From nikos.gr33k at gmail.com Sat Jun 8 14:01:23 2013 From: nikos.gr33k at gmail.com (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Sat, 08 Jun 2013 21:01:23 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <20130608024931.GA77888@cskk.homeip.net> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> Message-ID: <51B37173.9060601@gmail.com> On 8/6/2013 5:49 ??, Cameron Simpson wrote: > On 07Jun2013 04:53, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > | ?? ?????????, 7 ??????? 2013 11:53:04 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > | > | >| errors='replace' mean dont break in case or error? > | > > | > | >Yes. The result will be correct for correct iso-8859-7 and slightly mangled > | > | >for something that would not decode smoothly. > | > > | > | How can it be correct? We have encoded out string in utf-8 and then > | > | we tried to decode it as greek-iso? How can this possibly be > | > | correct? > | > | > If it is a valid iso-8859-7 sequence (which might cover everything, > | > since I expect it is an 8-bit 1:1 mapping from bytes values to a > | > set of codepoints, just like iso-8859-1) then it may decode to the > | > "wrong" characters, but the reverse process (characters encoded as > | > bytes) should produce the original bytes. With a mapping like this, > | > errors='replace' may mean nothing; there will be no errors because > | > the only Unicode characters in play are all from iso-8859-7 to start > | > with. Of course another string may not be safe. > | > | > Visually, the names will be garbage. And if you go: > | > mv '999-E????-????-???????.mp3' '999-E???-???-?????.mp3' > | > while using the iso-8859-7 locale, the wrong thing will occur > | > (assuming it even works, though I think it should because all these > | > characters are represented in iso-8859-7, yes?) > | > | All the rest you i understood only the above quotes its still unclear to me. > | I cant see to understand it. > | > | Do you mean that utf-8, latin-iso, greek-iso and ASCII have the 1st 0-127 codepoints similar? > > Yes. It is certainly true for utf-8 and latin-iso and ASCII. > I expect it to be so for greek-iso, but have not checked. > > They're all essentially the ASCII set plus a range of other character > codepoints for the upper values. The 8-bit sets iso-8859-1 (which > I take you to mean by "latin-iso") and iso-8859-7 (which I take you > to mean by "greek-iso") are single byte mapping with the top half > mapped to characters commonly used in a particular region. > > Unicode has a much greater range, but the UTF-8 encoding of Unicode > deliberately has the bottom 0-127 identical to ASCII, and higher > values represented by multibyte sequences commences with at least > the first byte in the 128-255 range. In this way pure ASCII files > are already in UTF-8 (and, in fact, work just fine for the iso-8859-x > encodings as well). > Hold on! In the beginning there was ASCII with 0-127 values and then there was Unicode with 0-127 of ASCII's + i dont know how much many more? Now ASCIII needs 1 byte to store a single character while Unicode needs 2 bytes to store a character and that is because it has > 256 characters to store > 2^8bits ? Is this correct? Now UTF-8, latin-iso, greek-iso e.t.c are WAYS of storing characters into the hard drive? Because in some post i have read that 'UTF-8 encoding of Unicode'. Can you please explain to me whats the difference of ASCII-Unicode themselves aand then of them compared to 'Charsets' . I'm still confused about this. Is it like we said in C++: ' int a', a variable with name 'a' of type integer. 'char a', a variable with name 'a' of type char So taken form above example(the closest i could think of), the way i understand them is: A 'string' can be of (unicode's or ascii's) type and that type needs a way (thats a charset) to store this string into the hdd as a sequense of bytes? -- Webhost && Weblog -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Sat Jun 8 14:47:53 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 04:47:53 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51B37173.9060601@gmail.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> Message-ID: On Sun, Jun 9, 2013 at 4:01 AM, ???????? ?????? wrote: > Hold on! > > In the beginning there was ASCII with 0-127 values and then there was > Unicode with 0-127 of ASCII's + i dont know how much many more? > > Now ASCIII needs 1 byte to store a single character while Unicode needs 2 > bytes to store a character and that is because it has > 256 characters to > store > 2^8bits ? > > Is this correct? No. Let me start from the beginning. Computers don't work with characters, or strings, natively. They work with numbers. To be specific, they work with bits; and it's only by convention that we can work with anything larger. For instance, there's a VERY common convention around the PC world that a set of bits can be interpreted as a signed integer; if the highest bit is set, it's negative. There are also standards for floating-point (IEEE 754), and so on. ASCII is a character set. It defines a mapping of numbers to characters - for instance, @ is 64, SOH is 1, $ is 36, etcetera, etcetera. There are 128 such mappings. Since they all fit inside a 7-bit number, there's a trivial way to represent ASCII characters in a PC's 8-bit byte: you just leave the high bit clear and use the other seven. There have been various schemes for using the eighth bit - serial ports with parity, WordStar (I think) marking the ends of words, and most notably, Extended ASCII schemes that give you another whole set of 128 characters. And that was the beginning of Code Pages, because nobody could agree on what those extra 128 should be. Norwegians used Norwegian, the Greeks were taught their Greek, Arabians created themselves an Arabian codepage with the speed of summer lightning, and Hebrews allocated from 255 down to 128, which is absolutely frightening. But I digress. There were a variety of multi-byte schemes devised at various times, but we'll ignore all of them and jump straight to Unicode. With Unicode, there's (theoretically) no need to use any other system ever again, because whatever character you want, it'll exist in Unicode. In theory, of course; there are debates over that. Now, Unicode currently has defined an "address space" of roughly 20 bits, and in a throwback to the first programming I ever did, it's a segmented system: sixteen or seventeen planes of 65,536 characters each. (Fortunately the planes are identified by low numbers, not high numbers, and there's no stupidity of overlapping planes the way the 8086 did with memory!) The highest planes are special (plane 14 has a few special-purpose characters, planes 15 and 16 are for private use), and most of the middle ones have no characters assigned to them, so for the most part, you'll see characters from the first three planes. So what do we now have? A mapping of characters to "code points", which are numbers. (I'm leaving aside the issues of combining characters and such for the moment.) But computers don't work with numbers, they work with bits. Somehow we have to store those bits in memory. There are a good few ways to do that; one is to note that every Unicode character can be represented inside 32 bits, so we can use the standard integer scheme safely. (Since they fit inside 31 bits, we don't even need to care if it's signed or unsigned.) That's called UTF-32 or UCS-4, and it's a great way to handle the full Unicode range in a manner that makes a Texan look agoraphobic. Wide builds of Python up to 3.2 did this. Or you can try to store them in 16-bit numbers, but then you have to worry about the ones that don't fit in 16 bits, because it's really hard to squeeze 20 bits of information into 16 bits of storage. UTF-16 is one way to do this; special numbers mean "grab another number". It has its issues, but is (in my opinion, unfortunately) fairly prevalent. Narrow builds of Python up to 3.2 did this. Finally, you can use a more complicated scheme that uses anywhere from 1 to 4 bytes for each character, by carefully encoding information into the top bit - if it's set, you have a multi-byte character. That's how UTF-8 works, and is probably the most prevalent disk/network encoding. All of the UTF-X systems are called "UCS Transformation Formats" (UCS meaning Universal Character Set, roughly "Unicode"). They are mappings from Unicode numbers to bytes. Between Unicode and UTF-X, you have a mapping from character to byte sequence. > Now UTF-8, latin-iso, greek-iso e.t.c are WAYS of storing characters into > the hard drive? The ISO standard 8859 specifies a number of ASCII-compatible encodings, referred to as ISO-8859-1 through ISO-8859-16. You've been working with ISO-8859-1, also called Latin-1, and ISO-8859-7, which has your Greek characters in it. These are all ways of translating characters into numbers; and since they all fit within 8 bits, they're most commonly represented on PCs with single bytes. > So taken form above example(the closest i could think of), the way i > understand them is: > > A 'string' can be of (unicode's or ascii's) type and that type needs a way > (thats a charset) to store this string into the hdd as a sequense of bytes? A Python 3 'string' is always a series of Unicode characters. How they're represented in memory doesn't matter, but as of Python 3.3 that's a fairly compact and efficient system that can omit unnecessary zero bits. To store that string on your hard disk, send it across a network, or transmit it to another process, you need to encode it as bytes, somehow. The UCS Transformation Formats are specifically designed for this, and most of the time, UTF-8 is going to be the best option. It's compact, it's well known, and usually, it'll do everything you want. The only thing it won't do is let you quickly locate the Nth character, which is why it makes a poor in-memory format. Fortunately, Python lets us hide away pretty much all those details, just as it lets us hide away the details of what makes up a list, a dictionary, or an integer. You can safely assume that the string "foo" is a string of three characters, which you can work with as characters. The chr() and ord() functions let you switch between characters and numbers, and str.encode() and bytes.decode() let you switch between characters and byte sequences. Once you get your head around the differences between those three, it all works fairly neatly. Chris Angelico From nagia.retsina at gmail.com Sun Jun 9 01:09:57 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Sat, 8 Jun 2013 22:09:57 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> Message-ID: <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> ?? ???????, 8 ??????? 2013 9:47:53 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > Fortunately, Python lets us hide away pretty much all those details, > just as it lets us hide away the details of what makes up a list, a > dictionary, or an integer. You can safely assume that the string "foo" > is a string of three characters, which you can work with as > characters. The chr() and ord() functions let you switch between > characters and numbers, and str.encode() and bytes.decode() let you > switch between characters and byte sequences. Once you get your head > around the differences between those three, it all works fairly > neatly. I'm trying too! So, chr('A') would give me the mapping of this char, the number 65 while ord(65) would output the char 'A' likewise. >and str.encode() and bytes.decode() let you switch between characters and byte >sequences. Once What would happen if we we try to re-encode bytes on the disk? like trying: s = "?????" utf8_bytes = s.encode('utf-8') greek_bytes = utf_bytes.encode('iso-8869-7') Can we re-encode twice or as many times we want and then decode back respectively lke? utf8_bytes = greek_bytes.decode('iso-8859-7') s = utf8_bytes.decoce('utf-8') Is somethign like that totally crazy? And also is there a deiffrence between "encoding" and "compressing" ? Isnt the latter useing some form of encoding to take a string or bytes to make hold less space on disk? From steve+comp.lang.python at pearwood.info Sun Jun 9 02:45:50 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 06:45:50 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> Message-ID: <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: > chr('A') would give me the mapping of this char, the number 65 while > ord(65) would output the char 'A' likewise. Correct. Python uses Unicode, where code-point 65 ("ordinal value 65") means letter "A". There are older encodings. For example, a very old one, used on IBM mainframes, is EBCDIC, where ordinal value 65 means the letter "?", and the letter "A" has ordinal value 193. > What would happen if we we try to re-encode bytes on the disk? like > trying: > > s = "?????" > utf8_bytes = s.encode('utf-8') > greek_bytes = utf_bytes.encode('iso-8869-7') > > Can we re-encode twice or as many times we want and then decode back > respectively lke? Of course. Bytes have no memory of where they came from, or what they are used for. All you are doing is flipping bits on a memory chip, or on a hard drive. So long as *you* remember which encoding is the right one, there is no problem. If you forget, and start using the wrong one, you will get garbage characters, mojibake, or errors. [...] > And also is there a deiffrence between "encoding" and "compressing" ? Of course. They are totally unrelated. > Isnt the latter useing some form of encoding to take a string or bytes > to make hold less space on disk? Correct, except forget about "encoding". It's not relevant (except, maybe, in a mathematical sense) and will just confuse you. -- Steven From nagia.retsina at gmail.com Sun Jun 9 03:00:53 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Sun, 9 Jun 2013 00:00:53 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <19e762c7-a356-4ee1-9f50-82a128b5ac06@googlegroups.com> Thanks Stevn, i ll read them in a bit. When i read them can you perhaps tell me whats wrong and ima still getting decode issues? [CODE] # ================================================================================================================= # If user downloaded a file, thank the user !!! # ================================================================================================================= if filename: #update file counter if cookie does not exist if not nikos: cur.execute('''UPDATE files SET hits = hits + 1, host = %s, lastvisit = %s WHERE url = %s''', (host, lastvisit, filename) ) print('''

?? ?????? %s ??????????!''' % filename ) print('''
''') print('''


??? ???? Tetris ????? ?? ??????????? :-)''' ) print('''
''') print( '''''' % filename ) sys.exit(0) # ================================================================================================================= # Display download button for each file and download it on click # ================================================================================================================= print('''


''') #======================================================== # Collect directory and its filenames as bytes path = b'/home/nikos/public_html/data/apps/' files = os.listdir( path ) for filename in files: # Compute 'path/to/filename' filepath_bytes = path + filename for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): try: filepath = filepath_bytes.decode( encoding ) except UnicodeDecodeError: continue # Rename to something valid in UTF-8 if encoding != 'utf-8': os.rename( filepath_bytes, filepath.encode('utf-8') ) assert os.path.exists( filepath ) break else: # This only runs if we never reached the break raise ValueError( 'unable to clean filename %r' % filepath_bytes ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() if not data: # First time for file; primary key is automatic, hit is defaulted print( "iam here", filename + '\n' ) cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filepaths = set() # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filepaths.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for rec in data: if rec not in filepaths: cur.execute('''DELETE FROM files WHERE url = %s''', rec ) [/CODE] When trying to run it is still erroting out: [CODE] [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] Original exception was:, referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] Traceback (most recent call last):, referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 83, in , referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] assert os.path.exists( filepath ), referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/genericpath.py", line 18, in exists, referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] os.stat(path), referer: http://superhost.gr/ [Sun Jun 09 09:37:51 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'ascii' codec can't encode characters in position 34-37: ordinal not in range(128), refere [/CODE] Why am i still receing unicode decore errors? With the help of you guys we have writen a prodecure just to avoid this kind of decoding issues and rename all greek_byted_filenames to utf-8_byted. Is it the assert that fail? Do we have some logic error someplace i dont see? From steve+comp.lang.python at pearwood.info Sun Jun 9 04:15:07 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 08:15:07 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <19e762c7-a356-4ee1-9f50-82a128b5ac06@googlegroups.com> Message-ID: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 00:00:53 -0700, nagia.retsina wrote: > path = b'/home/nikos/public_html/data/apps/' > files = os.listdir( path ) > > for filename in files: > # Compute 'path/to/filename' > filepath_bytes = path + filename > for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): > try: > filepath = filepath_bytes.decode( encoding ) > except UnicodeDecodeError: > continue > > # Rename to something valid in UTF-8 > if encoding != 'utf-8': > os.rename( filepath_bytes, > filepath.encode('utf-8') ) > assert os.path.exists( filepath ) > break > else: > # This only runs if we never reached the break > raise ValueError( > 'unable to clean filename %r' % filepath_bytes ) Editing the traceback to get rid of unnecessary noise from the logging: Traceback (most recent call last): File "/home/nikos/public_html/cgi-bin/files.py", line 83, in assert os.path.exists( filepath ) File "/usr/local/lib/python3.3/genericpath.py", line 18, in exists os.stat(path) UnicodeEncodeError: 'ascii' codec can't encode characters in position 34-37: ordinal not in range(128) > Why am i still receing unicode decore errors? With the help of you guys > we have writen a prodecure just to avoid this kind of decoding issues > and rename all greek_byted_filenames to utf-8_byted. That's a very good question. It works for me when I test it, so I cannot explain why it fails for you. Please try this: log into the Linux server, and then start up a Python interactive session by entering: python3.3 at the $ prompt. Then, at the >>> prompt, enter these lines of code. You can copy and paste them: import os, sys print(sys.version) s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' '\N{GREEK SMALL LETTER GAMMA}\N{GREEK SMALL LETTER DELTA}' '\N{GREEK SMALL LETTER EPSILON}') print(s) filename = '/tmp/' + s open(filename, 'w') os.path.exists(filename) Copy and paste the results back here please. > Is it the assert that fail? Do we have some logic error someplace i dont > see? Please read the error message. Does it say AssertionError? If it says AssertionError, then the assert has failed. If it says something else, the code failed before the assert can run. -- Steven From nikos.gr33k at gmail.com Sun Jun 9 05:14:12 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:14:12 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <19e762c7-a356-4ee1-9f50-82a128b5ac06@googlegroups.com> <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <0a22570a-6bf6-4115-a7a8-a1684680702e@googlegroups.com> ?? ???????, 9 ??????? 2013 11:15:07 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > Please try this: log into the Linux server, and then start up a Python > import os, sys > print(sys.version) > s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' > '\N{GREEK SMALL LETTER GAMMA}\N{GREEK SMALL LETTER DELTA}' > '\N{GREEK SMALL LETTER EPSILON}') > print(s) > filename = '/tmp/' + s > open(filename, 'w') > os.path.exists(filename) > Copy and paste the results back here please. Of course: here it is: root at nikos [/home/nikos/www/cgi-bin]# python Python 3.3.2 (default, Jun 3 2013, 16:18:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os, sys >>> print(sys.version) 3.3.2 (default, Jun 3 2013, 16:18:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] >>> s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' ... '\N{GREEK SMALL LETTER GAMMA}\N{GREEK SMALL LETTER DELTA}' ... '\N{GREEK SMALL LETTER EPSILON}') print(s) >>> ????? >>> filename = '/tmp/' + s >>> open(filename, 'w') <_io.TextIOWrapper name='/tmp/?????' mode='w' encoding='UTF-8'> >>> os.path.exists(filename) True >>> From nikos.gr33k at gmail.com Sun Jun 9 06:32:34 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 03:32:34 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <0a22570a-6bf6-4115-a7a8-a1684680702e@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <19e762c7-a356-4ee1-9f50-82a128b5ac06@googlegroups.com> <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> <0a22570a-6bf6-4115-a7a8-a1684680702e@googlegroups.com> Message-ID: <3b2647bb-4b5a-4391-9ff4-6b5e755d9770@googlegroups.com> ?? ???????, 9 ??????? 2013 12:14:12 ?.?. UTC+3, ? ??????? ???????? ?????? ??????: > ?? ???????, 9 ??????? 2013 11:15:07 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > > > > > Please try this: log into the Linux server, and then start up a Python > > > > > import os, sys > > > print(sys.version) > > > s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' > > > '\N{GREEK SMALL LETTER GAMMA}\N{GREEK SMALL LETTER DELTA}' > > > '\N{GREEK SMALL LETTER EPSILON}') > > > print(s) > > > filename = '/tmp/' + s > > > open(filename, 'w') > > > os.path.exists(filename) > > > > > Copy and paste the results back here please. > > > > Of course: here it is: > > > > root at nikos [/home/nikos/www/cgi-bin]# python > > Python 3.3.2 (default, Jun 3 2013, 16:18:05) > > [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import os, sys > > >>> print(sys.version) > > 3.3.2 (default, Jun 3 2013, 16:18:05) > > [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] > > >>> s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' > > ... '\N{GREEK SMALL LETTER GAMMA}\N{GREEK SMALL LETTER DELTA}' > > ... '\N{GREEK SMALL LETTER EPSILON}') > > print(s) > > >>> ????? > > >>> filename = '/tmp/' + s > > >>> open(filename, 'w') > > <_io.TextIOWrapper name='/tmp/?????' mode='w' encoding='UTF-8'> > > >>> os.path.exists(filename) > > True > > >>> I dont much but it lloks correct to me, but then agian why this error? From cs at zip.com.au Sun Jun 9 05:16:06 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sun, 9 Jun 2013 19:16:06 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130609091606.GA5577@cskk.homeip.net> On 09Jun2013 08:15, Steven D'Aprano wrote: | On Sun, 09 Jun 2013 00:00:53 -0700, nagia.retsina wrote: | > path = b'/home/nikos/public_html/data/apps/' | > files = os.listdir( path ) | > | > for filename in files: | > # Compute 'path/to/filename' | > filepath_bytes = path + filename | > for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): | > try: | > filepath = filepath_bytes.decode( encoding ) | > except UnicodeDecodeError: | > continue | > | > # Rename to something valid in UTF-8 | > if encoding != 'utf-8': | > os.rename( filepath_bytes, | > filepath.encode('utf-8') ) | > assert os.path.exists( filepath ) | > break | > else: | > # This only runs if we never reached the break | > raise ValueError( | > 'unable to clean filename %r' % filepath_bytes ) | | Editing the traceback to get rid of unnecessary noise from the logging: | | Traceback (most recent call last): | File "/home/nikos/public_html/cgi-bin/files.py", line 83, in | assert os.path.exists( filepath ) | File "/usr/local/lib/python3.3/genericpath.py", line 18, in exists | os.stat(path) | UnicodeEncodeError: 'ascii' codec can't encode characters in position | 34-37: ordinal not in range(128) | | > Why am i still receing unicode decore errors? With the help of you guys | > we have writen a prodecure just to avoid this kind of decoding issues | > and rename all greek_byted_filenames to utf-8_byted. | | That's a very good question. It works for me when I test it, so I cannot | explain why it fails for you. If he's lucky the UnicodeEncodeError occurred while trying to print an error message, printing a greek Unicode string in the error with ASCII as the output encoding (default when not a tty IIRC). Cheers, -- Cameron Simpson I generally avoid temptation unless I can't resist it. - Mae West From steve+comp.lang.python at pearwood.info Sun Jun 9 08:36:51 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 12:36:51 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b476e2$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 19:16:06 +1000, Cameron Simpson wrote: > If he's lucky the UnicodeEncodeError occurred while trying to print an > error message, That's not what happens at the interactive console: py> assert os.path.exists('?1') Traceback (most recent call last): File "", line 1, in AssertionError > printing a greek Unicode string in the error with ASCII > as the output encoding (default when not a tty IIRC). An interesting thought. How would we test that? -- Steven From nagia.retsina at gmail.com Sun Jun 9 13:25:38 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Sun, 9 Jun 2013 10:25:38 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b476e2$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51b4398a$0$30001$c3e8da3$5496439d@news.astraweb.com> <51b476e2$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <2de6f168-5b93-4ee8-b9e3-44bd05158191@googlegroups.com> ?? ???????, 9 ??????? 2013 3:36:51 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > > printing a greek Unicode string in the error with ASCII > > as the output encoding (default when not a tty IIRC). > An interesting thought. How would we test that? Please elaborare this for me. I ditn undertood what you are trying to say, your assumption of why still ima getting decode issues. From lele at metapensiero.it Sun Jun 9 04:55:43 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Sun, 09 Jun 2013 10:55:43 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <8738srr7cg.fsf@nautilus.nautilus> Steven D'Aprano writes: > On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: > >> chr('A') would give me the mapping of this char, the number 65 while >> ord(65) would output the char 'A' likewise. > > Correct. Python uses Unicode, where code-point 65 ("ordinal value 65") > means letter "A". Actually, that's the other way around: >>> chr(65) 'A' >>> ord('A') 65 >> What would happen if we we try to re-encode bytes on the disk? like >> trying: >> >> s = "?????" >> utf8_bytes = s.encode('utf-8') >> greek_bytes = utf_bytes.encode('iso-8869-7') >> >> Can we re-encode twice or as many times we want and then decode back >> respectively lke? > > Of course. Bytes have no memory of where they came from, or what they are > used for. All you are doing is flipping bits on a memory chip, or on a > hard drive. So long as *you* remember which encoding is the right one, > there is no problem. If you forget, and start using the wrong one, you > will get garbage characters, mojibake, or errors. Uhm, no: "encode" transforms a Unicode string into an array of bytes, "decode" does the opposite transformation. You cannot do the former on an "arbitrary" array of bytes: >>> s = "?????" >>> utf8_bytes = s.encode('utf-8') >>> greek_bytes = utf8_bytes.encode('iso-8869-7') Traceback (most recent call last): File "", line 1, in AttributeError: 'bytes' object has no attribute 'encode' ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Sun Jun 9 05:00:46 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:00:46 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> Steven wrote: >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you need >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >characters, with ordinal values 0x4C and 0xFA, or one character with >ordinal value 0x4CFA? I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. >> UTF-8 and UTF-16 and UTF-32 >> I though the number beside of UTF- was to declare how many bits the >> character set was using to store a character into the hdd, no? >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >values to make a surrogate pair. A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? Is this what a surrogate is? a pari of 2 chars? >UTF-8 uses 8-bit values, but sometimes >it combines two, three or four of them to represent a single code-point. 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? >UTF-8 solves this problem by reserving some values to mean "this byte, on >its own", and others to mean "this byte, plus the next byte, together", >and so forth, up to four bytes. Some of the utf-8 bits that are used to represent a character's ordinal value are actually been also used to seperate or join the ordinal values themselves? Can you give an example please? How there are beign seperated? >Computers are digital and work with numbers. So character 'A' <-> 65 (in decimal uses in charset's table) <-> 01011100 (as binary stored in disk) <-> 0xEF (as hex, when we open the file with a hex editor) Is this how the thing works? (above values are fictional) From cs at zip.com.au Sun Jun 9 05:12:36 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sun, 9 Jun 2013 19:12:36 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> References: <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> Message-ID: <20130609091236.GA3435@cskk.homeip.net> On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | Steven wrote: | >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for | >> values up to 256? | | >Because then how do you tell when you need one byte, and when you need | >two? If you read two bytes, and see 0x4C 0xFA, does that mean two | >characters, with ordinal values 0x4C and 0xFA, or one character with | >ordinal value 0x4CFA? | | I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. Then it would not be UTF-8. UTF-8 will encode an Unicode codepoint. Your suggestion will not. I'd point out that if you did this, you'd be back in the same situation you just encountered with ASCII: the first above-255 value would raise a UnicodeEncodeError (an error which does not even exist at present:-) | >> UTF-8 and UTF-16 and UTF-32 | >> I though the number beside of UTF- was to declare how many bits the | >> character set was using to store a character into the hdd, no? | | >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. | >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit | >values to make a surrogate pair. | | A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? | Is this what a surrogate is? a pari of 2 chars? Essentially. The combination represents a code point. | >UTF-8 uses 8-bit values, but sometimes | >it combines two, three or four of them to represent a single code-point. | | 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) | '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) | 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) | | The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? Essentially. You can read up on the exact process in Wikipedia or the Unicode Standard. Cheers, -- Cameron Simpson The most annoying thing about being without my files after our disc crash was discovering once again how widespread BLINK was on the web. From nikos.gr33k at gmail.com Sun Jun 9 05:20:59 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:20:59 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> Message-ID: <8471f19b-e21a-4859-9842-92a97d75a840@googlegroups.com> ?? ???????, 9 ??????? 2013 12:12:36 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > > | Steven wrote: > > | >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for > > | >> values up to 256? > > | > > | >Because then how do you tell when you need one byte, and when you need > > | >two? If you read two bytes, and see 0x4C 0xFA, does that mean two > > | >characters, with ordinal values 0x4C and 0xFA, or one character with > > | >ordinal value 0x4CFA? > > | > > | I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. > > > > Then it would not be UTF-8. UTF-8 will encode an Unicode codepoint. Your >suggestion will not. I dont follow. > | >> UTF-8 and UTF-16 and UTF-32 > > | >> I though the number beside of UTF- was to declare how many bits the > > | >> character set was using to store a character into the hdd, no? > > | > > | >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. > > | >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit > > | >values to make a surrogate pair. > > | > > | A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? > > | Is this what a surrogate is? a pari of 2 chars? > > > > Essentially. The combination represents a code point. > > > > | >UTF-8 uses 8-bit values, but sometimes > > | >it combines two, three or four of them to represent a single code-point. > > | > > | 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) > > | '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) > > | 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) > > | > > | The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? > > > > Essentially. You can read up on the exact process in Wikipedia or the Unicode Standard. When you say essentially means you agree with my statements? From benjamin.kaplan at case.edu Sun Jun 9 16:01:15 2013 From: benjamin.kaplan at case.edu (Benjamin Kaplan) Date: Sun, 9 Jun 2013 13:01:15 -0700 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <8471f19b-e21a-4859-9842-92a97d75a840@googlegroups.com> References: <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <8471f19b-e21a-4859-9842-92a97d75a840@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 2:20 AM, ???????? ?????? wrote: > ?? ???????, 9 ??????? 2013 12:12:36 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: >> On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: >> >> | Steven wrote: >> >> | >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> >> | >> values up to 256? >> >> | >> >> | >Because then how do you tell when you need one byte, and when you need >> >> | >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >> >> | >characters, with ordinal values 0x4C and 0xFA, or one character with >> >> | >ordinal value 0x4CFA? >> >> | >> >> | I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. >> >> >> >> Then it would not be UTF-8. UTF-8 will encode an Unicode codepoint. Your >suggestion will not. > > I dont follow. > The point in the UTF formats is that they can encode any of the 1.1 million codepoints available in Unicode. Your suggestion can only encode 256 code points. We have that encoding already- it's called Latin-1 and it can't encode any of your Greek characters (hence why ISO-8859-7 exists, which can encode the Greek characters but not the Latin ones). If you were to use the whole byte to store the first 256 characters, you wouldn't be able to store character number 256 because the computer wouldn't be able to tell the difference between character 257 (0x01 0x01) and two chr(1)s. UTF-8 gets around this by reserving the top bit as a "am I part of a multibyte sequence" flag, >> | >> UTF-8 and UTF-16 and UTF-32 >> >> | >> I though the number beside of UTF- was to declare how many bits the >> >> | >> character set was using to store a character into the hdd, no? >> >> | >> >> | >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >> >> | >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >> >> | >values to make a surrogate pair. >> >> | >> >> | A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? >> >> | Is this what a surrogate is? a pari of 2 chars? >> >> >> >> Essentially. The combination represents a code point. >> >> >> >> | >UTF-8 uses 8-bit values, but sometimes >> >> | >it combines two, three or four of them to represent a single code-point. >> >> | >> >> | 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) >> >> | '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) >> >> | 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) >> >> | >> >> | The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? >> >> >> >> Essentially. You can read up on the exact process in Wikipedia or the Unicode Standard. > > > > When you say essentially means you agree with my statements? > -- In UTF-8 or UTF-16, the number of bytes required for the character is dependent on its code point, yes. That isn't the case for UTF-32, where every character uses exactly four bytes. From steve+comp.lang.python at pearwood.info Sun Jun 9 08:31:44 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 12:31:44 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> Message-ID: <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 02:00:46 -0700, ???????? ?????? wrote: > Steven wrote: >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes, and see 0x4C 0xFA, does that mean two >>characters, with ordinal values 0x4C and 0xFA, or one character with >>ordinal value 0x4CFA? > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I > meant up to 256, not above 256. Think about it. Draw up a big table of one million plus characters: Ordinal Character ======== ==================== 0 NUL control code 1 SOH control code ... 84 LATIN CAPITAL LETTER T 85 LATIN CAPITAL LETTER U ... 255 LATIN SMALL LETTER Y WITH DIAERESIS 256 LATIN CAPITAL LETTER A WITH MACRON ... 8485 OUNCE SIGN and so on, all the way to 1114111. Now, suppose you read a file, and see two bytes, shown in decimal: 84 followed by 85, or in hexadecimal, 0x54 followed by 0x55. How do you tell whether that means two characters, T followed by U, or a single character, ? (OUNCE SIGN)? With UTF-32, you can, because every value takes exactly the same space. So a T followed by a U is: 0x00000054 0x00000055 while a single ? is: 0x00002125 and it is easy to tell them apart: each block of 4 bytes is exactly one character. But notice how many NUL bytes there are? In the three characters shown, there are eight NUL bytes. Most text will be filled with NUL bytes, which is very wasteful. UTF-8 is designed to be compact, and also to be backwards-compatible with ASCII. Characters which are in ASCII will be a single byte, so there are no null bytes used for padding, (except for NUL itself, of course). So the three characters TU? will be: 0x54 0x55 0xE2 0x84 0xA5 Five bytes in total, instead of 12 for UTF-32. But the only tricky part is that character with ordinal value 0xE2 (decimal 226, ?) cannot be encoded as the single byte 0xE2, otherwise you would mistake the three bytes 0xE284A5 as starting with '?' followed by two more characters. And indeed, '?' is encoded as two bytes: 0xC3 0xA2 Likewise, character with ordinal value 0xC3 (decimal 195, ?) is also encoded as two bytes: 0xC3 0x83 And so on. This way, there is never any confusion as to whether (say) three bytes are three one-byte characters, or one three-byte character. >>> UTF-8 and UTF-16 and UTF-32 >>> I though the number beside of UTF- was to declare how many bits the >>> character set was using to store a character into the hdd, no? > >>Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >>UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >>values to make a surrogate pair. > > A surrogate pair is like itting for example Ctrl-A, which means is a > combination character that consists of 2 different characters? Is this > what a surrogate is? a pari of 2 chars? Yes, a surrogate pair is a pair of two "characters". But they're not *real* characters. They don't exist in any human language. They are just values that tells the program "these go together, and count as a single character". (This is why Unicode prefers to talk about *code points* rather than characters. Some code points are characters, and some are not.) >>UTF-8 uses 8-bit values, but sometimes it combines two, three or four of >>them to represent a single code-point. > > 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) Correct. > '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > > 127 ) That looks like two characters to me, '?' followed by '?'. That will take 4 bytes, two for '?' and two for '?'. > 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored > ? (since ordinal > 65000 ) Not necessarily four bytes. Could be three. Depends on the ideogram. > The amount of bytes needed to store a character solely depends on the > character's ordinal value in the Unicode table? Yes. >>UTF-8 solves this problem by reserving some values to mean "this byte, >>on its own", and others to mean "this byte, plus the next byte, >>together", and so forth, up to four bytes. > > Some of the utf-8 bits that are used to represent a character's ordinal > value are actually been also used to seperate or join the ordinal values > themselves? Can you give an example please? How there are beign > seperated? Did you look up UTF-8 on Wikipedia like I suggested? >>Computers are digital and work with numbers. > > So character 'A' <-> 65 (in decimal uses in charset's table) <-> > 01011100 (as binary stored in disk) <-> 0xEF (as hex, when we open the > file with a hex editor) > > Is this how the thing works? (above values are fictional) You can check this in Python: py> c = 'A' py> ord(c) 65 py> bin(65) '0b1000001' py> hex(65) '0x41' py> c = '?' py> ord(c) 945 py> c.encode('utf-8') b'\xce\xb1' py> c.encode('utf-16be') b'\x03\xb1' py> c.encode('utf-32be') b'\x00\x00\x03\xb1' py> c.encode('iso-8859-7') b'\xe1' -- Steven From nagia.retsina at gmail.com Mon Jun 10 03:10:38 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Mon, 10 Jun 2013 00:10:38 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: ?? ???????, 9 ??????? 2013 3:31:44 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > py> c = '?' > py> ord(c) > 945 The number 945 is the characters '?' ordinal value in the unicode charset correct? The command in the python interactive session to show me how many bytes this character will take upon encoding to utf-8 is: >>> s = '?' >>> s.encode('utf-8') b'\xce\xb1' I see that the encoding of this char takes 2 bytes. But why two exactly? How do i calculate how many bits are needed to store this char into bytes? Trying to to the same here but it gave me no bytes back. >>> s = 'a' >>> s.encode('utf-8') b'a' >py> c.encode('utf-8') > b'\xce\xb1' 2 bytes here. why 2? > py> c.encode('utf-16be') > b'\x03\xb1' 2 byets here also. but why 3 different bytes? the ordinal value of char 'a' is the same in unicode. the encodign system just takes the ordinal value end encode, but sinc eit uses 2 bytes should these 2 bytes be the same? > py> c.encode('utf-32be') > b'\x00\x00\x03\xb1 every char here takes exactly 4 bytes to be stored. okey. > py> c.encode('iso-8859-7') > b'\xe1' And also does '\x' means that the value is being respresented in hex way? and when i bin(6) i see '0b1000001' I should expect to see 8 bits of 1s and 0's. what the 'b' is tryign to say? From andipersti at gmail.com Mon Jun 10 04:15:38 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Mon, 10 Jun 2013 10:15:38 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51B58B2A.2040304@gmail.com> On 10.06.2013 09:10, nagia.retsina at gmail.com wrote: > ?? ???????, 9 ??????? 2013 3:31:44 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > >> py> c = '?' >> py> ord(c) >> 945 > > The number 945 is the characters '?' ordinal value in the unicode charset correct? Yes, the unicode character set is just a big list of characters. The 946th character in that list (starting from 0) happens to be '?'. > The command in the python interactive session to show me how many bytes > this character will take upon encoding to utf-8 is: > >>>> s = '?' >>>> s.encode('utf-8') > b'\xce\xb1' > > I see that the encoding of this char takes 2 bytes. But why two exactly? That's how the encoding is designed. Haven't you read the wikipedia article which was already mentioned several times? > How do i calculate how many bits are needed to store this char into bytes? You need to understand how UTF-8 works. Read the wikipedia article. > Trying to to the same here but it gave me no bytes back. > >>>> s = 'a' >>>> s.encode('utf-8') > b'a' The encode method returns a byte object. It's length will tell you how many bytes there are: >>> len(b'a') 1 >>> len(b'\xce\xb1') 2 The python interpreter will represent all values below 256 as ASCII characters if they are printable: >>> ord(b'a') 97 >>> hex(97) '0x61' >>> b'\x61' == b'a' True The Python designers have decided to use b'a' instead of b'\x61'. >>py> c.encode('utf-8') >> b'\xce\xb1' > > 2 bytes here. why 2? Same as your first question. >> py> c.encode('utf-16be') >> b'\x03\xb1' > > 2 byets here also. but why 3 different bytes? the ordinal value of > char 'a' is the same in unicode. the encodign system just takes the > ordinal value end encode, but sinc eit uses 2 bytes should these 2 bytes > be the same? 'utf-16be' is a different encoding scheme, thus it uses other rules to determine how each character is translated into a byte sequence. >> py> c.encode('iso-8859-7') >> b'\xe1' > > And also does '\x' means that the value is being respresented in hex way? > and when i bin(6) i see '0b1000001' > > I should expect to see 8 bits of 1s and 0's. what the 'b' is tryign to say? > '\x' is an escape sequence and means that the following two characters should be interpreted as a number in hexadecimal notation (see also the table of allowed escape sequences: http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals ). '0b' tells you that the number is printed in binary notation. Leading zeros are usually discarded when a number is printed: >>> bin(70) '0b1000110' >>> 0b100110 == 0b00100110 True >>> 0b100110 == 0b0000000000100110 True It's the same with decimal notation. You wouldn't say 00123 is different from 123, would you? Bye, Andreas From nikos.gr33k at gmail.com Mon Jun 10 04:54:34 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 10 Jun 2013 01:54:34 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: ?? ???????, 10 ??????? 2013 11:15:38 ?.?. UTC+3, ? ??????? Andreas Perstinger ??????: What is the difference between len('nikos') and len(b'nikos') First beeing the length of string nikos in characters while the second being the length of an ??? > The python interpreter will represent all values below 256 as ASCII > characters if they are printable: > >>> ord(b'a') > 97 > >>> hex(97) > '0x61' > >>> b'\x61' == b'a' > True > The Python designers have decided to use b'a' instead of b'\x61'. b'a' and b'\x61' are the bytestrings of char 'a' after utf-8 encoding? This ord(b'a' )should give an error in my opinion: ord('a') should return the ordinal value of char 'a', not ord(b'a') From nikos.gr33k at gmail.com Mon Jun 10 05:59:31 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 10 Jun 2013 02:59:31 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <349f7474-fce3-4891-8eb2-92fc53606fb2@googlegroups.com> > >>>> s = '?' > >>>> s.encode('utf-8') > > b'\xce\xb1' 'b' stands for binary right? b'\xce\xb1' = we are looking at a byte in a hexadecimal format? if yes how could we see it in binary and decimal represenation? > > I see that the encoding of this char takes 2 bytes. But why two exactly? > > How do i calculate how many bits are needed to store this char into bytes? > Because utf-8 takes 1 to 4 bytes to encode characters Since 2^8 = 256, utf-8 should store the first 256 chars of unicode charset using 1 byte. Also Since 2^16 = 65535, utf-8 should store the first 65535 chars of unicode charset using 2 bytes and so on. But i know that this is not the case. But i dont understand why. > >>>> s = 'a' > >>>> s.encode('utf-8') > > b'a' > utf-8 takes ASCII as it is, as 1 byte. They are the same EBCDIC and ASCII and Unicode are charactet sets, correct? iso-8859-1, iso-8859-7, utf-8, utf-16, utf-32 and so on are encoding methods, right? From andipersti at gmail.com Mon Jun 10 06:42:25 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Mon, 10 Jun 2013 12:42:25 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <349f7474-fce3-4891-8eb2-92fc53606fb2@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> <349f7474-fce3-4891-8eb2-92fc53606fb2@googlegroups.com> Message-ID: <51B5AD91.10503@gmail.com> On 10.06.2013 11:59, ???????? ?????? wrote: >> >>>> s = '?' >> >>>> s.encode('utf-8') >> > b'\xce\xb1' > > 'b' stands for binary right? No, here it stands for bytes: http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals > b'\xce\xb1' = we are looking at a byte in a hexadecimal format? No, b'\xce\xb1' represents a byte object containing 2 bytes. Yes, each byte is represented in hexadecimal format. > if yes how could we see it in binary and decimal represenation? >>> s = b'\xce\xb1' >>> s[0] 206 >>> bin(s[0]) '0b11001110' >>> s[1] 177 >>> bin(s[1]) '0b10110001' A byte object is a sequence of bytes (= integer values) and support indexing. http://docs.python.org/3/library/stdtypes.html#bytes > Since 2^8 = 256, utf-8 should store the first 256 chars of unicode > charset using 1 byte. > > Also Since 2^16 = 65535, utf-8 should store the first 65535 chars of > unicode charset using 2 bytes and so on. > > But i know that this is not the case. But i dont understand why. Because your method doesn't work. If you use all possible 256 bit-combinations to represent a valid character, how do you decide where to stop in a sequence of bytes? >> >>>> s = 'a' >> >>>> s.encode('utf-8') >> > b'a' >> utf-8 takes ASCII as it is, as 1 byte. They are the same > > EBCDIC and ASCII and Unicode are charactet sets, correct? > > iso-8859-1, iso-8859-7, utf-8, utf-16, utf-32 and so on are encoding methods, right? > Look at http://www.unicode.org/glossary/ for an explanation of all the terms. Bye, Andreas From steve+comp.lang.python at pearwood.info Mon Jun 10 07:59:03 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 10 Jun 2013 11:59:03 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b5bf86$0$29997$c3e8da3$5496439d@news.astraweb.com> On Mon, 10 Jun 2013 00:10:38 -0700, nagia.retsina wrote: > ?? ???????, 9 ??????? 2013 3:31:44 ?.?. UTC+3, ? ??????? Steven D'Aprano > ??????: > >> py> c = '?' >> py> ord(c) >> 945 > > The number 945 is the characters '?' ordinal value in the unicode > charset correct? Correct. > The command in the python interactive session to show me how many bytes > this character will take upon encoding to utf-8 is: > >>>> s = '?' >>>> s.encode('utf-8') > b'\xce\xb1' > > I see that the encoding of this char takes 2 bytes. But why two exactly? Because that's how UTF-8 works. If it was a different encoding, it might be 4 bytes, or 2, or 1, or 101, or 7, or 3. But it is UTF-8, so it takes 2 bytes. If you want to understand how UTF-8 works, look it up on Wikipedia. > How do i calculate how many bits are needed to store this char into > bytes? Every byte is made of 8 bits. There are two bytes. So multiply 8 by 2. > Trying to to the same here but it gave me no bytes back. > >>>> s = 'a' >>>> s.encode('utf-8') > b'a' There is a byte there. The byte is printed by Python as b'a', which in my opinion is a design mistake. That makes it look like a string, but it is not a string, and would be better printed as b'\x61'. But regardless of the display, it is still a single byte. >>py> c.encode('utf-8') >> b'\xce\xb1' > > 2 bytes here. why 2? Because that's how UTF-8 works. >> py> c.encode('utf-16be') >> b'\x03\xb1' > > 2 byets here also. but why 3 different bytes? Because it is a different encoding. > the ordinal value of char 'a' is the same in unicode. The same as what? > the encodign system just takes the ordinal value end encode, but > sinc eit uses 2 bytes should these 2 bytes be the same? No. That's like saying that since a dog in Germany has four legs and one head, and a dog in France has four legs and one head, dog should be spelled "Hund" in both Germany and France. Different encodings are like different languages. They spell the same word differently. >> py> c.encode('utf-32be') >> b'\x00\x00\x03\xb1 > > every char here takes exactly 4 bytes to be stored. okey. > >> py> c.encode('iso-8859-7') >> b'\xe1' > > And also does '\x' means that the value is being respresented in hex > way? and when i bin(6) i see '0b1000001' > > I should expect to see 8 bits of 1s and 0's. what the 'b' is tryign to > say? "b" for Binary. Just like 0o1234 uses octal, "o" for Octal. And 0x123EF uses hexadecimal. "x" for heXadecimal. -- Steven From nikos.gr33k at gmail.com Mon Jun 10 10:27:04 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 10 Jun 2013 07:27:04 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b5bf86$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> <51b5bf86$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <49c31f79-1258-47a3-af11-d61b63b9db78@googlegroups.com> ?? ???????, 10 ??????? 2013 2:59:03 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > On Mon, 10 Jun 2013 00:10:38 -0700, nagia.retsina wrote: > > > > > ?? ???????, 9 ??????? 2013 3:31:44 ?.?. UTC+3, ? ??????? Steven D'Aprano > > > ??????: > > > > > >> py> c = '?' > > >> py> ord(c) > > >> 945 > > > > > > The number 945 is the characters '?' ordinal value in the unicode > > > charset correct? > > > > Correct. > > > > > > > The command in the python interactive session to show me how many bytes > > > this character will take upon encoding to utf-8 is: > > > > > >>>> s = '?' > > >>>> s.encode('utf-8') > > > b'\xce\xb1' > > > > > > I see that the encoding of this char takes 2 bytes. But why two exactly? > > > > Because that's how UTF-8 works. If it was a different encoding, it might > > be 4 bytes, or 2, or 1, or 101, or 7, or 3. But it is UTF-8, so it takes > > 2 bytes. If you want to understand how UTF-8 works, look it up on > > Wikipedia. > > > > > > > How do i calculate how many bits are needed to store this char into > > > bytes? > > > > Every byte is made of 8 bits. There are two bytes. So multiply 8 by 2. > > > > > > > Trying to to the same here but it gave me no bytes back. > > > > > >>>> s = 'a' > > >>>> s.encode('utf-8') > > > b'a' > > > > There is a byte there. The byte is printed by Python as b'a', which in my > opinion is a design mistake. That makes it look like a string, but it is > not a string, and would be better printed as b'\x61'. But regardless of > the display, it is still a single byte. Perhaps, up to 127 ASCII chars python thinks its better for human to read the character representaion of the stored byte, instead of hex's. Just a guess. > Just like 0o1234 uses octal, "o" for Octal. > And 0x123EF uses hexadecimal. "x" for heXadecimal. Why the leadin zero before octal's 'o' and hex's 'x' and binary's 'b' ? Iam not goin to tired you any more, because ia hve exhaust myself tlo days now tryign to get my head around this. Please confirm i ahve understood correctly: I did but docs confuse me even more. Can you pleas ebut it simple. Unicode as i understand it was created out of need for a bigger character set compared to ASCII which could hold up to 127 chars(and extended versions of it up to 256), that could be able to hold all worlds symbols. ASCII and Unicode are character sets. Everything else sees to be an encoding system that work upon those characters sets. If what i said is true the last thing that still confuses me is that iso-8859-7(256 chars) seems like charactet set and an encoding method too. Can it be both or it is iso-8859-7 encoding method of Unicode character set similar as uTF8 is also Unicode's encoding method? From wxjmfauth at gmail.com Mon Jun 10 15:48:08 2013 From: wxjmfauth at gmail.com (jmfauth) Date: Mon, 10 Jun 2013 12:48:08 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> <51b5bf86$0$29997$c3e8da3$5496439d@news.astraweb.com> <49c31f79-1258-47a3-af11-d61b63b9db78@googlegroups.com> Message-ID: ----- A coding scheme works with three sets. A *unique* set of CHARACTERS, a *unique* set of CODE POINTS and a *unique* set of ENCODED CODE POINTS, unicode or not. The relation between the set of characters and the set of the code points is a *human* table, created with a sheet of paper and a pencil, a deliberate choice of characters with integers as "labels". The relation between the set of the code points and the set of encoded code points is a "mathematical" operation. In the case of an "8bits" coding scheme, like iso-XXX, this operation is a no-op, the relation is an identity. Shortly: set of code points == set of encoded code points. In the case of unicode, The Unicode consortium endorses three such mathematical operations called UTF-8, UTF-16 and UTF-32 where UTF means Unicode Transformation Format, a confusing wording meaning at the same time, the process and the result of the process. This Unicode Transformation does not produce bytes, it produces words/chunks/tokens of *bits* with lengths 8, 16, 32, called Unicode Transformation Units (from this the names UTF-8, -16, -32). At this level, only a structure has been defined (there is no computing). Very important, an healthy coding scheme works conceptually only with this *unique" set of encoded code points, not with bytes, characters or code points. The last step, the machine implementation: it is up to the processor, the compiler, the language to implement all these Unicode Transformation Units with of course their related specifities: char, w_char, int, long, endianess, rune (Go language), ... Not too over-simplified or not too over-complicated and enough to understand one, if not THE, design mistake of the flexible string representation. jmf From ned at nedbatchelder.com Mon Jun 10 16:28:36 2013 From: ned at nedbatchelder.com (Ned Batchelder) Date: Mon, 10 Jun 2013 13:28:36 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <5b0d3d7c-e3a4-436d-a55f-26bd40064fd5@googlegroups.com> <51b475b0$0$30001$c3e8da3$5496439d@news.astraweb.com> <51b5bf86$0$29997$c3e8da3$5496439d@news.astraweb.com> <49c31f79-1258-47a3-af11-d61b63b9db78@googlegroups.com> Message-ID: <2ea2a1c2-5df8-4c86-bb29-474925498f5f@googlegroups.com> On Monday, June 10, 2013 3:48:08 PM UTC-4, jmfauth wrote: > ----- > > > > A coding scheme works with three sets. A *unique* set > of CHARACTERS, a *unique* set of CODE POINTS and a *unique* > set of ENCODED CODE POINTS, unicode or not. > > The relation between the set of characters and the set of the > code points is a *human* table, created with a sheet of paper > and a pencil, a deliberate choice of characters with integers > as "labels". > > The relation between the set of the code points and the > set of encoded code points is a "mathematical" operation. > > In the case of an "8bits" coding scheme, like iso-XXX, > this operation is a no-op, the relation is an identity. > Shortly: set of code points == set of encoded code points. > > In the case of unicode, The Unicode consortium endorses > three such mathematical operations called UTF-8, UTF-16 and > UTF-32 where UTF means Unicode Transformation Format, a > confusing wording meaning at the same time, the process > and the result of the process. This Unicode Transformation does > not produce bytes, it produces words/chunks/tokens of *bits* with > lengths 8, 16, 32, called Unicode Transformation Units (from this > the names UTF-8, -16, -32). At this level, only a structure has > been defined (there is no computing). This is a really good description of the issues involved with character sets and encodings, thanks. > Very important, an healthy > coding scheme works conceptually only with this *unique" set > of encoded code points, not with bytes, characters or code points. > You don't explain why it is important to work with encoded code points. What's wrong with working with code points? > > The last step, the machine implementation: it is up to the > processor, the compiler, the language to implement all these > Unicode Transformation Units with of course their related > specifities: char, w_char, int, long, endianess, rune (Go > language), ... > > Not too over-simplified or not too over-complicated and enough > to understand one, if not THE, design mistake of the flexible > string representation. > > jmf Again you've made the claim that the flexible string representation is a mistake. But you haven't said WHY. I can't tell if you are trolling us, or are deluded, or genuinely don't understand what you are talking about. Some day you might explain yourself. I look forward to it. --Ned. From nikos.gr33k at gmail.com Sun Jun 9 05:08:48 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:08:48 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> ?? ???????, 9 ??????? 2013 11:55:43 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > Steven D'Aprano writes: > > > > > On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: > > > > > >> chr('A') would give me the mapping of this char, the number 65 while > > >> ord(65) would output the char 'A' likewise. > > > > > > Correct. Python uses Unicode, where code-point 65 ("ordinal value 65") > > > means letter "A". > > > > Actually, that's the other way around: > > > > >>> chr(65) > > 'A' > > >>> ord('A') > > 65 > > > > >> What would happen if we we try to re-encode bytes on the disk? like > > >> trying: > > >> > > >> s = "?????" > > >> utf8_bytes = s.encode('utf-8') > > >> greek_bytes = utf_bytes.encode('iso-8869-7') > > >> > > >> Can we re-encode twice or as many times we want and then decode back > > >> respectively lke? > > > > > > Of course. Bytes have no memory of where they came from, or what they are > > > used for. All you are doing is flipping bits on a memory chip, or on a > > > hard drive. So long as *you* remember which encoding is the right one, > > > there is no problem. If you forget, and start using the wrong one, you > > > will get garbage characters, mojibake, or errors. > > > > Uhm, no: "encode" transforms a Unicode string into an array of bytes, > > "decode" does the opposite transformation. You cannot do the former on > > an "arbitrary" array of bytes: > > > > >>> s = "?????" > > >>> utf8_bytes = s.encode('utf-8') > > >>> greek_bytes = utf8_bytes.encode('iso-8869-7') > > Traceback (most recent call last): > > File "", line 1, in > > AttributeError: 'bytes' object has no attribute 'encode' So something encoded into bytes cannot be re-encoded to some other bytes. How about a string i wonder? s = "?????" what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') From lele at metapensiero.it Sun Jun 9 05:20:58 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Sun, 09 Jun 2013 11:20:58 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> Message-ID: <87y5ajprlx.fsf@nautilus.nautilus> ???????? ?????? writes: > ?? ???????, 9 ??????? 2013 11:55:43 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: >> Uhm, no: "encode" transforms a Unicode string into an array of bytes, >> "decode" does the opposite transformation. You cannot do the former on >> an "arbitrary" array of bytes: >> >> >>> s = "?????" >> >>> utf8_bytes = s.encode('utf-8') >> >>> greek_bytes = utf8_bytes.encode('iso-8869-7') >> Traceback (most recent call last): >> File "", line 1, in >> AttributeError: 'bytes' object has no attribute 'encode' > > So something encoded into bytes cannot be re-encoded to some other bytes. > > How about a string i wonder? > s = "?????" > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') Ignoring the usual syntax error, this is just a variant of the code I posted: ?s.encode('iso-8869-7')? produces a bytes instance which *cannot* be "re-encoded" again in whatever encoding. ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Sun Jun 9 05:38:13 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:38:13 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> Message-ID: <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> ?? ???????, 9 ??????? 2013 12:20:58 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > > How about a string i wonder? > > s = "?????" > > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > Ignoring the usual syntax error, this is just a variant of the code I > posted: "s.encode('iso-8869-7')" produces a bytes instance which > *cannot* be "re-encoded" again in whatever encoding. s = 'a' s = s.encode('iso-8859-7').decode('utf-8') print( s ) a (we got the original character back) ================================ s = '?' s = s.encode('iso-8859-7').decode('utf-8') print( s ) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data Why this error? because 'a' ordinal value > 127 ? From andipersti at gmail.com Sun Jun 9 08:24:03 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Sun, 09 Jun 2013 14:24:03 +0200 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> Message-ID: <51B473E3.1070301@gmail.com> On 09.06.2013 11:38, ???????? ?????? wrote: > s = '?' > s = s.encode('iso-8859-7').decode('utf-8') > print( s ) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data > > Why this error? because 'a' ordinal value > 127 ? >>> s = '?' >>> s.encode('iso-8859-7') b'\xe1' >>> bin(0xe1) '0b11100001' Now look at the table on https://en.wikipedia.org/wiki/UTF-8#Description to find out how many bytes a UTF-8 decoder expects when it reads that value. Bye, Andreas From steve+comp.lang.python at pearwood.info Sun Jun 9 09:13:39 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 13:13:39 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> Message-ID: <51b47f82$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 02:38:13 -0700, ???????? ?????? wrote: > s = '?' > s = s.encode('iso-8859-7').decode('utf-8') > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: > unexpected end of data > > Why this error? because 'a' ordinal value > 127 ? Look at it this way... consider encoding and decoding to be like translating from one language to another. Suppose you start with the English word "street". You encode it to German by looking it up in an English-To-German dictionary: street -> Stra?e The you decode the German by looking "Stra?e" up in a German-To-English dictionary: Stra?e -> street and everything is good. But suppose that after encoding the English to German, you get confused, and think that it is Italian, not German. So when it comes to decoding, you try to look up 'Sta?e' in an Italian-To- English dictionary, and discover that there is no such thing as letter ? in Italian. So you cannot look the word up, and you get frustrated and shout "this is rubbish, there's no such thing as ?, that's not a letter!" Not in Italian, but it is a perfectly good letter in German. But you're looking it up in the wrong dictionary. Same thing with UTF-8. You encoded the string '?' by looking it up in the "Unicode To ISO-8859-7 bytes" dictionary. Then you try to decode it by looking for those bytes in the "UTF-8 bytes To Unicode" dictionary. But you can't find byte 0xe1 on its own in UTF-8 bytes, so Python shouts "this is rubbish, there's no such thing as 0xe1 on its own in UTF-8!" and raises UnicodeDecodeError. Sometimes you don't get an exception. Suppose that you are encoding from French to German: qui -> die (both words mean "who" in English) Now if you get confused, and decode the word 'die' by looking it up in an English-To-French dictionary, instead of German-To-French, you get: die -> mourir So instead of getting 'qui' back again, you get 'mourir'. This is like mojibake: the results are garbage, but there is no exception raised to warn you. -- Steven From benjamin.kaplan at case.edu Sun Jun 9 16:05:49 2013 From: benjamin.kaplan at case.edu (Benjamin Kaplan) Date: Sun, 9 Jun 2013 13:05:49 -0700 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 2:38 AM, ???????? ?????? wrote: > ?? ???????, 9 ??????? 2013 12:20:58 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > >> > How about a string i wonder? >> > s = "?????" >> > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > >> Ignoring the usual syntax error, this is just a variant of the code I >> posted: "s.encode('iso-8869-7')" produces a bytes instance which >> *cannot* be "re-encoded" again in whatever encoding. > > s = 'a' > s = s.encode('iso-8859-7').decode('utf-8') > print( s ) > > a (we got the original character back) > ================================ > s = '?' > s = s.encode('iso-8859-7').decode('utf-8') > print( s ) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data > > Why this error? because 'a' ordinal value > 127 ? > -- No. You get that error because the string is not encoded in UTF-8. It's encoded in ISO-8859-7. For ASCII strings (ord(x) < 127), ISO-8859-7 and UTF-8 look exactly the same. For anything else, they are different. If you were to try to decode it as ISO-8859-1, it would succeed, but you would get the character "?" back instead of ?. You're misunderstanding the decode function. Decode doesn't turn it into a string with the specified encoding. It takes it *from* the string with the specified encoding and turns it into Python's internal string representation. In Python 3.3, that encoding doesn't even have a name because it's not a standard encoding. So you want the decode argument to match the encode argument. From nikos.gr33k at gmail.com Sun Jun 9 06:37:45 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 03:37:45 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <4500f6f7-2296-4320-b6b9-dbc71c732500@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <4500f6f7-2296-4320-b6b9-dbc71c732500@googlegroups.com> Message-ID: <82414c38-cec0-404d-8d5d-435fed0750c7@googlegroups.com> I k nwo i have been a pain in the ass these days but this is the lats explanation i want from you, just to understand it completely. >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you need >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >characters, with ordinal values 0x4C and 0xFA, or one character with >ordinal value 0x4CFA? I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. >> UTF-8 and UTF-16 and UTF-32 >> I though the number beside of UTF- was to declare how many bits the >> character set was using to store a character into the hdd, no? >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >values to make a surrogate pair. A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? Is this what a surrogate is? a pari of 2 chars? >UTF-8 uses 8-bit values, but sometimes >it combines two, three or four of them to represent a single code-point. 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? >UTF-8 solves this problem by reserving some values to mean "this byte, on >its own", and others to mean "this byte, plus the next byte, together", >and so forth, up to four bytes. Some of the utf-8 bits that are used to represent a character's ordinal value are actually been also used to seperate or join the ordinal values themselves? Can you give an example please? How there are beign seperated? >Computers are digital and work with numbers. So character 'A' <-> 65 (in decimal uses in charset's table) <-> 01011100 (as binary stored in disk) <-> 0xEF (as hex, when we open the file with a hex editor) Is this how the thing works? (above values are fictional) From orgnut at yahoo.com Mon Jun 10 03:51:34 2013 From: orgnut at yahoo.com (Larry Hudson) Date: Mon, 10 Jun 2013 00:51:34 -0700 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <82414c38-cec0-404d-8d5d-435fed0750c7@googlegroups.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <4500f6f7-2296-4320-b6b9-dbc71c732500@googlegroups.com> <82414c38-cec0-404d-8d5d-435fed0750c7@googlegroups.com> Message-ID: <__GdnVhoRbgbGCjMnZ2dnUVZ_qqdnZ2d@giganews.com> On 06/09/2013 03:37 AM, ???????? ?????? wrote: > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. > NO!! 0 - 127, yes. 128 - 255 -> one byte of a multibyte code. That's why the decode fails, it sees it as incomplete data so it can't do anything with it. > > A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? > Is this what a surrogate is? a pari of 2 chars? > You're confusing character encodings with the way NON-CHARACTER keys on the KEYBOARD are encoded (function keys, arrow keys and such). These are NOT text characters but KEYBOARD key codes. These are NOT text codes and are entirely different and not related to any character encoding. How programs interpret and use these codes depends entirely on the individual programs. There are common conventions on how many are used, but there are no standards. Also the control-codes are the first 32 values of the ASCII (and ASCII-compatible) character set and are not multi-character key codes like the keyboard non-character keys. However, there are a few keyboard keys that actually produce control-codes. A few examples: Return/Enter -> Ctrl-M Tab -> Ctrl-I Backspace -> Ctrl-H > > So character 'A' <-> 65 (in decimal uses in charset's table) <-> 01011100 (as binary stored in disk) <-> 0xEF (as hex, when we open the file with a hex editor) > You are trying to put too much meaning to this. The value stored on disk, in memory, or whatever is binary bits, nothing else. How you describe the value, in decimal, in octal, in hex, in base-12, or... is totally irrelevant. These are simply different ways of describing or naming these numeric values. It's the same as saying 3 in English is three, in Spanish is tres, in German is drei... (I don't know Greek, sorry.) No matter what you call it, it is still the numeric integer value that is between 2 and 4. From nikos.gr33k at gmail.com Mon Jun 10 04:11:47 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Mon, 10 Jun 2013 01:11:47 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <__GdnVhoRbgbGCjMnZ2dnUVZ_qqdnZ2d@giganews.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <4500f6f7-2296-4320-b6b9-dbc71c732500@googlegroups.com> <82414c38-cec0-404d-8d5d-435fed0750c7@googlegroups.com> <__GdnVhoRbgbGCjMnZ2dnUVZ_qqdnZ2d@giganews.com> Message-ID: ?? ???????, 10 ??????? 2013 10:51:34 ?.?. UTC+3, ? ??????? Larry Hudson ??????: > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. > 0 - 127, yes. > 128 - 255 -> one byte of a multibyte code. you mean that in utf-8 for 1 character to be stored, we need 2 bytes? I still havign troubl e understanding this. Since 2^8 = 256, utf-8 would need 1 byte to store the 1st 256 characters but instead its using 1 byte up to the first 127 value and then 2 bytes for anyhtign above. Why? From orgnut at yahoo.com Tue Jun 11 03:20:19 2013 From: orgnut at yahoo.com (Larry Hudson) Date: Tue, 11 Jun 2013 00:20:19 -0700 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <4500f6f7-2296-4320-b6b9-dbc71c732500@googlegroups.com> <82414c38-cec0-404d-8d5d-435fed0750c7@googlegroups.com> <__GdnVhoRbgbGCjMnZ2dnUVZ_qqdnZ2d@giganews.com> Message-ID: On 06/10/2013 01:11 AM, ???????? ?????? wrote: > ?? ???????, 10 ??????? 2013 10:51:34 ?.?. UTC+3, ? ??????? Larry Hudson ??????: > >>> I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. > >> 0 - 127, yes. >> 128 - 255 -> one byte of a multibyte code. > > you mean that in utf-8 for 1 character to be stored, we need 2 bytes? > I still havign troubl e understanding this. > Utf-8 characters are encoded in different sizes, NOT a single fixed number of bytes. The high _bits_ of the first byte define the number of bytes of the individual character code. (I'm copying this from Wikipedia...) 0xxxxxxx -> 1 byte 110xxxxx -> 2 bytes 1110xxxx -> 3 bytes 11110xxx -> 4 bytes 111110xx -> 5 bytes 1111110x -> 6 bytes Notice that in the 1-byte version, since the high bit is always 0, only 7 bits are available for the character code, and this is the standard 0-127 ASCII (and ASCII-compatible) code set. > Since 2^8 = 256, utf-8 would need 1 byte to store the 1st 256 characters but instead its using 1 byte up to the first 127 value and then 2 bytes for anyhtign above. Why? > As I indicated above, one bit is reserved as a flag to indicate that the code is one-byte code and not a multibyte code, only 7 bits are available for the actual 1-byte (ASCII) code. From steve+comp.lang.python at pearwood.info Sun Jun 9 07:50:02 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 11:50:02 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b46bea$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 10:55:43 +0200, Lele Gaifax wrote: > Steven D'Aprano writes: > >> On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: >> >>> chr('A') would give me the mapping of this char, the number 65 while >>> ord(65) would output the char 'A' likewise. >> >> Correct. Python uses Unicode, where code-point 65 ("ordinal value 65") >> means letter "A". > > Actually, that's the other way around: > > >>> chr(65) > 'A' > >>> ord('A') > 65 /facepalm Of course you are right. >>> What would happen if we we try to re-encode bytes on the disk? like >>> trying: >>> >>> s = "?????" >>> utf8_bytes = s.encode('utf-8') >>> greek_bytes = utf_bytes.encode('iso-8869-7') >>> >>> Can we re-encode twice or as many times we want and then decode back >>> respectively lke? >> >> Of course. [...] > Uhm, no: "encode" transforms a Unicode string into an array of bytes, > "decode" does the opposite transformation. You cannot do the former on > an "arbitrary" array of bytes: And two for two. I misunderstood Nikos' question. As you point out, no, Python 3 will not allow you to re-encode bytes. You must first decode them to a string first, then encode them using a different encoding. (I thought that this was was Nikos actually meant, but I on re-reading his question more closely, that's not actually what he asked.) Sorry for any confusion. -- Steven From nikos.gr33k at gmail.com Sun Jun 9 08:18:00 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 05:18:00 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b46bea$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <51b46bea$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: Please and tell me that this actually can be solved. Iam willing to try anything for 'files.py' to load propelry. Every thign works as expected in my webiste, have manages to correct pelatologio.poy and koukos.py. This is the last thing the webiste needs, that is files.py to load so users can grab importan files in greek format. From steve+comp.lang.python at pearwood.info Sat Jun 8 15:01:57 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 08 Jun 2013 19:01:57 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> Message-ID: <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sat, 08 Jun 2013 21:01:23 +0300, ???????? ?????? wrote: > In the beginning there was ASCII with 0-127 values No, there were encoding systems that existed before ASCII, such as EBCDIC. But we can ignore those, and just start with ASCII. > and then there was > Unicode with 0-127 of ASCII's + i dont know how much many more? No, you have missed the utter chaos of dozens and dozens of Windows codepages and charsets. We still have to live with the pain of that. But now we have Unicode, with 0x10FFFF (decimal 1114111) code points. You can consider a code point to be the same as a character, at least for now. > Now ASCIII needs 1 byte to store a single character ASCII actually needs 7 bits to store a character. Since computers are optimized to work with bytes, not bits, normally ASCII characters are stored in a single byte, with one bit wasted. > while Unicode needs 2 bytes to store a character No. Since there are 0x10FFFF different Unicode "characters" (really code points, but ignore the difference) two bytes is not enough. Unicode needs 21 bits to store a character. Since that is more than 2 bytes, but less than 3, there are a few different ways for Unicode to be stored in memory, including: "Wide" Unicode uses four bytes per character. Why four instead of three? Because computers are more efficient when working with chunks of memory that is a multiple of four. "Narrow" Unicode uses two bytes per character. Since two bytes is only enough for about 65,000 characters, not 1,000,000+, the rest of the characters are stored as pairs of two-byte "surrogates". > and that is because it has > 256 characters > to store > 2^8bits ? Correct. > Now UTF-8, latin-iso, greek-iso e.t.c are WAYS of storing characters > into the hard drive? Your computer cannot carve a tiny little "A" into the hard drive when it stores that letter in a file. It has to write some bytes. So you need to know: - what byte, or bytes, represents the letter "A"? - what byte, or bytes, represents the letter "B"? - what byte, or bytes, represents the letter "?"? and so on. This set of rules, "byte XXXX means letter YYYY", is called an encoding. If you don't know what encoding to use, you cannot tell what the byte means. > Because in some post i have read that 'UTF-8 encoding of Unicode'. Can > you please explain to me whats the difference of ASCII-Unicode > themselves aand then of them compared to 'Charsets' . I'm still confused > about this. A charset is an ordered set of characters. For example, ASCII has 127 characters, starting with NUL: NUL ... A B C D E ... Z [ \ ] ^ ... a b c ... z ... where NULL is at position 0, 'A' is at position 65, 'B' at position 66, and so on. Latin-1 is similar, except there are 256 positions. Greek ISO-8859-7 is also similar, also 256 positions, but the characters are different. And so on, with dozens of charsets. And then there is Unicode, which includes *every* character is all of those dozens of charsets. It has 1114111 positions (most are currently unfilled). An encoding is simply a program that takes a character and returns a byte, or visa versa. For instance, the ASCII encoding will take character 'A'. That is found at position 65, which is 0x41 in hexadecimal, so the ASCII encoding turns character 'A' into byte 0x41, and visa versa. > Is it like we said in C++: > ' int a', a variable with name 'a' of type integer. 'char a', a > variable with name 'a' of type char > > So taken form above example(the closest i could think of), the way i > understand them is: > > A 'string' can be of (unicode's or ascii's) type and that type needs a > way (thats a charset) to store this string into the hdd as a sequense of > bytes? Correct. -- Steven From nikos.gr33k at gmail.com Sat Jun 8 17:14:01 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 14:14:01 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: ?? ???????, 8 ??????? 2013 10:01:57 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > ASCII actually needs 7 bits to store a character. Since computers are > optimized to work with bytes, not bits, normally ASCII characters are > stored in a single byte, with one bit wasted. So ASCII and Unicode are 2 Encoding Systems currently in use. How should i imagine them, visualize them? Like tables 'A' = 65, 'B' = 66 and so on? But if i do then that would be the visualization of a 'charset' not of an encoding system. What the diffrence of an encoding system and of a charset? ebcdic - ascii - unicode = al of them are encoding systems greek-iso - latin-iso - utf8 - utf16 = all of them are charsets. What are these differences? i cant imagine them all, i can only imagine charsets not encodign systems. Why python interprets by default all given strings as unicode and not ascii? because the former supports many positions while ascii only 127 positions , hence can interpet only 127 different characters? > "Narrow" Unicode uses two bytes per character. Since two bytes is only > enough for about 65,000 characters, not 1,000,000+, the rest of the > characters are stored as pairs of two-byte "surrogates". surrogates literal means a replacemnt? > Latin-1 is similar, except there are 256 positions. Greek ISO-8859-7 is > also similar, also 256 positions, but the characters are different. And > so on, with dozens of charsets. Latin has to display english chars(capital, small) + numbers + symbols. that would be 127 why 256? greek = all of the above plus greek chars, no? > And then there is Unicode, which includes *every* character is all of > those dozens of charsets. It has 1114111 positions (most are currently > unfilled). Shouldt the positions that Unicode has to use equal to the summary of all available characters of all the languages of the worlds plus numbers and special chars? why 1.000.000+ why the need for so many positions? Narrow Unicode format (2 byted) can cover all ofmthe worlds symbols. > An encoding is simply a program that takes a character and returns a > byte, or visa versa. For instance, the ASCII encoding will take character > 'A'. That is found at position 65, which is 0x41 in hexadecimal, so the > ASCII encoding turns character 'A' into byte 0x41, and visa versa. Why you say ASCII turn a character into HEX format and not as in binary format? Isnt the latter the way bytes are stored into hdd, like 010101111010101 etc? Are they stored as hex instead or you just said so to avoid printing 0s and 1s? From cs at zip.com.au Sat Jun 8 18:32:58 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sun, 9 Jun 2013 08:32:58 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: Message-ID: <20130608223258.GA29311@cskk.homeip.net> On 08Jun2013 14:14, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | ?? ???????, 8 ??????? 2013 10:01:57 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: | > ASCII actually needs 7 bits to store a character. Since computers are | > optimized to work with bytes, not bits, normally ASCII characters are | > stored in a single byte, with one bit wasted. | | So ASCII and Unicode are 2 Encoding Systems currently in use. | How should i imagine them, visualize them? | Like tables 'A' = 65, 'B' = 66 and so on? Yes, that works. | But if i do then that would be the visualization of a 'charset' not of an encoding system. | What the diffrence of an encoding system and of a charset? And encoding system is the method or transcribing these values to bytes and back again. | ebcdic - ascii - unicode = al of them are encoding systems | greek-iso - latin-iso - utf8 - utf16 = all of them are charsets. No. EBCDIC and ASCII and Unicode and Greek-ISO (iso-8859-7) are all character sets. (1:1 mappings of characters to numbers/ordinals). And encoding is a way of writing these values to bytes. Decoding reads bytes and emits character values. Because all of EBCDIC, ASCII and the iso-8859-x characters sets fit in the range 0-255, they are usually transcribed (encoded) directly, one byte per ordinal. Unicode is much larger. It cannot be transcribed (encoded) as one bytes to one value. There are several ways of transcribing Unicode. UTF-8 is a popular and usually compact form, using one byte for values below 128 and and multiple bytes for higher values. | Why python interprets by default all given strings as unicode and | not ascii? because the former supports many positions while ascii | only 127 positions , hence can interpet only 127 different characters? Yes. [...] | > Latin-1 is similar, except there are 256 positions. Greek ISO-8859-7 is | > also similar, also 256 positions, but the characters are different. And | > so on, with dozens of charsets. | | Latin has to display english chars(capital, small) + numbers + symbols. that would be 127 why 256? ASCII runs up to 127. Essentially English, numerals, control codes and various symbols. The iso-8859-x sets run to 255, and the upper 128 values map to characters popular in various regions. | greek = all of the above plus greek chars, no? So iso-8859-7 included the Greek characters. | > And then there is Unicode, which includes *every* character is all of | > those dozens of charsets. It has 1114111 positions (most are currently | > unfilled). | | Shouldt the positions that Unicode has to use equal to the summary | of all available characters of all the languages of the worlds plus | numbers and special chars? why 1.000.000+ why the need for so many | positions? Narrow Unicode format (2 byted) can cover all ofmthe | worlds symbols. 2 bytes is not enough. Chinese alone has more glyphs than that. | > An encoding is simply a program that takes a character and returns a | > byte, or visa versa. For instance, the ASCII encoding will take character | > 'A'. That is found at position 65, which is 0x41 in hexadecimal, so the | > ASCII encoding turns character 'A' into byte 0x41, and visa versa. | | Why you say ASCII turn a character into HEX format and not as in binary format? Steven didn't say that. He said "position 65". People often write bytes in hex (eg 0x41) because a byte always fits in a 2-character hex (16 x 16) and because often these values have binary-based subranges, and hex makes that more obvious. For example, 'A' is 0x41. 'a' is 0x61. So you can look at the hex code and almost visually know if you're dealing with upper or lower case, etc. | Isnt the latter the way bytes are stored into hdd, like 010101111010101 etc? | Are they stored as hex instead or you just said so to avoid printing 0s and 1s? They're stored as bits at the gate level. But writing hex codes _in_ _text_ is more compact, and more readable for humans. Cheers, -- Cameron Simpson A lot of people don't know the difference between a violin and a viola, so I'll tell you. A viola burns longer. - Victor Borge From nikos.gr33k at gmail.com Sun Jun 9 00:46:40 2013 From: nikos.gr33k at gmail.com (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Sun, 09 Jun 2013 07:46:40 +0300 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <20130608223258.GA29311@cskk.homeip.net> References: <20130608223258.GA29311@cskk.homeip.net> Message-ID: <51B408B0.9000602@gmail.com> On 9/6/2013 1:32 ??, Cameron Simpson wrote: > On 08Jun2013 14:14, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: > | ?? ???????, 8 ??????? 2013 10:01:57 ?.?. UTC+3, ? ??????? Steven D'Aprano ??????: > | > ASCII actually needs 7 bits to store a character. Since computers are > | > optimized to work with bytes, not bits, normally ASCII characters are > | > stored in a single byte, with one bit wasted. > | > | So ASCII and Unicode are 2 Encoding Systems currently in use. > | How should i imagine them, visualize them? > | Like tables 'A' = 65, 'B' = 66 and so on? > > Yes, that works. > > | But if i do then that would be the visualization of a 'charset' not of an encoding system. > | What the diffrence of an encoding system and of a charset? > > And encoding system is the method or transcribing these values to bytes and back again. So we have: ( 'A' mapped to the value of '65' ) => encoding process(i.e. uf-8) => bytes bytes => decoding process(i.e. utf-8) => ( '65' mapped to character 'A' ) Why does every character in a character set needs to be associated with a numeric value? I mean couldn't we just have characters sets that wouldn't have numeric associations like: 'A' => encoding process(i.e. uf-8) => bytes bytes => decoding process(i.e. utf-8) => character 'A' > > EBCDIC and ASCII and Unicode and Greek-ISO (iso-8859-7) are all character sets. > (1:1 mappings of characters to numbers/ordinals). > > And encoding is a way of writing these values to bytes. > Decoding reads bytes and emits character values. > > Because all of EBCDIC, ASCII and the iso-8859-x characters sets fit in the range 0-255, > they are usually transcribed (encoded) directly, one byte per ordinal. > > Unicode is much larger. It cannot be transcribed (encoded) as one bytes to one value. > There are several ways of transcribing Unicode. UTF-8 is a popular and usually compact form, > using one byte for values below 128 and and multiple bytes for higher values. An ordinal = ordered numbers like 7,8,910 and so on? Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for values up to 256? UTF-8 and UTF-16 and UTF-32 I though the number beside of UTF- was to declare how many bits the character set was using to store a character into the hdd, no? "Narrow" Unicode uses two bytes per character. Since two bytes is only enough for about 65,000 characters, not 1,000,000+, the rest of the characters are stored as pairs of two-byte "surrogates". Can you please explain this line "the rest of thecharacters are stored as pairs of two-byte "surrogates"" more easily for me to understand it? I'm still having troubl understanding what a surrogate is. Again, thank you very much for explaining the encodings to me, they were giving me trouble for years in all of my scripts. And one last thing. When locale to linux system is set to utf-8 that would mean that the linux applications, should try to encode string into hdd by using system's default encoding to utf-8 nad read them back from bytes by also using utf-8. Is that correct? -- Webhost && Weblog -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve+comp.lang.python at pearwood.info Sun Jun 9 02:25:10 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 06:25:10 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <20130608223258.GA29311@cskk.homeip.net> Message-ID: <51b41fc6$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 07:46:40 +0300, ???????? ?????? wrote: > Why does every character in a character set needs to be associated with > a numeric value? Because computers are digital, not analog, and because bytes are numbers. Here are a few of the 256 possible bytes, written in binary, decimal and hexadecimal: 0b00000000 0 0x00 0b00000001 1 0x01 0b00000010 2 0x02 [...] 0b01111111 127 0x7F 0b10000000 128 0x80 [...] 0b11111110 254 0xFE 0b11111111 255 0xFF EVERYTHING in computers are numbers, because everything is stored as bytes. Text is stored as bytes. Sound files are stored as bytes. Images are stored as bytes. Programs are stored as bytes. So everything is being stored as numbers. But the *meaning* we give to those numbers depends on what we do with them, whether we treat them as characters, bitmapped images, floating point values, or something else. Once we decide we want to store the character "A" as bytes, we need to decide which number it should be. That is the job of the charset. ASCII: 65 <--> 'A' 66 <--> 'B' 67 <--> 'C' etc. > I mean couldn't we just have characters sets that wouldn't have numeric > associations like: > > 'A' => encoding process(i.e. uf-8) => bytes bytes => decoding > process(i.e. utf-8) => character 'A' No. How would you store it in a computer's memory, or on a hard drive? By carving a tiny, microscopic "A" onto the hard drive? How would you read it back? It is theoretically possible to build an analog computer, out of clockwork, or water flowing through pipes, or something, but nobody really bothers because it is much harder and not very useful. > An ordinal = ordered numbers like 7,8,910 and so on? Yes. > Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for > values up to 256? Because then how do you tell when you need one byte, and when you need two? If you read two bytes, and see 0x4C 0xFA, does that mean two characters, with ordinal values 0x4C and 0xFA, or one character with ordinal value 0x4CFA? UTF-8 solves this problem by reserving some values to mean "this byte, on its own", and others to mean "this byte, plus the next byte, together", and so forth, up to four bytes. If you look up UTF-8 on Wikipedia, you will see more about this. > UTF-8 and UTF-16 and UTF-32 > I though the number beside of UTF- was to declare how many bits the > character set was using to store a character into the hdd, no? Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit values to make a surrogate pair. UTF-8 uses 8-bit values, but sometimes it combines two, three or four of them to represent a single code-point. > > "Narrow" Unicode uses two bytes per character. Since two bytes is only > > enough for about 65,000 characters, not 1,000,000+, the rest of the > > characters are stored as pairs of two-byte "surrogates". > > Can you please explain this line "the rest of thecharacters are stored > as pairs of two-byte "surrogates"" more easily for me to understand it? > I'm still having troubl understanding what a surrogate is. Look up UTF-16 and "surrogate pair" on Wikepedia. But basically, there are 65000+ different possible 16-bit values available for UTF-16 to use. Some of those values are reserved to mean "this value is not a character, it is half of a surrogate pair". Since they are *pairs*, they must always come in twos. A surrogate pair makes up a valid character. Half of a surrogate pair, on its own, is an error. A lot of this complexity is because of historical reasons. For example, when Unicode was first invented, there was only 65 thousand characters, and a fixed 16 bits was all you needed. But it was soon learned that 65 thousand was not enough (there are more than 65,000 Asian characters alone!) and so UTF-16 developed the trick with surrogate pairs to cover the extras. [...] > When locale to linux system is set to utf-8 that would mean that the > linux applications, should try to encode string into hdd by using > system's default encoding to utf-8 nad read them back from bytes by > also using utf-8. Is that correct? Yes. -- Steven From cs at zip.com.au Sun Jun 9 04:02:48 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sun, 9 Jun 2013 18:02:48 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b41fc6$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51b41fc6$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130609080248.GA59931@cskk.homeip.net> On 09Jun2013 06:25, Steven D'Aprano wrote: | [... heaps of useful explaination ...] | > When locale to linux system is set to utf-8 that would mean that the | > linux applications, should try to encode string into hdd by using | > system's default encoding to utf-8 nad read them back from bytes by | > also using utf-8. Is that correct? | | Yes. Although I'd point out that only application that care about text as _text_ need to consider Unicode and the encoding. A command like "mv" does not care. You type the command and "mv" receives byte strings as its arguments. So it is doing straight forward "bytes" file renames. It does not care or even know about encodings. In this scenario, really it is the Terminal program (eg Putty) which cares about text (what you type, and what gets displayed). It is because of mismatches between your Terminal local settings and the encoding that was chosen for the filenames that you get garbage listings, one way or another. Cheers, -- Cameron Simpson But then, I'm only 50. Things may well get a bit much for me when I reach the gasping heights of senile decrepitude of which old Andy Woodward speaks with such feeling. - Chris Malcolm, cam at uk.ac.ed.aifh, DoD #205 From nikos.gr33k at gmail.com Sun Jun 9 05:03:00 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 02:03:00 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <51b41fc6$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <40931e6b-11dd-4f97-bb1f-44c9b002d98f@googlegroups.com> ?? ???????, 9 ??????? 2013 11:02:48 ?.?. UTC+3, ? ??????? Cameron Simpson ??????: > In this scenario, really it is the Terminal program (eg Putty) which > cares about text (what you type, and what gets displayed). It is > because of mismatches between your Terminal local settings and the > encoding that was chosen for the filenames that you get garbage > listings, one way or another. Ca n you give an example please that shows a string being greek-iso encoded and then being utf8 decoded and presented back as: 1. properly 2. garbage ( means trash but dont what a garbage char is) 3. error From nikos.gr33k at gmail.com Sat Jun 8 17:21:56 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 14:21:56 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: Sorry for displaying my code so many times, i know i ahve exhaust you but hti is the last thinkg i am gonna ask from you in this thread. We are very close to have this working. #======================================================== # Collect directory and its filenames as bytes path = b'/home/nikos/public_html/data/apps/' files = os.listdir( path ) for filename in files: # Compute 'path/to/filename' filepath_bytes = path + filename for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): try: filepath = filepath_bytes.decode( encoding ) except UnicodeDecodeError: continue # Rename to something valid in UTF-8 if encoding != 'utf-8': os.rename( filepath_bytes, filepath.encode('utf-8') ) assert os.path.exists( filepath ) break else: # This only runs if we never reached the break raise ValueError( 'unable to clean filename %r' % filepath_bytes ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() if not data: # First time for file; primary key is automatic, hit is defaulted print( "iam here", filename + '\n' ) cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filepaths = () # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filepaths.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for rec in data: if rec not in filepaths: cur.execute('''DELETE FROM files WHERE url = %s''', rec ) ================================================= [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] Original exception was: [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] Traceback (most recent call last): [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] File "/home/nikos/public_html/cgi-bin/files.py", line 78, in [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] assert os.path.exists( filepath ) [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] File "/usr/local/lib/python3.3/genericpath.py", line 18, in exists [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] os.stat(path) [Sun Jun 09 00:16:14 2013] [error] [client 79.103.41.173] UnicodeEncodeError: 'ascii' codec can't encode characters in position 34-37: ordinal not in range(128) ================== Asserts what to make sure the the path/to/file afetr the rename exists but why are we still get those unicodeencodeerrors? From rosuav at gmail.com Sat Jun 8 18:10:14 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 08:10:14 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sun, Jun 9, 2013 at 7:21 AM, ???????? ?????? wrote: > Sorry for displaying my code so many times, i know i ahve exhaust you but hti is the last thinkg i am gonna ask from you in this thread. We are very close to have this working. You need to spend more time reading and less time frantically jumping around. Go read my post on Unicode; it answers several of the questions you posted in response to Steven's. And please, don't use this list as your substitute for source control. Don't keep posting your code. Most of us are ignoring it already. ChrisA From nikos.gr33k at gmail.com Sun Jun 9 04:11:40 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 01:11:40 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51b37fa4$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: I'm sorry posted by mistake unnessary code: here is the correct one that prodiuced the above error: #======================================================== # Collect directory and its filenames as bytes path = b'/home/nikos/public_html/data/apps/' files = os.listdir( path ) for filename in files: # Compute 'path/to/filename' filepath_bytes = path + filename for encoding in ('utf-8', 'iso-8859-7', 'latin-1'): try: filepath = filepath_bytes.decode( encoding ) except UnicodeDecodeError: continue # Rename to something valid in UTF-8 if encoding != 'utf-8': os.rename( filepath_bytes, filepath.encode('utf-8') ) assert os.path.exists( filepath ) break else: # This only runs if we never reached the break raise ValueError( 'unable to clean filename %r' % filepath_bytes ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) # Load'em for filename in filenames: try: # Check the presence of a file against the database and insert if it doesn't exist cur.execute('''SELECT url FROM files WHERE url = %s''', (filename,) ) data = cur.fetchone() if not data: # First time for file; primary key is automatic, hit is defaulted print( "iam here", filename + '\n' ) cur.execute('''INSERT INTO files (url, host, lastvisit) VALUES (%s, %s, %s)''', (filename, host, lastvisit) ) except pymysql.ProgrammingError as e: print( repr(e) ) #======================================================== # Collect filenames of the path dir as strings filenames = os.listdir( '/home/nikos/public_html/data/apps/' ) filepaths = set() # Build a set of 'path/to/filename' based on the objects of path dir for filename in filenames: filepaths.add( filename ) # Delete spurious cur.execute('''SELECT url FROM files''') data = cur.fetchall() # Check database's filenames against path's filenames for rec in data: if rec not in filepaths: cur.execute('''DELETE FROM files WHERE url = %s''', rec ) From steve+comp.lang.python at pearwood.info Thu Jun 6 22:13:39 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 02:13:39 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <51ada984$0$11118$c3e8da3@news.astraweb.com> <51b08444$0$29966$c3e8da3$5496439d@news.astraweb.com> <92b14633-2c15-477f-93e3-d4a2eac9c76b@googlegroups.com> Message-ID: <51b141d3$0$29966$c3e8da3$5496439d@news.astraweb.com> On Thu, 06 Jun 2013 11:46:20 -0700, ???????? ?????? wrote: > ?? ??????, 6 ??????? 2013 3:44:52 ?.?. UTC+3, ? ??????? Steven D'Aprano > ??????: > >> py> s = '999-E???-???-?????' >> py> bytes_as_utf8 = s.encode('utf-8') >> py> t = bytes_as_utf8.decode('iso-8859-7', errors='replace') >> py> print(t) >> 999-E????-????-??????? > > errors='replace' mean dont break in case or error? Please try reading the documentation for yourself before asking for help. http://docs.python.org/3/library/stdtypes.html#bytes.decode Yes, errors='replace' will mean that any time there is a decoding error, the official Unicode "U+FFFD REPLACEMENT CHARACTER" will be used instead of raising an error. Read the docs above, and follow the link, for more information. > You took the unicode > 's' string you utf-8 bytestringed it. The word is "encoded". Encoding: Unicode string => bytes Decoding: bytes => Unicode string > Then how its possible to ask for > the utf8-bytestring to decode back to unicode string with the use of a > different charset that the one used for encoding and thsi actually > printed the filename in greek-iso? Bytes are bytes, no matter where they come from. Bytes don't remember whether they were from a Unicode string, or a float, or an integer, or a list of pointers. All they know is that they are a sequence of values, each value is 8 bits. So bytes don't remember what charset (encoding) made them. If I have a set of bytes, I can *try* to do anything I like with them: * decode those bytes as ASCII * decode those bytes as UTF-8 * decode those bytes as ISO-8859-7 * decode those bytes as a list of floats * decode those bytes as a binary tree of pointers If the bytes are not actually ASCII, or UTF-8, etc., then I will get garbage, or an error. >> So that demonstrates part of your problem: even though your Linux >> system is using UTF-8, your terminal is probably set to ISO-8859-7. The >> interaction between these will lead to strange and disturbing Unicode >> errors. > > Yes i feel this is the problem too. > Its a wonder to me why putty used by default greek-iso instead of utf-8 > !! Putty is probably getting the default charset from the Windows 8 system you are using, and Windows is probably using Greek ISO-8859-7 for compatibility with legacy data going back to Windows 95 or even DOS. Someday everyone will use UTF-8, and this nonsense will be over. > Please explain this t me because now that i begin to understand this > encode/decode things i begin to like them! Start here: http://www.joelonsoftware.com/articles/Unicode.html http://nedbatchelder.com/text/unipain.html > a) WHAT does it mean when a linux system is set to use utf-8? The Linux file system just treats file names as bytes. Any byte except 0x00 and 0x2f (ASCII '\0' and '/') are legal in file names, so the Linux file system will store any other bytes. But the applications on a Linux system don't work with bytes, they work with text strings. You want to see a file name like "My Music.mp3", not bytes like 0x4d79204d757369632e6d7033. So the applications need to know how to encode their text strings (file names) into bytes, and how to decode the file system bytes back into strings. On Linux, there is a standard setting for doing this, the locale, which by default is set to use UTF-8 as the standard encoding. So well-behaved Linux applications will, directly or indirectly, interpret the bytes-on- disk in file names as UTF-8, because that's what the locale tells them to do. On Windows, there is a complete different setting for doing this, probably in the Registry. > b) WHAT does it mean when a terminal client is set to use utf-8? Terminals need to accept bytes from the keyboard, and display them as text to the user. So they need to know what encoding to use to change bytes like 0x4d79204d757369632e6d7033 into something that is readable to a human being, "My Music.mp3". That is the encoding. > c) WHAT happens when the two of them try to work together? If they are set to the same encoding, everything just works. If they are set to different encodings, you will probably have problems, just as you are having problems. > nikos at superhost.gr [~/www/cgi-bin]# echo $LS_OPTIONS > --color=tty -F -a -b -T 0 > > Is this okey? The '-b' option is for to display a filename in binary > mode? That's fine. > Indeed i have changed putty to use 'utf-8' and 'ls -l' now displays the > file in correct greek letters. Switching putty's encoding back to > 'greek-iso' then the *displayed* filanames shows in mojabike. > > WHAT is being displayed and what is actually stored as bytes is two > different thigns right? Correct. The bytes 0x200x40 means " @" (space at-sign) in ASCII or UTF-8, (and also many other encodings), but it means CJK UNIFIED IDEOGRAPH-4020 in UTF-16, it is invalid in UTF-32, and it means the number 32 as a 16-bit integer. Bytes are just sets of 8-bit values. The *meaning* of those 8- bit values depends on you, not the bytes themselves. > is the way the filaname is displayed in the terminal depending on the > encoding the terminal uses, correct? But no matter *how* its being > dislayed those two are the same file? That's a hard question to answer. Sometimes yes, but not necessarily. It will depend on how the terminal works, and how confused it gets. -- Steven From steve+comp.lang.python at pearwood.info Wed Jun 5 02:06:40 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 05 Jun 2013 06:06:40 GMT Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <8c16324f-da12-44ff-bf2f-4ae56f9127c0@googlegroups.com> <51ac3bd6$0$11118$c3e8da3@news.astraweb.com> <51ad1cdd$0$11118$c3e8da3@news.astraweb.com> <51ada984$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51aed570$0$11118$c3e8da3@news.astraweb.com> On Tue, 04 Jun 2013 08:47:01 +0000, Steven D'Aprano wrote: > Please run these commands, and show what result they give: > > alias ls > > printf %q\\n *.mp3 > > ls -b *.mp3 Do you have an answer for this yet? Better still, change the last two commands to this: printf %q\\n * ls -b * > If all else fails, you could just rename the troublesome file and > hopefully the problem will go away: > > mv *?.mp3 1.mp3 > mv 1.mp3 E??? ??? ?????.mp3 Of course that second command is wrong, it needs quotes: mv 1.mp3 "E??? ??? ?????.mp3" -- Steven From nikos.gr33k at gmail.com Sun Jun 2 13:12:11 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 10:12:11 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> Message-ID: <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> ?? ???????, 2 ??????? 2013 8:05:32 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > A programmer chooses his own clients, and you are the Atherton Wing to > my Inara Serra. You might want to explain this mystique call-name you inprovised for me. From torriem at gmail.com Sun Jun 2 13:21:38 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 02 Jun 2013 11:21:38 -0600 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> Message-ID: <51AB7F22.5000802@gmail.com> On 06/02/2013 11:12 AM, ???????? ?????? wrote: > ?? ???????, 2 ??????? 2013 8:05:32 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >> A programmer chooses his own clients, and you are the Atherton Wing to >> my Inara Serra. > > You might want to explain this mystique call-name you inprovised for me? Maybe you could research it a bit. From rosuav at gmail.com Sun Jun 2 13:21:46 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 03:21:46 +1000 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 3:12 AM, ???????? ?????? wrote: > ?? ???????, 2 ??????? 2013 8:05:32 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > >> A programmer chooses his own clients, and you are the Atherton Wing to >> my Inara Serra. > > You might want to explain this mystique call-name you inprovised for me. Or you could do a quick web search, like we keep telling you to do for other things. I'm pretty sure Google is familiar with both those names, and will point you to a mighty fine shindig. ChrisA From nikos.gr33k at gmail.com Sun Jun 2 14:34:24 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 2 Jun 2013 11:34:24 -0700 (PDT) Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> Message-ID: <970abe6b-898b-4145-b9fd-1b46a57a1e15@googlegroups.com> ?? ???????, 2 ??????? 2013 8:21:46 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > Or you could do a quick web search, like we keep telling you to do for > other things. I'm pretty sure Google is familiar with both those > names, and will point you to a mighty fine shindig. I see, nice one! :) I though ti was somehtign you invented yourself :) Now, as yo my initial question, can you suggest anything please? I dont know what else to try. The whole subprocess fails when it has to deal with a greek lettered filename. I just dont get it... I didn't ask for metrites.py to open via subprocess the greek filename, i just told metrites.py to call files.py which in turn tries to open that greek filename. Thats indirectly call... From torriem at gmail.com Mon Jun 3 01:40:34 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 02 Jun 2013 23:40:34 -0600 Subject: Changing filenames from Greeklish => Greek (subprocess complain) In-Reply-To: <970abe6b-898b-4145-b9fd-1b46a57a1e15@googlegroups.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <16b6b38b-aa9e-4148-8c97-741a8f593dac@googlegroups.com> <749e23ce-9b40-4ed4-aa6a-b06c2d7a1c24@googlegroups.com> <18755849-35bc-4925-811a-8f6f9fb5bf9c@googlegroups.com> <295a314d-efba-401c-b405-250e20948a4c@googlegroups.com> <970abe6b-898b-4145-b9fd-1b46a57a1e15@googlegroups.com> Message-ID: <51AC2C52.9060805@gmail.com> On 06/02/2013 12:34 PM, ???????? ?????? wrote: > The whole subprocess fails when it has to deal with a greek lettered > filename. No it doesn't. subprocess is working correctly. It's the program subprocess is running that is erring out. subprocess is merely reporting to you that it erred out, just as it should. > I just dont get it... I didn't ask for metrites.py to open via > subprocess the greek filename, i just told metrites.py to call > files.py which in turn tries to open that greek filename. Seems to me, then it's clear how you should go about debugging this. Have to run each layer separately, and see where the error occurs. Start with files.py. that's what any of us would do if the code were ours. But we can't do the debugging for you. It's not possible! We don't have access to your code nor to your server environment. Nor is it appropriate for any of us who have no contractual relationship with you to have such access to your server. Good luck. From nobody at nowhere.com Sun Jun 2 06:22:03 2013 From: nobody at nowhere.com (Nobody) Date: Sun, 02 Jun 2013 11:22:03 +0100 Subject: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> Message-ID: On Sat, 01 Jun 2013 08:44:36 -0700, ???????? ?????? wrote: > CalledProcessError: Command '/home/nikos/public_html/cgi-bin/files.py' returned non-zero exit status 1 > args = (1, '/home/nikos/public_html/cgi-bin/files.py') > cmd = '/home/nikos/public_html/cgi-bin/files.py' > output = b'Content-type: text/html; charset=utf-8\n\n\n\n' > returncode = 1 > with_traceback = The traceback indicates that files.py terminated with a non-zero exit code, indicating an error. And that's *all* that can be determined from the information which you have posted. If you want to solve the problem, you'll need to make files.py generate useful error messages, then capture them. From elliotperlman at cox.net Sat Jun 1 11:24:34 2013 From: elliotperlman at cox.net (Elliot Perlman) Date: Sat, 1 Jun 2013 11:24:34 -0400 Subject: problem loading Python PIL module Message-ID: <001201ce5edc$1f0bb4c0$5d231e40$@net> Hi, I have a Python program which worked successfully on several PCs using version 2.2 and showed videos using the PIL module version 1.1.5 . (All the rest works but the videos.) When I try to install the downloaded PIL module on my current laptop PC, I get the error message "Could not create key". I now have an Acer, Windows 7, 64-bit with Norton security. I tried turning off the firewall, but this did not help. Can anyone help me out? Thanks! Elliot Perlman -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.doolittle33 at gmail.com Sat Jun 1 21:12:45 2013 From: matt.doolittle33 at gmail.com (matt.doolittle33 at gmail.com) Date: Sat, 1 Jun 2013 18:12:45 -0700 (PDT) Subject: Need to modify a Python Gui Message-ID: <952fd0a5-7909-4b59-a4ad-5867e4b688d0@googlegroups.com> Hi everybody, I have a Python GUI that displays some data in labeled fields. As new data comes in the fields clear and the old data is lost. I need to make a text box in the GUI that will display the cleared data in a scrolling list. I also need this scrolling list to be logged to a file in comma-seperated values for analysis at a later time. The fields I need to scroll and log are labeled in the ?class TrafficPane(wx.Panel):? starting at line 64. Thanks #!/usr/bin/env python # -*- coding: utf-8 -*- # # op25_traffic_panel.py # # Copyright 2013 Balint Seeber # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # import wx import cPickle as pickle import gnuradio.gr.gr_threading as _threading wxDATA_EVENT = wx.NewEventType() def EVT_DATA_EVENT(win, func): win.Connect(-1, -1, wxDATA_EVENT, func) class DataEvent(wx.PyEvent): def __init__(self, data): wx.PyEvent.__init__(self) self.SetEventType (wxDATA_EVENT) self.data = data def Clone (self): self.__class__ (self.GetId()) class traffic_watcher_thread(_threading.Thread): def __init__(self, rcvd_pktq, event_receiver): _threading.Thread.__init__(self) self.setDaemon(1) self.rcvd_pktq = rcvd_pktq self.event_receiver = event_receiver self.keep_running = True self.start() def stop(self): self.keep_running = False def run(self): while self.keep_running: msg = self.rcvd_pktq.delete_head() de = DataEvent (msg) wx.PostEvent (self.event_receiver, de) del de # A snapshot of important fields in current traffic # class TrafficPane(wx.Panel): # Initializer # def __init__(self, parent, msgq): wx.Panel.__init__(self, parent) self.msgq = msgq sizer = wx.GridBagSizer(hgap=10, vgap=10) self.fields = {} label = wx.StaticText(self, -1, "DUID:") sizer.Add(label, pos=(1,1)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(1,2)) self.fields["duid"] = field; label = wx.StaticText(self, -1, "NAC:") sizer.Add(label, pos=(2,1)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(2,2)) self.fields["nac"] = field; label = wx.StaticText(self, -1, "Source:") sizer.Add(label, pos=(3,1)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(3,2)) self.fields["source"] = field; label = wx.StaticText(self, -1, "Destination:") sizer.Add(label, pos=(4,1)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(4,2)) self.fields["dest"] = field; label = wx.StaticText(self, -1, "MFID:") sizer.Add(label, pos=(1,4)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(1,5)) self.fields["mfid"] = field; label = wx.StaticText(self, -1, "ALGID:") sizer.Add(label, pos=(2,4)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(2,5)) self.fields["algid"] = field; label = wx.StaticText(self, -1, "KID:") sizer.Add(label, pos=(3,4)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(3,5)) self.fields["kid"] = field; label = wx.StaticText(self, -1, "MI:") sizer.Add(label, pos=(4,4)) field = wx.TextCtrl(self, -1, "", size=(216, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(4,5)) self.fields["mi"] = field; label = wx.StaticText(self, -1, "TGID:") sizer.Add(label, pos=(5,4)) field = wx.TextCtrl(self, -1, "", size=(144, -1), style=wx.TE_READONLY) sizer.Add(field, pos=(5,5)) self.fields["tgid"] = field; self.SetSizer(sizer) self.Fit() EVT_DATA_EVENT(self, self.display_data) self.watcher = traffic_watcher_thread(self.msgq, self) # Clear the field values # def clear(self): for v in self.fields.values(): v.Clear() def display_data(self,event): message = event.data pickled_dict = message.to_string() attrs = pickle.loads(pickled_dict) self.update(attrs) # Update the field values # def update(self, field_values): if field_values['duid'] == 'hdu': self.clear() for k,v in self.fields.items(): f = field_values.get(k, None) if f: v.SetValue(f) def main(): return 0 if __name__ == '__main__': main() From th982a at googlemail.com Sat Jun 1 22:56:17 2013 From: th982a at googlemail.com (Tamer Higazi) Date: Sun, 02 Jun 2013 04:56:17 +0200 Subject: xsd:anyType parameter in suds! Message-ID: <51AAB451.1090403@googlemail.com> Hi people! I have a problem passing an xs:anyType Parameter in "suds". The original sample is an application, where a "PHP Array" is being passed for the remoted method. What is the same type in python to accomplish the task?! doc with sample: http://kasapi.kasserver.com/dokumentation/?open=soap here the sample code with it's output: from suds.client import Client class KasAPI(object): def __init__(self): self.__WSDL = 'https://kasserver.com/schnittstelle/soap/wsdl/KasAuth.wsdl' self.client = Client(self.__WSDL) KasOBJ = KasAPI() print KasOBJ.client output: Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913 Service ( KasApiAuthenticationService ) tns="https://kasserver.com/" Prefixes (0) Ports (1): (KasApiAuthenticationPort) Methods (1): KasAuth(xs:anyType Params, ) Types (0): From wuwei23 at gmail.com Sun Jun 2 22:32:14 2013 From: wuwei23 at gmail.com (alex23) Date: Sun, 2 Jun 2013 19:32:14 -0700 (PDT) Subject: xsd:anyType parameter in suds! References: Message-ID: <64971a53-e6c3-4be0-8f88-5c7ea31f3bd1@mq5g2000pbb.googlegroups.com> On Jun 2, 12:56?pm, Tamer Higazi wrote: > The original sample is an application, where a "PHP Array" is being > passed for the remoted method. What is the same type in python to > accomplish the task?! In this case, you probably want to use a dict(). From livewebcamsexs at gmail.com Sun Jun 2 05:55:35 2013 From: livewebcamsexs at gmail.com (MoneyMaker) Date: Sun, 2 Jun 2013 02:55:35 -0700 (PDT) Subject: Free Money Message-ID: <1a1a9864-bc21-41f5-9fff-44a12d614a9c@googlegroups.com> Get Free Money here: http://horrorhorrorhorror.webs.com/free-money From svnitakash at gmail.com Sun Jun 2 07:04:50 2013 From: svnitakash at gmail.com (meakaakka) Date: Sun, 2 Jun 2013 04:04:50 -0700 (PDT) Subject: Getting Error can't find '__main__' module in 'X' Message-ID: Hey I am newbie in python.I have installed python 2.7.5 correctly.It is working fine but I am having some issues.I have set windows Enviroment variables. The problem is when I try to save my program in a folder(C:\Users\John\X)it shows that module error but when I save it outside this X folder ( C:\Users\John ) It runs successfully.How to fix it? From davea at davea.name Sun Jun 2 07:39:59 2013 From: davea at davea.name (Dave Angel) Date: Sun, 02 Jun 2013 07:39:59 -0400 Subject: Getting Error can't find '__main__' module in 'X' In-Reply-To: References: Message-ID: <51AB2F0F.4020205@davea.name> On 06/02/2013 07:04 AM, meakaakka wrote: > Hey I am newbie in python.I have installed python 2.7.5 correctly.It is working fine but I am having some issues.I have set windows Enviroment variables. Please be a lot more specific. Do you have any particular environment variables you suspect, and if so, what have you set them to? > The problem is when I try to save my program in a folder(C:\Users\John\X)it shows that module error Then you'd better tell us what program you were using to save it with. I've never seen that error from emacs or Notepad++, but perhaps you're doing something else. > but when I save it outside this X folder ( C:\Users\John ) It runs successfully.How to fix it? > Perhaps you'd better start at the beginning. Thanks for telling us you're using python Version 2.7.5, Now perhaps you mean not that this error occurs during the save, but instead during running of the program. So let's try again. Don't try to answer just certain parts of the below, but instead make your own problem description that's at least as thorough. By the time you're done, you just might solve the problem yourself, or you'll have learned something new about the problem. But at least you'll help us help you. You have saved some program (what is its name?) (why not include it here, since it probably only needs about 3 lines, including an import of some form?) in the directory C:\Users\John\X. You then run it, from a cmd prompt, as follows: C:\Users\John\X > python myprog.py and you get the following error. (You fill this in. It's a group of lines called a traceback, and the whole thing can be useful. Don't summarize or retype it, use copy/paste). You then move the file to directory C:\Users\John\betterplace, do a cd there, and run it again from that directory. Now it works, no import errors, and runs to completion. So what else is in that first directory? Are you referencing X somewhere in your code? Are you referencing __name__ (which is a reserved term with very specific meaning)? Have you tried keeping the program in C:\Users\John\X but running with a different current directory? C:\Users\John\testdir > python ..\X\myprog.py If I had to mount my crystal ball, I'd say you've got some form of recursive import going on (thus __main__), and that some module or package has the name X. You might also have more than one copy of some python source file, or a sys.path that's messed up. Some general advice for the future: Avoid using any uppercase in file and directory names for source code. Avoid any single-letter names. Avoid doing recursive imports, and NEVER import the script itself from some other file. One more thing. Before replying, please read this since you're using googlegroups: http://wiki.python.org/moin/GoogleGroupsPython. -- DaveA From steve+comp.lang.python at pearwood.info Sun Jun 2 07:43:38 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 02 Jun 2013 11:43:38 GMT Subject: Getting Error can't find '__main__' module in 'X' References: Message-ID: <51ab2fe9$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sun, 02 Jun 2013 04:04:50 -0700, meakaakka wrote: > Hey I am newbie in python.I have installed python 2.7.5 correctly.It is > working fine but I am having some issues.I have set windows Enviroment > variables. Any particular environment variables? Shall we guess which ones? > The problem is when I try to save my program in a > folder(C:\Users\John\X)it shows that module error Are you saying that you cannot save in that folder? Sounds like a permission error, or maybe the folder doesn't exist. Have you tried saving in that folder with another program? Can you see the folder in Windows Explorer? Or do you mean you CAN save in that folder, but... something else happens? What? We could play guessing games all week, but it would be better if you actually tell us exactly what is happening. You can see exactly what happens, we can only see what you tell us. Tell us: * Where is the file saved? * What file name does it have? * EXACTLY how you are trying to run the file. * If you are trying to launch it from the command line, COPY AND PASTE the EXACT command you are using. * If you get an error, and it is in the console, COPY AND PASTE the EXACT error message you get. ALL of it. Don't summarise, don't leave out bits you think aren't important, don't retype it from memory, and especially don't assume that because you know what the error is, we will magically know too. The error message will probably start with: Traceback (most recent call last): and then end with an exception type and error message, like: NameError: name 'foo' is not defined IndexError: list index out of range SyntaxError: invalid syntax or similar. Copy and paste the entire error message. Once you have shown us these details, we might be able to help you, or at least come back to you with more questions. -- Steven From svnitakash at gmail.com Sun Jun 2 12:59:53 2013 From: svnitakash at gmail.com (meakaakka) Date: Sun, 2 Jun 2013 09:59:53 -0700 (PDT) Subject: Getting Error can't find '__main__' module in 'X' In-Reply-To: <51ab2fe9$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <51ab2fe9$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: I think I am the dumbest guy.I got it.I was running it in a wrong way. I was running it like python X hello.py and the problem was in C:\Users\John I should have first gone in C:\Users\John\X then I should run it like python hello.py Dave Angel,Steven D'Aprano-Thank you for the help. From jason.swails at gmail.com Sun Jun 2 10:13:37 2013 From: jason.swails at gmail.com (Jason Swails) Date: Sun, 2 Jun 2013 10:13:37 -0400 Subject: Python 2-3 compatibility Message-ID: Hello Everyone, I have a Python script that I wrote to support a project that I work on (that runs primarily on Unix OSes). Given its support role in this package, this script should not introduce any other dependencies. As a result, I wrote the script in Python 2, since every Linux currently ships with 2.4--2.7 as its system Python (RHEL 5, still popular in my field, ships with 2.4). However, I've heard news that Ubuntu is migrating to Python 3 soon (next release??), and that's a platform we actively try to support due to its popularity. I've tried writing the code to support both 2 and 3 as much as possible, but with priority put on supporting 2.4 over 3. Now that Python 3-compatibility is about to become more important, I'm looking for a way to catch and store exceptions in a compatible way. Because Python 2.4 and 2.5 don't support the except Exception as err: syntax, I've used except Exception, err: Is there any way of getting this effect in a way compatible with Py2.4 and 3.x? Of course I could duplicate every module with 2to3 and do sys.version_info-conditional imports, but I'd rather avoid duplicating all of the code if possible. Any suggestions are appreciated. Thanks! Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032 -------------- next part -------------- An HTML attachment was scrubbed... URL: From drsalists at gmail.com Sun Jun 2 12:41:34 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Sun, 2 Jun 2013 09:41:34 -0700 Subject: Python 2-3 compatibility In-Reply-To: References: Message-ID: From http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/Python%202%20and%203.pdf: Try/Except: both 2.x and 3.x try: print(1/0) except ZeroDivisionError: extra = sys.exc_info()[1] print('oops') HTH On Sun, Jun 2, 2013 at 7:13 AM, Jason Swails wrote: > Hello Everyone, > > I have a Python script that I wrote to support a project that I work on > (that runs primarily on Unix OSes). Given its support role in this > package, this script should not introduce any other dependencies. As a > result, I wrote the script in Python 2, since every Linux currently ships > with 2.4--2.7 as its system Python (RHEL 5, still popular in my field, > ships with 2.4). > > However, I've heard news that Ubuntu is migrating to Python 3 soon (next > release??), and that's a platform we actively try to support due to its > popularity. I've tried writing the code to support both 2 and 3 as much as > possible, but with priority put on supporting 2.4 over 3. > > Now that Python 3-compatibility is about to become more important, I'm > looking for a way to catch and store exceptions in a compatible way. > > Because Python 2.4 and 2.5 don't support the > > except Exception as err: > > syntax, I've used > > except Exception, err: > > Is there any way of getting this effect in a way compatible with Py2.4 and > 3.x? Of course I could duplicate every module with 2to3 and do > sys.version_info-conditional imports, but I'd rather avoid duplicating all > of the code if possible. > > Any suggestions are appreciated. > > Thanks! > Jason > > -- > Jason M. Swails > Quantum Theory Project, > University of Florida > Ph.D. Candidate > 352-392-4032 > > -- > http://mail.python.org/mailman/listinfo/python-list > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Sun Jun 2 12:51:19 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Sun, 02 Jun 2013 12:51:19 -0400 Subject: Python 2-3 compatibility In-Reply-To: References: Message-ID: <51AB7807.9010207@udel.edu> On 6/2/2013 10:13 AM, Jason Swails wrote: > Because Python 2.4 and 2.5 don't support the > > except Exception as err: > > syntax, I've used > > except Exception, err: > > Is there any way of getting this effect in a way compatible with Py2.4 > and 3.x? Don't do either. Just catch the exception with 'except Exception:' and access the details in the body. I googled 'python 2 to 3 exceptions' and the second hit is http://python3porting.com/noconv.html which covers what you are doing ;-). From that page "If you need to support Python versions lower than Python 2.6 and you need access to the exception that was raised, you can get that in all versions through the exc_info() function: >>> import sys >>> try: ... a = 1/'0' ... except (ZeroDivisionError, TypeError): ... e = sys.exc_info()[1] ... print(e.args[0]) unsupported operand type(s) for /: 'int' and 'str' " There are more tips on that page, a reference to the six module, and more hits on the search page. Good luck. You are not the first to support the same range of versions (and for the same reasons). -- Terry Jan Reedy From rantingrickjohnson at gmail.com Sun Jun 2 13:04:00 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 2 Jun 2013 10:04:00 -0700 (PDT) Subject: PyWart: The problem with "print" Message-ID: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Note to those of you who may be new to Python: I will refer to "print" as a function -- just be aware that "print" was a statement before Python3000 was introduced. ------------------------------------------------------------ Introduction: ------------------------------------------------------------ Many languages provide a function, method, or statement by which users can write easily to stdout, and Python is no exception with it's own "print" function. However, whilst writing to stdout via "print" is slightly less verbose than calling the "write" method of "sys.stdout", we don't really gain much from this function except a few keystrokes... is this ALL print should be? A mere syntactical sugar? For me, i think the "print" function CAN and SHOULD be so much more! ------------------------------------------------------------ Print's Role in Debugging: ------------------------------------------------------------ A print function can be helpful in many ways, and one very important role print plays is to inform the programmer of internal states of objects via debug messages written to stdout. Sure, there are fancy debuggers by which internal state and object identity can be inspected on the fly, however, "print" is always going to be there no matter what libraries or add-on you have available. And let's face it folks, print is the most simplistic and intuitive interface you'll ever find for debugging purposes. Sure, "print" may not be the most productive for large scale debugging, but for the majority of debugging tasks, it's a good fit. I know some of you will cringe at the idea of using print for debugging, however, i will argue that using a debugger can weaken your detective skills. If an exception message and trackback are not giving you enough information to find the bug, well then, the language OR the code you've written is not worth a monkey's toss! I've found that many subtle bugs are caused by not limiting the inputs to sane values (or types). And with Python's duct typing and implicit casting to Boolean, you end up with all sorts of misleading things happening! Maybe you're testing for truth values and get a string instead; which screws everything up!!! Anyhoo, i digress... ------------------------------------------------------------ Inadequacies of "print" Debugging. ------------------------------------------------------------ In it's current implementation, print is helpful, but in many ways, print is lacking it's true potential. Many of the problems that propagate up when using print as a debugger focus on the fact that you cannot easily switch the debug messages "on" or "off". Sure, you can comment-out all calls to print, but if you need to see the messages again you will be forced to uncomment all the lines again... hey that's no fun! A "wise programmer" may think he's solved the problem by writing a function called "debugprint" that looks like this: def debugprint(*args): if DEBUG == True: print(*args) However that solution is at best woefully inadequate and at worse a cycle burner! * Woefully inadequate because: Switching on or off the debug messages is only valid in the current module that the function was imported. What if you want to kill all debugprint messages EVERYWHERE? Do you really want to edit "debug = BOOLEAN" in every source file OR do something stupid like import debugprint and edit the DEBUG constant OR even dumber, edit the debugprint source code? GAWD NO! * But even if you are willing to cope with all the "switch- on-and-off" nonsense, are you willing to have you code slowed by numerous calls to a dead function containing a comparison that will always be false? ## START INTERACTIVE SESSION ## py> from __future__ import print_function py> DEBUG = True py> def debugprint(*args): ... if not DEBUG: ... return ... print(*args) py> debugprint("foo", "bar") foo bar py> DEBUG = False py> code = compile('debugprint("foo", "bar")', '', 'exec') py> import dis py> dis.disassemble(code) 1 0 LOAD_NAME 0 (debugprint) 3 LOAD_CONST 0 ('foo') 6 LOAD_CONST 1 ('bar') 9 CALL_FUNCTION 2 12 POP_TOP 13 LOAD_CONST 2 (None) 16 RETURN_VALUE ## END INTERACTIVE SESSION ## After a few million executions of this superfluous comparison your cpu is losing faith in your ability to write logical code! py> function.call() + false_comparison() == 'cycle burner' "YOU BET YOU A$$ IT DOES!!" ------------------------------------------------------------ Solution. ------------------------------------------------------------ This realization has brought me to the conclusion that Python (and other languages) need a "scoped print function". What is a "scoped print function" anyway? Well what i am proposing is that Python include the following "debug switches" in the language: ------------------------------ Switch: "__GLOBALDEBUG__" ------------------------------ Global switching allows a programmer to instruct the interpreter to IGNORE all print functions or to EVALUATE all print functions by assigning a Boolean value of True or False respectively to the global switch (Note: global switch always defaults to True!). Any script that includes the assignment "__GLOBALDEBUG__ = False" will disable ALL debug print messages across the entire interpreter namespace. In effect, all print statements will be treated as comments and ignored by the interpreter. No dead functions will be called and no false comparisons will be made! (Note: __GLOBALDEBUG__ should not be available in any local namespace but accessed only form the topmost namespace. Something like: __main__.__GLOBALDEBUG__ = Boolean ------------------------------ Switch: "__LOCALDEBUG__" ------------------------------ Local switching allows a programmer to turn on (or off) debug messages in the module it was declared. Not sure if this should be more specific than modules; like classes, blocks, or functions??? Of course this declaration will be overridden by any global switch. ------------------------------------------------------------ Concerns: ------------------------------------------------------------ My only concern is that some programmers may be confused why their print calls are not working and may not have the capacity to resolve that function named "print" is tied to the global and local switches named "__GLOBAL_DEBUG__" and "__LOCAL_DEBUG__". To prevent any cognitive dissonance it may be desirable to introduce a new function called "debugprint". *school-bell-rings* From rosuav at gmail.com Sun Jun 2 13:20:52 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 03:20:52 +1000 Subject: PyWart: The problem with "print" In-Reply-To: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson wrote: > * Woefully inadequate because: Switching on or off the debug > messages is only valid in the current module that the > function was imported. What if you want to kill all > debugprint messages EVERYWHERE? Do you really want to edit > "debug = BOOLEAN" in every source file OR do something > stupid like import debugprint and edit the DEBUG constant > OR even dumber, edit the debugprint source code? GAWD NO! Easy fix to this one. Instead of copying and pasting debugprint into everything, have it in a module and import it everywhere. Then the debug flag will be common to them all. Oh, and you probably want to add **kwargs to debugprint, because the print function does a lot more than sys.stdout.write does: >>> print(1,2,3,4,sep='#') 1#2#3#4 > * But even if you are willing to cope with all the "switch- > on-and-off" nonsense, are you willing to have you code > slowed by numerous calls to a dead function containing a > comparison that will always be false? Hmm. Could be costly. Hey, you know, Python has something for testing that. >>> timeit.timeit('debugprint("asdf")','def debugprint(*args):\n\tif not DEBUG: return\n\tprint(*args)\nDEBUG=False',number=1000000) 0.5838018519113444 That's roughly half a second for a million calls to debugprint(). That's a 580ns cost per call. Rather than fiddle with the language, I'd rather just take this cost. Oh, and there's another way, too: If you make the DEBUG flag have effect only on startup, you could write your module thus: if DEBUG: debugprint=print else: def debugprint(*args,**kwargs): pass So you can eliminate part of the cost there, if it matters to you. If a half-microsecond cost is going to be significant to you, you probably should be looking at improving other areas, maybe using ctypes/cython, or possibly playing with the new preprocessor tricks that have been being discussed recently. There's really no need to change the language to solve one specific instance of this "problem". ChrisA From jason.swails at gmail.com Sun Jun 2 20:16:21 2013 From: jason.swails at gmail.com (Jason Swails) Date: Sun, 2 Jun 2013 20:16:21 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Sun, Jun 2, 2013 at 1:20 PM, Chris Angelico wrote: > > Hmm. Could be costly. Hey, you know, Python has something for testing that. > > >>> timeit.timeit('debugprint("asdf")','def debugprint(*args):\n\tif not > DEBUG: return\n\tprint(*args)\nDEBUG=False',number=1000000) > 0.5838018519113444 > > That's roughly half a second for a million calls to debugprint(). > That's a 580ns cost per call. Rather than fiddle with the language, > I'd rather just take this cost. Oh, and there's another way, too: If > you make the DEBUG flag have effect only on startup, you could write > your module thus: > This is a slightly contrived demonstration... The time lost in a function call is not just the time it takes to execute that function. If it consistently increases the frequency of cache misses then the cost is much greater -- possibly by orders of magnitude if the application is truly bound by the bandwidth of the memory bus and the CPU pipeline is almost always saturated. I'm actually with RR in terms of eliminating the overhead involved with 'dead' function calls, since there are instances when optimizing in Python is desirable. I actually recently adjusted one of my own scripts to eliminate branching and improve data layout to achieve a 1000-fold improvement in efficiency (~45 minutes to 0.42 s. for one example) --- all in pure Python. The first approach was unacceptable, the second is fine. For comparison, if I add a 'deactivated' debugprint call into the inner loop (executed 243K times in this particular test), then the time of the double-loop step that I optimized takes 0.73 seconds (nearly doubling the duration of the whole step). The whole program is too large to post here, but the relevant code portion is shown below: i = 0 begin = time.time() for mol in owner: for atm in mol: blankfunc("Print i %d" % i) new_atoms[i] = self.atom_list[atm] i += 1 self.atom_list = new_atoms print "Done in %f seconds." % (time.time() - begin) from another module: DEBUG = False [snip] def blankfunc(instring): if DEBUG: print instring Also, you're often not passing a constant literal to the debug print -- you're doing some type of string formatting or substitution if you're really inspecting the value of a particular variable, and this also takes time. In the test I gave the timings for above, I passed a string the counter substituted to the 'dead' debug function. Copy-and-pasting your timeit experiment on my machine yields different timings (Python 2.7): >>> import sys >>> timeit.timeit('debugprint("asdf")','def debugprint(*args):\n\tif not DEBUG: return\n\tsys.stdout.write(*args)\nDEBUG=False',number=1000000) 0.15644001960754395 which is ~150 ns/function call, versus ~1300 ns/function call. And there may be even more extreme examples, this is just one I was able to cook up quickly. This is, I'm sad to say, where my alignment with RR ends. While I use prints in debugging all the time, it can also become a 'crutch', just like reliance on valgrind or gdb. If you don't believe me, you've never hit a bug that 'magically' disappears when you add a debugging print statement ;-). The easiest way to eliminate these 'dead' calls is to simply comment-out the print call, but I would be quite upset if the interpreter tried to outsmart me and do it automagically as RR seems to be suggesting. And if you're actually debugging, then you typically only add a few targeted print statements -- not too hard to comment-out. If it is, and you're really that lazy, then by all means add a new, greppable function call and use a sed command to comment those lines out for you. BTW: *you* in the above message refers to a generic person -- none of my comments were aimed at anybody in particular All the best, Jason P.S. All that said, I would agree with ChrisA's suggestion that the overhead is negligible is most cases... -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Sun Jun 2 22:02:44 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 12:02:44 +1000 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 10:16 AM, Jason Swails wrote: > Copy-and-pasting your timeit experiment on my machine yields different > timings (Python 2.7): > >>>> import sys >>>> timeit.timeit('debugprint("asdf")','def debugprint(*args):\n\tif not >>>> DEBUG: return\n\tsys.stdout.write(*args)\nDEBUG=False',number=1000000) > 0.15644001960754395 > > which is ~150 ns/function call, versus ~1300 ns/function call. And there > may be even more extreme examples, this is just one I was able to cook up > quickly. The exact time will of course vary enormously. My point still would stand at 1300ns; it's still extremely low compared to many other overheads. > This is, I'm sad to say, where my alignment with RR ends. While I use > prints in debugging all the time, it can also become a 'crutch', just like > reliance on valgrind or gdb. If you don't believe me, you've never hit a > bug that 'magically' disappears when you add a debugging print statement > ;-). Yes, I've had situations like that. They are, however, EXTREMELY rare compared to the times when a bug magically becomes shallow when you add a debugging print! > The easiest way to eliminate these 'dead' calls is to simply comment-out the > print call, but I would be quite upset if the interpreter tried to outsmart > me and do it automagically as RR seems to be suggesting. And if you're > actually debugging, then you typically only add a few targeted print > statements -- not too hard to comment-out. If it is, and you're really that > lazy, then by all means add a new, greppable function call and use a sed > command to comment those lines out for you. Yes. I also have high hopes for some of the cool AST manipulation that's being developed at the moment; it should be relatively easy to have a simple flag that controls whether debugprint (btw, I'd shorten the name) represents code or no-code. But consider all the other things that you probably do in your Python programs. Every time you reference something as "module.name", you require a lookup into the current module's namespace to find the module name, then into that module's namespace to find the object you want. Snagging names as locals is a common optimization, but is far from universally applied. Why? Because the readability cost just isn't worth it. We use Python because it is "fast enough", not because it lets us squeeze every CPU cycle out of the code. That said, I can often smoke Python with Pike, thanks to a few rather cool optimizations (including looking up module names at compile time, which reduces what I just said above). Maybe in the future some of these optimizations will be done, I don't know. But for 99.9% of Python scripts, you will *never* see the performance difference. ChrisA From ian.g.kelly at gmail.com Mon Jun 3 13:12:05 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Mon, 3 Jun 2013 11:12:05 -0600 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails wrote: > I'm actually with RR in terms of eliminating the overhead involved with > 'dead' function calls, since there are instances when optimizing in Python > is desirable. I actually recently adjusted one of my own scripts to > eliminate branching and improve data layout to achieve a 1000-fold > improvement in efficiency (~45 minutes to 0.42 s. for one example) --- all > in pure Python. The first approach was unacceptable, the second is fine. > For comparison, if I add a 'deactivated' debugprint call into the inner loop > (executed 243K times in this particular test), then the time of the > double-loop step that I optimized takes 0.73 seconds (nearly doubling the > duration of the whole step). It seems to me that your problem here wasn't that the time needed for the deactivated debugprint was too great. Your problem was that a debugprint that executes 243K times in 0.73 seconds is going to generate far too much output to be useful, and it had no business being there in the first place. *Reasonably* placed debugprints are generally not going to be a significant time-sink for the application when disabled. > The easiest way to eliminate these 'dead' calls is to simply comment-out the > print call, but I would be quite upset if the interpreter tried to outsmart > me and do it automagically as RR seems to be suggesting. Indeed, the print function is for general output, not specifically for debugging. If you have the global print deactivation that RR is suggesting, then what you have is no longer a print function, but a misnamed debug function. From jason.swails at gmail.com Mon Jun 3 15:09:48 2013 From: jason.swails at gmail.com (Jason Swails) Date: Mon, 3 Jun 2013 15:09:48 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 1:12 PM, Ian Kelly wrote: > On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails > wrote: > > I'm actually with RR in terms of eliminating the overhead involved with > > 'dead' function calls, since there are instances when optimizing in > Python > > is desirable. I actually recently adjusted one of my own scripts to > > eliminate branching and improve data layout to achieve a 1000-fold > > improvement in efficiency (~45 minutes to 0.42 s. for one example) --- > all > > in pure Python. The first approach was unacceptable, the second is fine. > > For comparison, if I add a 'deactivated' debugprint call into the inner > loop > > (executed 243K times in this particular test), then the time of the > > double-loop step that I optimized takes 0.73 seconds (nearly doubling the > > duration of the whole step). > > It seems to me that your problem here wasn't that the time needed for > the deactivated debugprint was too great. Your problem was that a > debugprint that executes 243K times in 0.73 seconds is going to > generate far too much output to be useful, and it had no business > being there in the first place. *Reasonably* placed debugprints are > generally not going to be a significant time-sink for the application > when disabled. Well in 'debug' mode I wouldn't use an example that executed the loop 200K times -- I'd find one that executed a manageable couple dozen, maybe. When 'disabled,' the print statement won't do anything except consume clock cycles and potentially displace useful cache (the latter being the more harmful, since most applications are bound by the memory bus). It's better to eliminate this dead call when you're not in 'debugging' mode. (When active, it certainly would've taken more than 0.73 seconds) Admittedly such loops should be tight enough that debugging statements inside the inner loop are generally unnecessary, but perhaps not always. But unlike RR, who suggests some elaborate interpreter-wide, ambiguous ignore-rule to squash out all of these functions, I'm simply suggesting that sometimes it's worth commenting-out debug print calls instead of 'just leaving them there because you won't notice the cost' :). > The easiest way to eliminate these 'dead' calls is to simply comment-out > the > > print call, but I would be quite upset if the interpreter tried to > outsmart > > me and do it automagically as RR seems to be suggesting. > > Indeed, the print function is for general output, not specifically for > debugging. If you have the global print deactivation that RR is > suggesting, then what you have is no longer a print function, but a > misnamed debug function. > Exactly. I was just trying to make the point that it is -occasionally- worth spending the time to comment-out certain debug calls rather than leaving 'dead' function calls in certain places. All the best, Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jason.swails at gmail.com Mon Jun 3 15:10:52 2013 From: jason.swails at gmail.com (Jason Swails) Date: Mon, 3 Jun 2013 15:10:52 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 1:12 PM, Ian Kelly wrote: > On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails > wrote: > > I'm actually with RR in terms of eliminating the overhead involved with > > 'dead' function calls, since there are instances when optimizing in > Python > > is desirable. I actually recently adjusted one of my own scripts to > > eliminate branching and improve data layout to achieve a 1000-fold > > improvement in efficiency (~45 minutes to 0.42 s. for one example) --- > all > > in pure Python. The first approach was unacceptable, the second is fine. > > For comparison, if I add a 'deactivated' debugprint call into the inner > loop > > (executed 243K times in this particular test), then the time of the > > double-loop step that I optimized takes 0.73 seconds (nearly doubling the > > duration of the whole step). > > It seems to me that your problem here wasn't that the time needed for > the deactivated debugprint was too great. Your problem was that a > debugprint that executes 243K times in 0.73 seconds is going to > generate far too much output to be useful, and it had no business > being there in the first place. *Reasonably* placed debugprints are > generally not going to be a significant time-sink for the application > when disabled. Well in 'debug' mode I wouldn't use an example that executed the loop 200K times -- I'd find one that executed a manageable couple dozen, maybe. When 'disabled,' the print statement won't do anything except consume clock cycles and potentially displace useful cache (the latter being the more harmful, since most applications are bound by the memory bus). It's better to eliminate this dead call when you're not in 'debugging' mode. Admittedly such loops should be tight enough that debugging statements inside the inner loop are generally unnecessary, but perhaps not always. But unlike RR, who suggests some elaborate interpreter-wide, ambiguous ignore-rule to squash out all of these functions, I'm simply suggesting that sometimes it's worth commenting-out debug print calls instead of 'just leaving them there because you won't notice the cost' :). > The easiest way to eliminate these 'dead' calls is to simply comment-out > the > > print call, but I would be quite upset if the interpreter tried to > outsmart > > me and do it automagically as RR seems to be suggesting. > > Indeed, the print function is for general output, not specifically for > debugging. If you have the global print deactivation that RR is > suggesting, then what you have is no longer a print function, but a > misnamed debug function. > Exactly. I was just trying to make the point that it is -occasionally- worth spending the time to comment-out certain debug calls rather than leaving 'dead' function calls in certain places. All the best, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From jason.swails at gmail.com Mon Jun 3 15:11:49 2013 From: jason.swails at gmail.com (Jason Swails) Date: Mon, 3 Jun 2013 15:11:49 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: ack, sorry for the double-post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve+comp.lang.python at pearwood.info Mon Jun 3 16:31:37 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 20:31:37 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51acfd28$0$29966$c3e8da3$5496439d@news.astraweb.com> On Mon, 03 Jun 2013 15:09:48 -0400, Jason Swails wrote: > But unlike RR, who suggests some elaborate interpreter-wide, ambiguous > ignore-rule to squash out all of these functions, I'm simply suggesting > that sometimes it's worth commenting-out debug print calls instead of > 'just leaving them there because you won't notice the cost' :). +1 Further to this idea, many command line apps have a "verbose" mode, where they print status messages as the app runs. Some of these include multiple levels, so you can tune just how many messages you get, commonly: - critical messages only - important or critical messages - warnings, important or critical messages - status, warnings, important or critical messages - all of the above, plus debugging messages - all of the above, plus even more debugging messages Since this verbosity level is selectable at runtime, the code itself must include many, many calls to some equivalent to print, enough calls to print to cover the most verbose case, even though most of the time most such calls just return without printing. This is a feature. And like all features, it has a cost. If (generic) your application does not benefit from verbose print statements scattered all throughout it, *don't put them in*. But if it will, then there is a certain amount of overhead to this feature. Deal with it, either by accepting the cost, or by writing more code that trades off complexity for efficiency. It's 2013, not 1975, and computers have more than 32K of RAM and the slowest CPU on the market is a million times faster than the ones that took us to the moon, and quite frankly I have no sympathy for the view that CPU cycles are so precious that we mustn't waste them. If that were the case, Python is the wrong language. -- Steven From rosuav at gmail.com Mon Jun 3 16:44:11 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 06:44:11 +1000 Subject: PyWart: The problem with "print" In-Reply-To: <51acfd28$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51acfd28$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Tue, Jun 4, 2013 at 6:31 AM, Steven D'Aprano wrote: > ... quite frankly I have no sympathy for > the view that CPU cycles are so precious that we mustn't waste them. If > that were the case, Python is the wrong language. CPU cycles *are* valuable still, though. The efficiency of your code determines how well it scales - but we have to be talking 100tps vs 1000tps here. There needs to be a huge difference for it to be at all significant. ChrisA From dan at tombstonezero.net Sun Jun 2 23:10:38 2013 From: dan at tombstonezero.net (Dan Sommers) Date: Mon, 03 Jun 2013 03:10:38 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: > ... If you don't believe me, you've never hit a bug that 'magically' > disappears when you add a debugging print statement ;-). Ah, yes. The Heisenbug. ;-) We used to run into those back in the days of C and assembly language. They're much harder to see in the wild with Python. From jason.swails at gmail.com Sun Jun 2 23:23:42 2013 From: jason.swails at gmail.com (Jason Swails) Date: Sun, 2 Jun 2013 23:23:42 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Sun, Jun 2, 2013 at 11:10 PM, Dan Sommers wrote: > On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: > > > ... If you don't believe me, you've never hit a bug that 'magically' > > disappears when you add a debugging print statement ;-). > > Ah, yes. The Heisenbug. ;-) > Indeed. Being in the field of computational chemistry/physics, I was almost happy to have found one just to say I was hunting a Heisenbug. It seems to be a term geared more toward the physics-oriented programming crowd. > We used to run into those back in the days of C and assembly langua > > ge. > > They're much harder to see in the wild with Python. > > Yea, I've only run into Heisenbugs with Fortran or C/C++. Every time I've seen one it's been due to an uninitialized variable somewhere -- something valgrind is quite good at pinpointing. (And yes, a good portion of our code is -still- in Fortran -- but at least it's F90+ :). -------------- next part -------------- An HTML attachment was scrubbed... URL: From timothy.c.delaney at gmail.com Sun Jun 2 23:37:27 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Mon, 3 Jun 2013 13:37:27 +1000 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On 3 June 2013 13:23, Jason Swails wrote: > Yea, I've only run into Heisenbugs with Fortran or C/C++. Every time I've > seen one it's been due to an uninitialized variable somewhere -- something > valgrind is quite good at pinpointing. (And yes, a good portion of our > code is -still- in Fortran -- but at least it's F90+ :). > With the increase in use of higher-level languages, these days Heisenbugs most often appear with multithreaded code that doesn't properly protect critical sections, but as you say, with lower-level languages uninitialised memory is a common source of them. I had a fun one once (in C++, but could have happened in any language) where a semaphore was being acquired twice on the one thread. There were 10 semaphore slots available, and very occasionally the timings would result in one of the threads deadlocking. Fortunately, by reducing to a single thread + single semaphore slot I was able to turn it from a Heisenbug to a 100% replicable bug. Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan at tombstonezero.net Mon Jun 3 00:34:35 2013 From: dan at tombstonezero.net (Dan Sommers) Date: Mon, 03 Jun 2013 04:34:35 GMT Subject: Python Heisenbugs? (was: Re: PyWart: The problem with "print") References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, 03 Jun 2013 13:37:27 +1000, Tim Delaney wrote: > With the increase in use of higher-level languages, these days > Heisenbugs most often appear with multithreaded code that doesn't > properly protect critical sections, but as you say, with lower-level > languages uninitialised memory is a common source of them. Aside from an I/O caching bug directly affected by calling print or somefile.write (where somefile is stdout), how else could I create a Heisenbug in pure Python? To bring this thread back around full circle: I suppose that if I had a local function called print, and decided that I needed some debugging output, I could be in for a surprise; or a local module called logging, and decided to use the logging module instead of calling print directly. From rosuav at gmail.com Mon Jun 3 01:05:53 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 15:05:53 +1000 Subject: Python Heisenbugs? (was: Re: PyWart: The problem with "print") In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 2:34 PM, Dan Sommers wrote: > On Mon, 03 Jun 2013 13:37:27 +1000, Tim Delaney wrote: > >> With the increase in use of higher-level languages, these days >> Heisenbugs most often appear with multithreaded code that doesn't >> properly protect critical sections, but as you say, with lower-level >> languages uninitialised memory is a common source of them. > > Aside from an I/O caching bug directly affected by calling print or > somefile.write (where somefile is stdout), how else could I create a > Heisenbug in pure Python? If you have a @property, merely retrieving it could affect things. It shouldn't happen, but bugs can be anywhere. Basically, ANY Python code can trigger ANY Python code. ChrisA From jeanpierreda at gmail.com Mon Jun 3 03:06:01 2013 From: jeanpierreda at gmail.com (Devin Jeanpierre) Date: Mon, 3 Jun 2013 03:06:01 -0400 Subject: Python Heisenbugs? (was: Re: PyWart: The problem with "print") In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 12:34 AM, Dan Sommers wrote: > On Mon, 03 Jun 2013 13:37:27 +1000, Tim Delaney wrote: > >> With the increase in use of higher-level languages, these days >> Heisenbugs most often appear with multithreaded code that doesn't >> properly protect critical sections, but as you say, with lower-level >> languages uninitialised memory is a common source of them. > > Aside from an I/O caching bug directly affected by calling print or > somefile.write (where somefile is stdout), how else could I create a > Heisenbug in pure Python? The garbage collector can do this, but I think in practice it's ridiculously rare, since __del__ is almost never useful due to its unreliability*. The problem is that the garbage collector can do whatever it wants. For example, in CPython it is called after so many cycles have been created. This allows code and user actions to inadvertently affect the garbage collector, and therefore, the invocation of __del__. If your __del__ does anything that accesses mutable global state also used elsewhere, it's conceivable that the order of someone else's access and __del__'s invocation depends on the GC. One order or the other might be the wrong one which causes a failure. As it happens, the "bt" command in pdb creates a cycle and might trigger the garbage collector, causing __del__ to run immediately, and potentially hiding the failure. This isn't really "pure python" in that Python doesn't even guarantee __del__ is ever called at all, let alone why. It's completely implementation-specific, and not a property of Python the language. -- Devin .. [*] Some people use it as an "unreliable fallback"; this turns their magical autosaving code into an attractive and yet horribly dangerous nuisance. Friends don't let friends use __del__. From dan at tombstonezero.net Mon Jun 3 00:20:54 2013 From: dan at tombstonezero.net (Dan Sommers) Date: Mon, 03 Jun 2013 04:20:54 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Sun, 02 Jun 2013 23:23:42 -0400, Jason Swails wrote: > On Sun, Jun 2, 2013 at 11:10 PM, Dan Sommers > wrote: >> Ah, yes. The Heisenbug. ;-) > > Indeed. Being in the field of computational chemistry/physics, I was > almost happy to have found one just to say I was hunting a Heisenbug. > It seems to be a term geared more toward the physics-oriented > programming crowd. I'd been using the word Heisenbug for years with only a pop-culture clue as to what it meant. Many years later, I went to college, studied physics (and math), and had one self-study semester of computational physics on my way to my undergraduate degree. After a career in software development, including a few years in the financial industry, with lots of floating point economic models, I must say that it was very enlightening. >> They're much harder to see in the wild with Python. > > Yea, I've only run into Heisenbugs with Fortran or C/C++. Every time > I've seen one it's been due to an uninitialized variable somewhere -- > something valgrind is quite good at pinpointing ... Uninitialized variables and off-by-one pointer operations. Little can screw up a calculation like mistaking a stack frame link for a floating point number. :-) > ... (And yes, a good portion of our code is -still- in Fortran -- but > at least it's F90+ :). I am a huge proponent of using the right tool for the job. There is nothing wrong with some well-placed FORTRAN, as long as the PSF From robert.kern at gmail.com Mon Jun 3 06:52:14 2013 From: robert.kern at gmail.com (Robert Kern) Date: Mon, 03 Jun 2013 11:52:14 +0100 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On 2013-06-03 05:20, Dan Sommers wrote: > On Sun, 02 Jun 2013 23:23:42 -0400, Jason Swails wrote: >> ... (And yes, a good portion of our code is -still- in Fortran -- but >> at least it's F90+ :). > > I am a huge proponent of using the right tool for the job. There is > nothing wrong with some well-placed FORTRAN, as long as the PSF No, no. It's the PSU that you have to worrNO CARRIER From breamoreboy at yahoo.co.uk Mon Jun 3 04:49:40 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Mon, 03 Jun 2013 09:49:40 +0100 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On 03/06/2013 04:10, Dan Sommers wrote: > On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: > >> ... If you don't believe me, you've never hit a bug that 'magically' >> disappears when you add a debugging print statement ;-). > > Ah, yes. The Heisenbug. ;-) > > We used to run into those back in the days of C and assembly language. > They're much harder to see in the wild with Python. > Strikes me it's a bit like problems when prototyping circuit boards. The card doesn't work, so you mount it on an extender card, problem goes away, remove extender card, problem reappears. Wash, rinse, repeat :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From davea at davea.name Mon Jun 3 08:56:57 2013 From: davea at davea.name (Dave Angel) Date: Mon, 03 Jun 2013 08:56:57 -0400 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51AC9299.9030502@davea.name> On 06/03/2013 04:49 AM, Mark Lawrence wrote: > On 03/06/2013 04:10, Dan Sommers wrote: >> On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: >> >>> ... If you don't believe me, you've never hit a bug that 'magically' >>> disappears when you add a debugging print statement ;-). >> >> Ah, yes. The Heisenbug. ;-) >> >> We used to run into those back in the days of C and assembly language. >> They're much harder to see in the wild with Python. >> > > Strikes me it's a bit like problems when prototyping circuit boards. The > card doesn't work, so you mount it on an extender card, problem goes > away, remove extender card, problem reappears. Wash, rinse, repeat :) > That's when you use a little kappy-zapper spray. -- DaveA From robotsondrugs at gmail.com Sun Jun 2 13:30:23 2013 From: robotsondrugs at gmail.com (Andrew Berg) Date: Sun, 02 Jun 2013 12:30:23 -0500 Subject: PyWart: The problem with "print" In-Reply-To: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51AB812F.9050703@gmail.com> I don't think you go far enough. Obviously we need way more flexibility. A simple on/off is okay for some things, but a finer granularity would be really helpful because some things are more important than others. And why stop at stdout/stderr? We need to add a consistent way to output these messages to files too in case we need to reference them again. The messages should have a consistent format as well. Why add the same information to each message when it would be much simpler to simply define a default format and insert the real meat of the message into it? It really seems like we should already have something like this. Hmm..... -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 From rosuav at gmail.com Sun Jun 2 13:34:45 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 03:34:45 +1000 Subject: PyWart: The problem with "print" In-Reply-To: <51AB812F.9050703@gmail.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51AB812F.9050703@gmail.com> Message-ID: On Mon, Jun 3, 2013 at 3:30 AM, Andrew Berg wrote: > I don't think you go far enough. Obviously we need way more flexibility. A simple on/off is okay for some things, but a finer granularity > would be really helpful because some things are more important than others. And why stop at stdout/stderr? We need to add a consistent way > to output these messages to files too in case we need to reference them again. The messages should have a consistent format as well. Why add > the same information to each message when it would be much simpler to simply define a default format and insert the real meat of the message > into it? It really seems like we should already have something like this. Hmm..... You have a really good point there. I'm sure I could think of a really good way to do all this, but I'm stuck... it's like there's a log jam in my head... (Okay, maybe I should go to bed now, my puns are getting worse. Considering how late it is, I'll probably sleep like a log.) ChrisA From dan at tombstonezero.net Sun Jun 2 13:49:02 2013 From: dan at tombstonezero.net (Dan Sommers) Date: Sun, 02 Jun 2013 17:49:02 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson > wrote: >> * Woefully inadequate because: Switching on or off the debug >> messages is only valid in the current module that the function was >> imported. What if you want to kill all debugprint messages >> EVERYWHERE? Do you really want to edit "debug = BOOLEAN" in every >> source file OR do something stupid like import debugprint and edit >> the DEBUG constant OR even dumber, edit the debugprint source >> code? GAWD NO! > > Easy fix to this one. Instead of copying and pasting debugprint into > everything, have it in a module and import it everywhere. Then the > debug flag will be common to them all. Or use the logging module. It's easy to get going quickly (just call logging.basicConfig at startup time), and with a little care and feeding, you can control the output in more ways than can fit into the margin. Oh, yeah, I'm sure it introduces some overhead. So does everything else. >> * But even if you are willing to cope with all the "switch- >> on-and-off" nonsense, are you willing to have you code slowed by >> numerous calls to a dead function containing a comparison that >> will always be false? > > Hmm. Could be costly ... Yeah, all that time that I have left over and have to find something else to do instead of debugging my program. What a waste! ;-) Dan From rantingrickjohnson at gmail.com Sun Jun 2 14:18:54 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 2 Jun 2013 11:18:54 -0700 (PDT) Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: > On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: > > On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson > [...] > Or use the logging module. It's easy to get going quickly > (just call logging.basicConfig at startup time), and with > a little care and feeding, you can control the output in > more ways than can fit into the margin. Oh, yeah, I'm sure > it introduces some overhead. So does everything else. I hate log files, at least during development or testing. I prefer to debug on the command line or using my IDE. Log files are for release time, not development. From ned at nedbatchelder.com Sun Jun 2 16:45:40 2013 From: ned at nedbatchelder.com (Ned Batchelder) Date: Sun, 02 Jun 2013 16:45:40 -0400 Subject: PyWart: The problem with "print" In-Reply-To: <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> Message-ID: <51ABAEF4.8020205@nedbatchelder.com> On 6/2/2013 2:18 PM, Rick Johnson wrote: > On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: >> On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: >>> On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson >> [...] >> Or use the logging module. It's easy to get going quickly >> (just call logging.basicConfig at startup time), and with >> a little care and feeding, you can control the output in >> more ways than can fit into the margin. Oh, yeah, I'm sure >> it introduces some overhead. So does everything else. > I hate log files, at least during development or testing. I prefer to debug on the command line or using my IDE. Log files are for release time, not development. > Rick, you should give the logging module a try. The default configuration from basicConfig is that the messages all go to stderr, so no log files to deal with. And it's configurable in the ways you want, plus a lot more. --Ned. From torriem at gmail.com Mon Jun 3 01:49:28 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 02 Jun 2013 23:49:28 -0600 Subject: PyWart: The problem with "print" In-Reply-To: <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> Message-ID: <51AC2E68.4050507@gmail.com> On 06/02/2013 12:18 PM, Rick Johnson wrote: > On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: >> On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: >>> On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson >> [...] Or use the logging module. It's easy to get going quickly >> (just call logging.basicConfig at startup time), and with a little >> care and feeding, you can control the output in more ways than can >> fit into the margin. Oh, yeah, I'm sure it introduces some >> overhead. So does everything else. > > I hate log files, at least during development or testing. I prefer to > debug on the command line or using my IDE. Log files are for release > time, not development. Except that it's not. Have you even looked at what the logging module is? It most certainly can log to stderr if you provide no logging handler to write to a file. From rosuav at gmail.com Mon Jun 3 03:17:12 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 17:17:12 +1000 Subject: PyWart: The problem with "print" In-Reply-To: <51AC2E68.4050507@gmail.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> <51AC2E68.4050507@gmail.com> Message-ID: On Mon, Jun 3, 2013 at 3:49 PM, Michael Torrie wrote: > On 06/02/2013 12:18 PM, Rick Johnson wrote: >> On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: >>> On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: >>>> On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson >>> [...] Or use the logging module. It's easy to get going quickly >>> (just call logging.basicConfig at startup time), and with a little >>> care and feeding, you can control the output in more ways than can >>> fit into the margin. Oh, yeah, I'm sure it introduces some >>> overhead. So does everything else. >> >> I hate log files, at least during development or testing. I prefer to >> debug on the command line or using my IDE. Log files are for release >> time, not development. > > Except that it's not. Have you even looked at what the logging module > is? It most certainly can log to stderr if you provide no logging > handler to write to a file. Plus, writing to a file actually makes a lot of sense for development too. It's far easier to run the program the same way in dev and release, which often means daemonized. I like to have Upstart manage all my services, for instance. ChrisA From alister.ware at ntlworld.com Mon Jun 3 04:01:54 2013 From: alister.ware at ntlworld.com (Alister) Date: Mon, 03 Jun 2013 08:01:54 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <7fea8f79-830c-4d82-a899-eb2fcc1e6cdc@googlegroups.com> <51AC2E68.4050507@gmail.com> Message-ID: On Mon, 03 Jun 2013 17:17:12 +1000, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 3:49 PM, Michael Torrie > wrote: >> On 06/02/2013 12:18 PM, Rick Johnson wrote: >>> On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: >>>> On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: >>>>> On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson >>>> [...] Or use the logging module. It's easy to get going quickly >>>> (just call logging.basicConfig at startup time), and with a little >>>> care and feeding, you can control the output in more ways than can >>>> fit into the margin. Oh, yeah, I'm sure it introduces some overhead. >>>> So does everything else. >>> >>> I hate log files, at least during development or testing. I prefer to >>> debug on the command line or using my IDE. Log files are for release >>> time, not development. >> >> Except that it's not. Have you even looked at what the logging module >> is? It most certainly can log to stderr if you provide no logging >> handler to write to a file. > > Plus, writing to a file actually makes a lot of sense for development > too. It's far easier to run the program the same way in dev and release, > which often means daemonized. I like to have Upstart manage all my > services, for instance. > > ChrisA further point the production logging code needs to be implemented and tested at development time anyway so why not make use of it instead of creating additional redundant code? -- It is a lesson which all history teaches wise men, to put trust in ideas, and not in circumstances. -- Emerson From rantingrickjohnson at gmail.com Sun Jun 2 14:09:12 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 2 Jun 2013 11:09:12 -0700 (PDT) Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Jun 2, 12:20 pm, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson > > * Woefully inadequate because: Switching on or off the debug > > messages is only valid in the current module that the > > function was imported. What if you want to kill all > > debugprint messages EVERYWHERE? Do you really want to edit > > "debug = BOOLEAN" in every source file OR do something > > stupid like import debugprint and edit the DEBUG constant > > OR even dumber, edit the debugprint source code? GAWD NO! > Easy fix to this one. Instead of copying and pasting debugprint into > everything, have it in a module and import it everywhere. Then the > debug flag will be common to them all. Ignoring the fact that you have "import everywhere", what if you want to stop ALL debug messages? If you "import everywhere" to get them, you then have to "edit everywhere" to stop them. > Oh, and you probably want to add **kwargs to debugprint, because the > print function does a lot more than sys.stdout.write does: The kwargs to print are not germane to the issue, however noobs may be watching so glad you pointed that one out. > [...] > py> timeit.timeit('debugprint("asdf") [...] > 0.5838018519113444 > > That's roughly half a second for a million calls to debugprint(). > That's a 580ns cost per call. Rather than fiddle with the language, > I'd rather just take this cost. I never purposely inject ANY superfluous cycles in my code except in the case of testing or development. To me it's about professionalism. Let's consider a thought exercise shall we? Imagine your an auto mechanic. You customer brings in his car and asks you to make some repairs. You make the repairs but you also adjust the air/fuel ratio to run "rich" (meaning the vehicle will get less MPG). Do you still pat yourself on the back and consider you've done a professional job? I would not! However, you're doing the same thing as the mechanic when your code executes superflouos calls and burns cycles for no other reason than pure laziness. CPU's are not immortal you know, they have a lifetime. Maybe you don't care about destroying someone's CPU, however, i do! I just wonder how many of your "creations" (aka: monstrosities!) are burning cycles this very minute! > [...] > So you can eliminate part of the cost there, if it matters to you. If > a half-microsecond cost is going to be significant to you, you > probably should be looking at improving other areas, maybe using > ctypes/cython, or possibly playing with the new preprocessor tricks > that have been being discussed recently. There's really no need to > change the language to solve one specific instance of this "problem". That's like suggesting to the poor fella who's MPG is suffering (because of your incompetent adjustments!) to buy fuel additives to compensate for the loss of MPG. Why should he incur costs because you are incompetent? From steve+comp.lang.python at pearwood.info Sun Jun 2 15:03:15 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 02 Jun 2013 19:03:15 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51ab96f2$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sun, 02 Jun 2013 11:09:12 -0700, Rick Johnson wrote: > Maybe you don't care about destroying someone's CPU, however, i do! And yet here you are, destroying millions of people's CPUs by sending them email or usenet messages filled with garbage. -- Steven From rosuav at gmail.com Sun Jun 2 16:21:06 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 06:21:06 +1000 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 4:09 AM, Rick Johnson wrote: > On Jun 2, 12:20 pm, Chris Angelico wrote: >> On Mon, Jun 3, 2013 at 3:04 AM, Rick Johnson >> > * Woefully inadequate because: Switching on or off the debug >> > messages is only valid in the current module that the >> > function was imported. What if you want to kill all >> > debugprint messages EVERYWHERE? Do you really want to edit >> > "debug = BOOLEAN" in every source file OR do something >> > stupid like import debugprint and edit the DEBUG constant >> > OR even dumber, edit the debugprint source code? GAWD NO! >> Easy fix to this one. Instead of copying and pasting debugprint into >> everything, have it in a module and import it everywhere. Then the >> debug flag will be common to them all. > > Ignoring the fact that you have "import everywhere", what if you want > to stop ALL debug messages? If you "import everywhere" to get them, > you then have to "edit everywhere" to stop them. Example: ## debugprint.py DEBUG = True def debugprint(*a,**kw): if DEBUG: return print(*a,**kw) ## every other module from debugprint import debugprint debugprint("I got imported!") def foo(): debugprint("I got foo'd!") See how many places you need to edit to change the DEBUG flag? You can even do it at run time with this version of the code: ## toggle debugging import debugprint debugprint.DEBUG = not debugprint.DEBUG And, as several others have pointed out, this is kinda sorta what the logging module does, only it does it better. Same method; you import the same module everywhere. It is THE SAME module. >> That's roughly half a second for a million calls to debugprint(). >> That's a 580ns cost per call. Rather than fiddle with the language, >> I'd rather just take this cost. > > I never purposely inject ANY superfluous cycles in my code except in > the case of testing or development. To me it's about professionalism. Why do you use Python? Clearly the only professional option is to use raw assembler. Or possibly you could justify C on the grounds of portability. > Let's consider a thought exercise shall we? > > Imagine your an auto mechanic. You customer brings in his > car and asks you to make some repairs. You make the > repairs but you also adjust the air/fuel ratio to run > "rich" (meaning the vehicle will get less MPG). Do you > still pat yourself on the back and consider you've done a > professional job? > > I would not! However, you're doing the same thing as the mechanic when > your code executes superflouos calls and burns cycles for no other > reason than pure laziness. CPU's are not immortal you know, they have > a lifetime. Maybe you don't care about destroying someone's CPU, > however, i do! Better analogy: When you build a car, you incorporate a whole bunch of gauges and indicators. They clutter things up, and they're extra weight to carry; wouldn't the car get more MPG (side point: can I have my car get more OGG instead? I like open formats) if you omit them? > I just wonder how many of your "creations" (aka: monstrosities!) are > burning cycles this very minute! Every one that's written in a high level language. So that's Yosemite, Minstrel Hall, Tisroc, KokoD, RapidSend/RapidRecv, and Vizier. And that's just the ones that I've personally created and that I *know* are currently running (and that I can think of off-hand). They're wasting CPU cycles dealing with stuff that I, the programmer, now don't have to. Now let's see. According to my server, right now, load average is 0.21 - of a single-core Intel processor that was mid-range back in 2009. And that's somewhat higher-than-normal load, caused by some sort of usage spike a few minutes ago (and is dropping); normally, load average is below 0.10. At what point would it be worth my effort to rewrite all that code to eliminate waste? Considering that I could build a new server for a few hundred (let's say $1000 to be generous, though the exact price will depend on where you are), or rent one in a top-quality data center for $40-$55/month and not have to pay for electricity or internet, any rewrite would need to take less than two days of my time to be worthwhile. Let 'em burn cycles; we can always get more. >> So you can eliminate part of the cost there, if it matters to you. If >> a half-microsecond cost is going to be significant to you, you >> probably should be looking at improving other areas, maybe using >> ctypes/cython, or possibly playing with the new preprocessor tricks >> that have been being discussed recently. There's really no need to >> change the language to solve one specific instance of this "problem". > > That's like suggesting to the poor fella who's MPG is suffering > (because of your incompetent adjustments!) to buy fuel additives to > compensate for the loss of MPG. Why should he incur costs because you > are incompetent? He's welcome to push a wheelbarrow if he doesn't want the overhead of a car. The car offers convenience, but at a cost. This is an eternal tradeoff. ChrisA From wxjmfauth at gmail.com Tue Jun 4 08:23:19 2013 From: wxjmfauth at gmail.com (jmfauth) Date: Tue, 4 Jun 2013 05:23:19 -0700 (PDT) Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: On 2 juin, 20:09, Rick Johnson wrote: > > > > > > I never purposely inject ANY superfluous cycles in my code except in > the case of testing or development. To me it's about professionalism. > Let's consider a thought exercise shall we? > -------- The flexible string representation is the perfect example of this lack of professionalism. Wrong by design, a non understanding of the mathematical logic, of the coding of characters, of Unicode and of the usage of characters (everything is tight together). How is is possible to arrive to such a situation ? The answer if far beyond my understanding (although I have my opinion on the subject). jmf From rustompmody at gmail.com Tue Jun 4 09:29:02 2013 From: rustompmody at gmail.com (rusi) Date: Tue, 4 Jun 2013 06:29:02 -0700 (PDT) Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <1815a2d3-5d7f-401b-a320-6cc6c7fc2025@qn4g2000pbc.googlegroups.com> On Jun 4, 5:23?pm, jmfauth wrote: > On 2 juin, 20:09, Rick Johnson wrote: > > > > > I never purposely inject ANY superfluous cycles in my code except in > > the case of testing or development. To me it's about professionalism. > > Let's consider a thought exercise shall we? > > -------- > > The flexible string representation is the perfect example > of this lack of professionalism. > Wrong by design, a non understanding of the mathematical logic, > of the coding of characters, of Unicode and of the usage of > characters (everything is tight together). > > How is is possible to arrive to such a situation ? > The answer if far beyond my understanding (although > I have my opinion on the subject). > > jmf The Clash of the Titans L? jmf ch?rgeth with might? might And le Mond underneath trembleth Now RR mounts his sturdy steed And the windmill yonder turneth From breamoreboy at yahoo.co.uk Tue Jun 4 09:35:17 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Tue, 04 Jun 2013 14:35:17 +0100 Subject: PyWart: The problem with "print" In-Reply-To: <1815a2d3-5d7f-401b-a320-6cc6c7fc2025@qn4g2000pbc.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <1815a2d3-5d7f-401b-a320-6cc6c7fc2025@qn4g2000pbc.googlegroups.com> Message-ID: On 04/06/2013 14:29, rusi wrote: > On Jun 4, 5:23 pm, jmfauth wrote: >> On 2 juin, 20:09, Rick Johnson wrote: >> >> >> >>> I never purposely inject ANY superfluous cycles in my code except in >>> the case of testing or development. To me it's about professionalism. >>> Let's consider a thought exercise shall we? >> >> -------- >> >> The flexible string representation is the perfect example >> of this lack of professionalism. >> Wrong by design, a non understanding of the mathematical logic, >> of the coding of characters, of Unicode and of the usage of >> characters (everything is tight together). >> >> How is is possible to arrive to such a situation ? >> The answer if far beyond my understanding (although >> I have my opinion on the subject). >> >> jmf > > The Clash of the Titans > > L? jmf ch?rgeth with might? might > And le Mond underneath trembleth > Now RR mounts his sturdy steed > And the windmill yonder turneth > +1 funniest poem of the week :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From joshua.landau.ws at gmail.com Tue Jun 4 15:59:00 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Tue, 4 Jun 2013 20:59:00 +0100 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <1815a2d3-5d7f-401b-a320-6cc6c7fc2025@qn4g2000pbc.googlegroups.com> Message-ID: On 4 June 2013 14:35, Mark Lawrence wrote: > On 04/06/2013 14:29, rusi wrote: >> The Clash of the Titans >> >> L? jmf ch?rgeth with might? might >> And le Mond underneath trembleth >> Now RR mounts his sturdy steed >> And the windmill yonder turneth >> > > +1 funniest poem of the week :) Week? Do we do this every Tuesday? I vote all-time best post for python-list at python.org. From steve+comp.lang.python at pearwood.info Wed Jun 5 01:03:35 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 05 Jun 2013 05:03:35 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51aec6a7$0$11118$c3e8da3@news.astraweb.com> On Tue, 04 Jun 2013 05:23:19 -0700, jmfauth wrote: > How is is possible to arrive to such a situation ? The answer if far > beyond my understanding Truer words have never been spoken. > (although I have my opinion on the subject). http://en.wikipedia.org/wiki/Dunning?Kruger_effect -- Steven From steve+comp.lang.python at pearwood.info Sun Jun 2 14:58:30 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 02 Jun 2013 18:58:30 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> Message-ID: <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sun, 02 Jun 2013 10:04:00 -0700, Rick Johnson wrote: > Many > languages provide a function, method, or statement by which users can > write easily to stdout, and Python is no exception with it's own "print" > function. However, whilst writing to stdout via "print" is slightly less > verbose than calling the "write" method of "sys.stdout", we don't really > gain much from this function except a few keystrokes... is this ALL > print should be? A mere syntactical sugar? Perhaps you should read the docs before asking rhetorical questions, because the actual answer is, No, print is not mere syntactical sugar saving a few keystrokes. Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream. Still not powerful enough for you? Easily fixed: import builtins # The higher the verbosity, the more messages are printed. verbosity = 2 def print(*args, level=1, **kwargs): if level >= verbosity: builtins.print(*args, **kwargs) print("debug message", level=4) # Only prints if verbosity >= 4 print("info message", level=3) print("warning message", level=2) print("critical message", level=1) # Only prints if verbosity >= 1 Trivial enough to embed in each module that needs it, in which case each module can have its own verbosity global variable. Or you can put it in a helper module, with a single, application-wide global variable, and use it like this: import verbose_print print = verbose_print.print verbose_print.verbosity = 3 print("some message", level=4) Of course, in practice you would set the verbosity according to a command line switch, or an environment variable, or a config file, and not hard code it in your source code. > I've found that many subtle bugs are caused by not limiting the inputs > to sane values (or types). And with Python's duct typing Nothing worse than having pythons roaming through your ducts, eating your ducks. > and implicit > casting to Boolean, you end up with all sorts of misleading things > happening! Maybe you're testing for truth values and get a string > instead; which screws everything up!!! Only if you're a lousy programmer who doesn't understand Python's truth model. > A "wise programmer" may think he's solved the problem by writing a > function called "debugprint" that looks like this: > > def debugprint(*args): > if DEBUG == True: > print(*args) No no no, that's not how you do it. It should be: if DEBUG == True == True: Wait, no, I got that wrong. It should be: if DEBUG == True == True == True: Hang on, I've nearly got it! if DEBUG == True == True == True == True: Or, you could program like a professional, and say: if DEBUG: By the way, why is DEBUG a constant? Doesn't that defeat the purpose? > However that solution is at best woefully inadequate and at worse a > cycle burner! Certainly you don't want to be burning cycles. Imagine the pollution from the burning rubber tyres! > * Woefully inadequate because: Switching on or off the debug > messages is only valid in the current module that the function was > imported. What if you want to kill all debugprint messages > EVERYWHERE? You start by learning how Python works, and not making woefully incorrect assumptions. > Do you really want to edit "debug = BOOLEAN" in every > source file Python does not work that way. > OR do something stupid like import debugprint and edit > the DEBUG constant Heaven forbid that people do something that actually works the way Python is designed to work. > OR even dumber, edit the debugprint source code? > GAWD NO! > > * But even if you are willing to cope with all the "switch- > on-and-off" nonsense, are you willing to have you code slowed by > numerous calls to a dead function containing a comparison that will > always be false? And of course you have profiled your application, and determined that the bottleneck in performance is the calls to debugprint, because otherwise you are wasting your time and ours with premature optimization. Life is hard. Sometimes you have to choose between performance and debugging. > This > realization has brought me to the conclusion that Python (and other > languages) need a "scoped print function". What is a "scoped print > function" anyway? Well what i am proposing is that Python include the > following "debug switches" in the language: > > ------------------------------ > Switch: "__GLOBALDEBUG__" > ------------------------------ > Global switching allows a programmer to instruct the interpreter to > IGNORE all print functions or to EVALUATE all print functions by > assigning a Boolean value of True or False respectively to the global > switch (Note: global switch always defaults to True!). If you really care about this premature optimization, you can do this: if __debug__: print("whatever") You then globally disable these print calls by running Python with the -O switch. > Any script that includes the assignment "__GLOBALDEBUG__ = False" will > disable ALL debug print messages across the entire interpreter > namespace. In effect, all print statements will be treated as comments > and ignored by the interpreter. No dead functions will be called and > no false comparisons will be made! > > (Note: __GLOBALDEBUG__ should not be available in any local namespace > but accessed only form the topmost namespace. Something like: > __main__.__GLOBALDEBUG__ = Boolean Python does not work like that. Perhaps you should learn how to program in Python before telling us how it should be improved? > ------------------------------ > Switch: "__LOCALDEBUG__" > ------------------------------ > Local switching allows a programmer to turn on (or off) debug messages > in the module it was declared. Not sure if this should be more > specific than modules; like classes, blocks, or functions??? Of course > this declaration will be overridden by any global switch. So, it will be utterly useless then, since __LOCALDEBUG__ has no effect, and __GLOBALDEBUG__ overrides it. Great. > My only > concern is that some programmers may be confused why their print calls > are not working and may not have the capacity to resolve that function > named "print" is tied to the global and local switches named > "__GLOBAL_DEBUG__" and "__LOCAL_DEBUG__". To prevent any cognitive > dissonance it may be desirable to introduce a new function called > "debugprint". That's not what cognitive dissonance means. The word you are looking for is "confusion". Cognitive dissonance is the mental stress and anguish a person feels when deep down they know that they are the best, most intelligent, most expert Python programmer on the planet, better even than Python's creator, and yet every time they open their mouth to tell the world how Python gets it wrong and how to fix it, they just get shot down in flames. -- Steven From rosuav at gmail.com Sun Jun 2 16:28:52 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 06:28:52 +1000 Subject: PyWart: The problem with "print" In-Reply-To: <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Mon, Jun 3, 2013 at 4:58 AM, Steven D'Aprano wrote: >> I've found that many subtle bugs are caused by not limiting the inputs >> to sane values (or types). And with Python's duct typing > > Nothing worse than having pythons roaming through your ducts, eating your > ducks. Steven, you misunderstand. It's more about using your ducts to type code. Have you seen the Mythbusters episode where they're trying to enter a building surreptitiously? ("Crimes and Mythdemeanors 1", I think, if you want to look it up.) At one point, we can CLEARLY hear one of the hosts, moving along a duct, *typing*. We can hear the click-click-click of giant keys. Hah. Knew I could trust Youtube. http://www.youtube.com/watch?v=5LovGVrrIuk ChrisA From rantingrickjohnson at gmail.com Mon Jun 3 21:37:24 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Mon, 3 Jun 2013 18:37:24 -0700 (PDT) Subject: PyWart: The problem with "print" In-Reply-To: <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sunday, June 2, 2013 1:58:30 PM UTC-5, Steven D'Aprano wrote: > On Sun, 02 Jun 2013 10:04:00 -0700, Rick Johnson wrote: Oh Steven, you've really outdone yourself this time with the theatrics. I hope you scored some "cool points" with your minions. Heck, you almost had me convinced until i slapped myself and realized your whole argument is just pure BS. For the sake of the lemmings, i must dissect your BS and expose it's methane emitting innards for all to smell. > > Many > > languages provide a function, method, or statement by which users can > > write easily to stdout, and Python is no exception with it's own "print" > > function. However, whilst writing to stdout via "print" is slightly less > > verbose than calling the "write" method of "sys.stdout", we don't really > > gain much from this function except a few keystrokes... is this ALL > > print should be? A mere syntactical sugar? > > Perhaps you should read the docs before asking rhetorical questions, > because the actual answer is, No, print is not mere syntactical sugar > saving a few keystrokes. > [...] And perhaps you should read a dictionary and obtain (at minimum) a primary school level education in English before making such foolish statements, because, OBVIOUSLY you don't know the definition of "syntactical sugar"... shall i educate you? ############################################################ # Wikipedia: "syntactic sugar" # ############################################################ # In computer science, syntactic sugar is syntax within a # # programming language that is designed to make things # # easier to read or to express. It makes the language # # "sweeter" for human use: things can be expressed more # # clearly, more concisely, or in an alternative style that # # some may prefer[...] # ############################################################ The print function is the very definition of a "syntactic sugar". For example: print("some sting") is much more readable than: sys.stdout.write("some string"+"\n") or: sys.stderr.write("some string"+"\n") or: streamFoo.write("blah") But wait, there's more! ############################################################ # Wikipedia: "syntactic sugar" (continued) # ############################################################ # [...]Specifically, a construct in a language is called # # syntactic sugar if it can be removed from the language # # without any effect on what the language can do: # # functionality and expressive power will remain the same. # ############################################################ Again, the removal of a print function (or print statement) will not prevent users from calling the write method on sys.stdout or sys.stderr (or ANY "stream object" for that matter!) The only mistake i made was to specify stdout.write specifically instead of generally referring to the print function as a sugar for "stream.write()". > > I've found that many subtle bugs are caused by not limiting the inputs > > to sane values (or types). And with Python's duct typing > [...] > > and implicit > > casting to Boolean, you end up with all sorts of misleading things > > happening! Maybe you're testing for truth values and get a string > > instead; which screws everything up!!! > Only if you're a lousy programmer who doesn't understand Python's truth > model. I understand the Python truth model quite well, i just don't happen to like it. Implicit conversion to Boolean breaks the law of "least astonishment". Many times you'll get a result (or an input) that you expect to be a Boolean, but instead is a string. A good example of poor coding is "dialog box return values". Take your standard yes/no/cancel dialog, i would expect it to return True|False|None respectively, HOWEVER, some *idiot* decided to return the strings 'yes'|'no'|'cancel'. If you tried to "bool test" a string (In a properly designed language that does NOT support implicit Boolean conversion) you would get an error if you tried this: py> string = " " py> if string: ... do_something() ERROR: Cannot convert string to Boolean! However, with Python's implicit conversion to Boolean, the same conditional will ALWAYS be True: because any string that is not the null string is True (as far as Python is concerned). This is an example of Python devs breaking TWO Zens at once: "explicit is better than implicit" "errors should NEVER pass silently" And even though Python does not raise an error, it should! > > A "wise programmer" may think he's solved the problem by writing a > > function called "debugprint" that looks like this: > > > def debugprint(*args): > > if DEBUG == True: > > print(*args) > No no no, that's not how you do it. It should be: > if DEBUG == True == True: > Wait, no, I got that wrong. It should be: > if DEBUG == True == True == True: > Hang on, I've nearly got it! > if DEBUG == True == True == True == True: > Or, you could program like a professional, and say: > if DEBUG: Obviously you don't appreciate the value of "explicit enough". if VALUE: is not explicit enough, however if bool(VALUE) or at least: if VALUE == True is "explicit enough". Whereas: if VALUE == True == True is just superflous. But that's just one example. What about this: if lst: I don't like that because it's too implict. What exactly about the list are we wanting to test? Do we want to know if we have list object or a None object, OR, do we want to know if we have a list object AND the list has members? I prefer to be explicit at the cost of a few keystrokes: if len(lst) > 0: Covers the "has members" test and: if lst is not None covers the "existence" test. I know Python allows me to be implicit here, however, i am choosing to be explicit for the sake of anyone who will read my code in the future but also for myself, because being explicit when testing for truth can catch subtle bugs. Consider the following: What if the symbol `value` is expected to be a list, however, somehow it accidentally got reassigned to another type. If i choose to be implicit and use: "if value", the code could silently work for a type i did not intend, therefore the program could go on for quite some time before failing suddenly on attribute error, or whatever. However, if i choose to be explicit and use: "if len(VALUE) > 0: then the code will fail when it should: at the comparison line. Because any object that does not provide a __len__ method would cause Python to raise NameError. By being "explicit enough" i will inject readability and safety into my code base. (that's twice you've been schooled in one reply BTW!) > By the way, why is DEBUG a constant? Doesn't that defeat the purpose? Hmm, I agree!. You're actually correct here. We should not be reassigning constants should we? (<--rhetorical) In correcting me you've exposed yet another design flaw with Python. Sadly Python DOES allow reassignment of CONSTANTS. > > * But even if you are willing to cope with all the "switch- > > on-and-off" nonsense, are you willing to have you code slowed by > > numerous calls to a dead function containing a comparison that will > > always be false? > And of course you have profiled your application, and determined that the > bottleneck in performance is the calls to debugprint, because otherwise > you are wasting your time and ours with premature optimization. > Life is hard. Sometimes you have to choose between performance and > debugging. Only if your language does not provide a proper debugprint function or provide the tools to create a proper debug print function. I detest true global variables, however, there are some legitimate reasons for true globals in every language. This "debugprint" problem is one of those reasons. > > This > > realization has brought me to the conclusion that Python (and other > > languages) need a "scoped print function". What is a "scoped print > > function" anyway? Well what i am proposing is that Python include the > > following "debug switches" in the language: > > > ------------------------------ > > Switch: "__GLOBALDEBUG__" > > ------------------------------ > > Global switching allows a programmer to instruct the interpreter to > > IGNORE all print functions or to EVALUATE all print functions by > > assigning a Boolean value of True or False respectively to the global > > switch (Note: global switch always defaults to True!). > If you really care about this premature optimization, you can do this: > if __debug__: > print("whatever") That's hideous! Two lines of code to make a single debug message, are you joking? I realize Python will allow me to place the entire statement on one line, however i refuse to do that also. I am very strict about my block structure and styles, and even the consistent inconsistency of the great GvR will not sway me away from adherence to my consistent readable style. > You then globally disable these print calls by running Python with the -O > switch. > > Any script that includes the assignment "__GLOBALDEBUG__ = False" will > > disable ALL debug print messages across the entire interpreter > > namespace. In effect, all print statements will be treated as comments > > and ignored by the interpreter. No dead functions will be called and > > no false comparisons will be made! > > > (Note: __GLOBALDEBUG__ should not be available in any local namespace > > but accessed only form the topmost namespace. Something like: > > __main__.__GLOBALDEBUG__ = Boolean > Python does not work like that. Perhaps you should learn how to program > in Python before telling us how it should be improved? And perhaps you should listen to diverse ideas and be open to change instead of clinging to your guns and religion. > > ------------------------------ > > Switch: "__LOCALDEBUG__" > > ------------------------------ > > Local switching allows a programmer to turn on (or off) debug messages > > in the module it was declared. Not sure if this should be more > > specific than modules; like classes, blocks, or functions??? Of course > > this declaration will be overridden by any global switch. > So, it will be utterly useless then, since __LOCALDEBUG__ has no effect, > and __GLOBALDEBUG__ overrides it. Great. Of course global debug overrides local debug, what's the purpose of global switching if it cannot override local switching? "__GLOBALDEBUG__ = False" would disables ALL debug messages EVERYWHERE. Yes, you are correct on this issue. It would be the same as setting a command line switch. However, you misunderstand __LOCALDEBUG__. When global debugging is "on" "__LOCALDEBUG__ = False" will disable debug messages ONLY in the module for which it was declared. From vito.detullio at gmail.com Mon Jun 3 23:16:13 2013 From: vito.detullio at gmail.com (Vito De Tullio) Date: Tue, 04 Jun 2013 05:16:13 +0200 Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: Rick Johnson wrote: > Take your > standard yes/no/cancel dialog, i would expect it to return > True|False|None respectively, you clearly mean True / False / FileNotFound. ( http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx ) -- ZeD From rantingrickjohnson at gmail.com Mon Jun 3 23:53:35 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Mon, 3 Jun 2013 20:53:35 -0700 (PDT) Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <5e24150b-475d-48d5-a905-03f400381919@googlegroups.com> On Monday, June 3, 2013 10:16:13 PM UTC-5, Vito De Tullio wrote: > Rick Johnson wrote: > > Take your > > standard yes/no/cancel dialog, i would expect it to return > > True|False|None respectively, > you clearly mean True / False / FileNotFound. No, i clearly meant what i said :-). FileDialogs only return one of two values; either a valid path or a value representing "failure". I suppose FileNotFound is a custom exception? That will work however i wonder if exception handling is overkill for this? try: path = filedialog.open("path") except FileNotFound: return do_something(path) As opposed to: path = filedialog.open("path") if path: do_something(path) Or, if Python was really cool! if filedialog.open("path") as path: do_something(path) However, i think True|False|None is the best return values for a yes|no|cancel choice. Consider: result = yesnocancel("save changes?") if result: # Try to save changes and close. if self.fileSave(): app.close() else: show_error() elif result is False: # Close without saving changes. app.close() else: # Canceled: Do nothing. return From steve+comp.lang.python at pearwood.info Tue Jun 4 00:30:24 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 04:30:24 GMT Subject: PyWart: The problem with "print" References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51ad6d5f$0$11118$c3e8da3@news.astraweb.com> On Tue, 04 Jun 2013 05:16:13 +0200, Vito De Tullio wrote: > Rick Johnson wrote: > >> Take your >> standard yes/no/cancel dialog, i would expect it to return >> True|False|None respectively, > > you clearly mean True / False / FileNotFound. > > ( http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx ) No no, he actually means return True return False raise an exception Or perhaps 0 1 2 Or perhaps: 'yes' 'no' 'cancel' like all right-thinking people expect *wink* Of course the one thing that a programmer should never, ever do, under pain of maybe having to learn something, is actually check the documentation of an unfamiliar library or function before making assumptions of what it will return. If you follow this advice, you too can enjoy the benefits of writing buggy code. -- Steven From steve+comp.lang.python at pearwood.info Tue Jun 4 01:39:59 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 05:39:59 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51ad7daf$0$11118$c3e8da3@news.astraweb.com> On Mon, 03 Jun 2013 18:37:24 -0700, Rick Johnson wrote: > On Sunday, June 2, 2013 1:58:30 PM UTC-5, Steven D'Aprano wrote: >> On Sun, 02 Jun 2013 10:04:00 -0700, Rick Johnson wrote: >> > A "wise programmer" may think he's solved the problem by writing a >> > function called "debugprint" that looks like this: >> > > def debugprint(*args): >> > if DEBUG == True: >> > print(*args) >> >> No no no, that's not how you do it. It should be: >> if DEBUG == True == True: >> >> Wait, no, I got that wrong. It should be: >> if DEBUG == True == True == True: >> >> Hang on, I've nearly got it! >> if DEBUG == True == True == True == True: >> >> Or, you could program like a professional, and say: >> if DEBUG: > > Obviously you don't appreciate the value of "explicit enough". > > if VALUE: > > is not explicit enough, however Consider a simple thought experiment. Suppose we start with a sequence of if statements that begin simple and get more complicated: if a == 1: ... if a == 1 and b > 2*c: ... if a == 1 and b > 2*c or d%4 == 1: ... if a == 1 and b > 2*c or d%4 == 1 and not (d**3//7)%3 == 0: ... I don't believe that any of these tests are improved by adding an extraneous "== True" at the end: if (a == 1) == True: ... if (a == 1 and b > 2*c) == True: ... if (a == 1 and b > 2*c or d%4 == 1) == True: ... if (a == 1 and b > 2*c or d%4 == 1 and not (d**3//7)%3 == 0) == True: ... At some point your condition becomes so complicated that you may wish to save it as a separate variable, or perhaps you need to check the flag in a couple of places and so calculate it only once. Moving the flag out into a separate variable doesn't make "== True" any more useful or helpful. flag = a == 1 if flag == True: ... But even if it did, well, you've just entered the Twilight Zone, because of course "flag == True" is just a flag, so it too needs to be tested with "== True": flag = (a == 1) == True if flag == True: ... but that too is just a flag so it needs more "explicitness"... and so on forever. This conclusion is of course nonsense. Adding "== True" to your boolean tests isn't helpful, so there's no need for even one, let alone an infinite series of "== True". "if flag" is as explicit as it needs to be. There's no need to artificially inflate the "explicitness" as if being explicit was good in and of itself. We don't normally write code like this: n += int(1) just to be explicit about 1 being an int. That would be redundant and silly. In Python, 1 *is* an int. [...] > if lst: > > I don't like that because it's too implict. What exactly about the list > are we wanting to test? If you are unfamiliar with Python, then you have to learn what the semantics of "if lst" means. Just as you would have to learn what "if len(lst) > 0" means. > I prefer to be explicit at the cost of a few keystrokes: > > if len(lst) > 0: This line of code is problematic, for various reasons: - you're making assumptions about the object which are unnecessary; - which breaks duck-typing; - and risks doing too much work, or failing altogether. You're looking up the length of the lst object, but you don't really care about the length. You only care about whether there is something there or not, whether lst is empty or not. It makes no difference whether lst contains one item or one hundred million items, and yet you're asking to count them all. Only to throw that count away immediately! Looking at the length of a built-in list is cheap, but why assume it is a built-in list? Perhaps it is a linked list where counting the items requires a slow O(N) traversal of the entire list. Or some kind of lazy sequence that has no way of counting the items remaining, but knows whether it is exhausted or not. The Python way is to duck-type, and to let the lst object decide for itself whether it's empty or not: if lst: ... not to make assumptions about the specific type and performance of the object. > Consider the following: > > What if the symbol `value` is expected to be a list, however, somehow > it accidentally got reassigned to another type. If i choose to be > implicit and use: "if value", the code could silently work for a type i > did not intend, therefore the program could go on for quite some time > before failing suddenly on attribute error, or whatever. `if len(lst) > 0` also works for types you don't intend. Any type that defines a __len__ method which returns an integer will do it. Tuples, sets and dicts are just the most obvious examples of things that support len() but do not necessarily support all the things you might wish to do to a list. > However, if i choose to be explicit and use: > > "if len(VALUE) > 0: > > then the code will fail when it should: at the comparison line. Except of course when it doesn't. > Because > any object that does not provide a __len__ method would cause Python to > raise NameError. TypeError. > By being "explicit enough" i will inject readability and safety into my > code base. Unnecessary verbosity and redundancy, unnecessary restrictions on the type of the object, and unjustifiable assumptions about the cost of calling len(). -- Steven From rantingrickjohnson at gmail.com Tue Jun 4 11:44:11 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Tue, 4 Jun 2013 08:44:11 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51ad7daf$0$11118$c3e8da3@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Tuesday, June 4, 2013 12:39:59 AM UTC-5, Steven D'Aprano wrote: > On Mon, 03 Jun 2013 18:37:24 -0700, Rick Johnson wrote: > Consider a simple thought experiment. Suppose we start with a sequence of > if statements that begin simple and get more complicated: > if a == 1: ... > if a == 1 and b > 2*c: ... > if a == 1 and b > 2*c or d%4 == 1: ... > if a == 1 and b > 2*c or d%4 == 1 and not (d**3//7)%3 == 0: ... > I don't believe that any of these tests are improved by adding an > extraneous "== True" at the end: > if (a == 1) == True: ... > if (a == 1 and b > 2*c) == True: ... > if (a == 1 and b > 2*c or d%4 == 1) == True: ... > if (a == 1 and b > 2*c or d%4 == 1 and not (d**3//7)%3 == 0) == True: ... And i agree! You are misunderstanding my very valid point. Post-fixing a "== True" when truth testing a *real* Boolean (psst: that's a True or False object) is superfluous, I'm referring to truth testing non-Boolean values. So with that in mind, the following is acceptably "explicit enough" for me: a = True if a: do_something() However, since Python allows implicit conversion to Boolean for ALL types, unless we know for sure, beyond any reasonable doubt, that the variable we are truth testing is pointing to a True or False object, we are taking too many chances and will eventually create subtle bugs. a = " " if a: do_something() When if write code that "truth tests", i expect that the value i'm testing is a True or False object, not an empty list that *magically* converts to False when i place an "if" in front of it, or a list with more members that magically converts to True when i place an "if" in front of it. This implicit conversion seems like a good idea at first, and i was caught up in the hype myself for some time: "Hey, i can save a few keystrokes, AWESOME!". However, i can tell you with certainty that this implicit conversion is folly. It is my firm belief that truth testing a value that is not a Boolean should raise an exception. If you want to convert a type to Boolean then pass it to the bool function: lst = [1,2,3] if bool(lst): do_something This would be "explicit enough" > If you are unfamiliar with Python, then you have to learn what the > semantics of "if lst" means. Just as you would have to learn what > "if len(lst) > 0" means. Again, i understand the folly of "implicit Boolean conversion" just fine. > > I prefer to be explicit at the cost of a few keystrokes: > > if len(lst) > 0: > This line of code is problematic, for various reasons: > - you're making assumptions about the object which are unnecessary; > - which breaks duck-typing; > - and risks doing too much work, or failing altogether. > You're looking up the length of the lst object, but you don't really care > about the length. Yes i do care about the length or i would not have asked. I'm asking Python to tell me if the iterable has members, amd if it does, i want to execute a block of code, if it does not, i want to do nothing. But i'm also informing the reader of my source code that the symbol i am truth testing is expected to be an iterable with a __len__ method. "if lst" does not give me the same answer (or imply the same meaning to a reader), it merely tells me that the implict conversion has resulted in a True value, but what if the lst symbol is pointing to a string? Then i will falsely believe i have a list with members when i actually have a string with length greater than zero. > You only care about whether there is something there or > not, whether lst is empty or not. It makes no difference whether lst > contains one item or one hundred million items, and yet you're asking to > count them all. Only to throw that count away immediately! I agree. Summing the list members just to guarantee that the iterable has members is foolish, however, python gives me no other choice IF i want to be "explicit enough". In a properly designed language, the base iterable object would supply a "hasLength" or "hasMembers" method that would return a much faster check of: try: iterable[0] except IndexError: return False else: return True That check would guarantee the iterable contained at least one member without counting them all. > Looking at the length of a built-in list is cheap, but why assume it is a > built-in list? Perhaps it is a linked list where counting the items > requires a slow O(N) traversal of the entire list. Or some kind of lazy > sequence that has no way of counting the items remaining, but knows > whether it is exhausted or not. Yes, but the problem is not "my approach", rather the lack of proper language design (my apologizes to the "anointed one". ;-) > The Python way is to duck-type, and to let the lst object decide for > itself whether it's empty or not: > if lst: ... > not to make assumptions about the specific type and performance of the > object. Well Steven, in the real world sometimes you have no other choice. I don't have time to read and comprehend thousands of lines of code just to use a simple interface. We are all aware that: "Look Before You Leap" is always a slower method than: "It's Easier to Ask Forgiveness Than Permission" When i am writing code i prefer to be "explicit enough" so that IF my assumptions about the exact type of an object are incorrect, the code will fail quickly enough that i can easily find and correct the problem. In this manner i can develop code much faster because i do not need to understand the minutia of an API in order to wield it. On the contrary, Implicit Conversion to Boolean is a bug producing nightmare that requires too much attention to minutia. > > Consider the following: > > What if the symbol `value` is expected to be a list, however, somehow > > it accidentally got reassigned to another type. If i choose to be > > implicit and use: "if value", the code could silently work for a type i > > did not intend, therefore the program could go on for quite some time > > before failing suddenly on attribute error, or whatever. > `if len(lst) > 0` also works for types you don't intend. Any type that > defines a __len__ method which returns an integer will do it. > Tuples, sets and dicts are just the most obvious examples of things that > support len() but do not necessarily support all the things you might > wish to do to a list. Agreed. The "if len(var) > 0" will return True for ANY object that includes a __len__ method. This test is fine if you want to test iterables generically, however, if you want to be specific about testing lists you could not rely on that code because strings and all other iterables would return the same "truthy" or "falsey" value. But how do we solve this issue? I don't want to see this: if isinstance(var, list) and len(var) > 0: do_something() But we are really ignoring the elephant in the room. Implict conversion to Boolean is just a drop in the bucket compared to the constant "shell game" we are subjected to when reading source code. We so naively believe that a symbol named "lst" is a list object or a symbol "age" is a integer, when we could be totally wrong! This is the source of many subtle bugs!!! There must be some method by which we can truth test an iterable object and verify it has members, but do so in a manner that is valid for all types AND exposes the "expected type" in the method name. hmm... Adding a method like "is_valid" to every object can seem logical, however, this can fail just as miserably as Python's current implicit bool. And, more disastrously, an "is_valid" method is not going to raise an error (where it should) because it works for all types. What we need is a method by which we can validate a symbol and simultaneously do the vaidation in a manner that will cast light on the type that is expected. In order for this to work, you would need validators with unique "type names" if var.is_validList(): elif var.is_validString(): elif var.is_vaildTuple(): elif var.is_validInteger(): elif var.is_validFloat(): elif var.is_validDict(): etc... By this manner, we can roll three common tests into one method: * boolean conversion * member truthiness for iterables * type checking But most importantly, we destroy implicitly and and be "explicit enough", but not so explicit that our fingers hurt. *school-bell-rings* PS: Damn i'm good! I believe the BDFL owes me a Thank You email for this gold i just dropped on the Python community. Flattery is welcome. Pucker up! From rosuav at gmail.com Tue Jun 4 12:00:44 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 02:00:44 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wed, Jun 5, 2013 at 1:44 AM, Rick Johnson wrote: > But we are really ignoring the elephant in the room. Implict > conversion to Boolean is just a drop in the bucket compared > to the constant "shell game" we are subjected to when > reading source code. We so naively believe that a symbol > named "lst" is a list object or a symbol "age" is a integer, > when we could be totally wrong! This is the source of many > subtle bugs!!! You know, if you want a language with strict type declarations and extreme run-time efficiency, there are some around. I think one of them might even be used to make the most popular Python. Give it a try, you might like it! There's NO WAY that you could accidentally pass a list to a function that's expecting a float, NO WAY to unexpectedly call a method on the wrong type of object. It would suit you perfectly! ChrisA From fabiosantosart at gmail.com Tue Jun 4 12:10:55 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 17:10:55 +0100 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 4 Jun 2013 17:04, "Chris Angelico" wrote: > > On Wed, Jun 5, 2013 at 1:44 AM, Rick Johnson > wrote: > > But we are really ignoring the elephant in the room. Implict > > conversion to Boolean is just a drop in the bucket compared > > to the constant "shell game" we are subjected to when > > reading source code. We so naively believe that a symbol > > named "lst" is a list object or a symbol "age" is a integer, > > when we could be totally wrong! This is the source of many > > subtle bugs!!! > > You know, if you want a language with strict type declarations and > extreme run-time efficiency, there are some around. I think one of > them might even be used to make the most popular Python. Give it a > try, you might like it! There's NO WAY that you could accidentally > pass a list to a function that's expecting a float, NO WAY to > unexpectedly call a method on the wrong type of object. It would suit > you perfectly! > I agree. I have never had this kind of issues in a dynamic language. Except when passing stuff to Django's fields. And in JavaScript. It seems like the thing was made to create references to `undefined`. And make them easily convertible to numbers and strings so that our calculations mysteriously fail when we're missing a function argument somewhere. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rantingrickjohnson at gmail.com Tue Jun 4 12:09:12 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Tue, 4 Jun 2013 09:09:12 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <57f4d421-3941-4cff-8bff-84a670226d2d@g8g2000yqa.googlegroups.com> On Jun 4, 10:44?am, Rick Johnson wrote: > What we need is a method by which we can validate a symbol > and simultaneously do the vaidation in a manner that will > cast light on the type that is expected. In order for this > to work, you would need validators with unique "type names" > > ? ? if var.is_validList(): > ? ? elif var.is_validString(): > ? ? elif var.is_vaildTuple(): > ? ? elif var.is_validInteger(): > ? ? elif var.is_validFloat(): > ? ? elif var.is_validDict(): > ? ? etc... Actually, instead of forcing all types to have many "specific" methods, one builtin could solve the entire issue. The function would be similar to isinstance() taking two arguments "object" and "type", however, it will not only guarantee type but also handle the conversion to Boolean: if is_valid(var, list): # if this block executes we know # the var is of and # var.length is greater than one. else: # if this block executes we know # that var is not of # or, var.length equals zero. The is_valid function would replace implicit Boolean conversion for all types in manner that is "explicit enough" whilst maintaining finger longevity. This is how you design a language for consistency and readability. Again. PUCKER UP WHO-VILLE! From wuwei23 at gmail.com Tue Jun 4 21:31:23 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 18:31:23 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <57f4d421-3941-4cff-8bff-84a670226d2d@g8g2000yqa.googlegroups.com> Message-ID: <3710b22e-8e12-482f-8e7d-9105b550c323@a15g2000pbu.googlegroups.com> On Jun 5, 2:09?am, Rick Johnson wrote: > This is how you design a language for consistency and readability. Great! Now you can shut up and get back to work on RickPython4000. Come back and let us know all about it when it's done. From rantingrickjohnson at gmail.com Tue Jun 4 12:19:04 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Tue, 4 Jun 2013 09:19:04 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Jun 4, 11:00?am, Chris Angelico wrote: > You know, if you want a language with strict type declarations and > extreme run-time efficiency, there are some around. I don't like declaring types everywhere, i hate it. I prefer duck typed languages, HOWEVER, in order for duck typing to work consistently you must have checks and balances that the programmer can apply when he feels necessary. My "is_valid" built in will bridge the gap. We won't be forced to declare types, but we should ALWAYS add "type checks" to our "truth tests" unless we want to create subtle bugs. "is_valid" IS the answer! From rosuav at gmail.com Tue Jun 4 12:27:26 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 02:27:26 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wed, Jun 5, 2013 at 2:19 AM, Rick Johnson wrote: > On Jun 4, 11:00 am, Chris Angelico wrote: >> You know, if you want a language with strict type declarations and >> extreme run-time efficiency, there are some around. > > I don't like declaring types everywhere, i hate it. I prefer duck > typed languages, HOWEVER, in order for duck typing to work > consistently you must have checks and balances that the programmer can > apply when he feels necessary. My "is_valid" built in will bridge the > gap. We won't be forced to declare types, but we should ALWAYS add > "type checks" to our "truth tests" unless we want to create subtle > bugs. "is_valid" IS the answer! Option 1: void C_function(int x) Option 2: def Python_function(x): assert isinstance(x,int) Is there a fundamental difference? You're basically proposing Option 2 while detesting Option 1. ChrisA From ned at nedbatchelder.com Tue Jun 4 13:25:37 2013 From: ned at nedbatchelder.com (Ned Batchelder) Date: Tue, 04 Jun 2013 13:25:37 -0400 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51AE2311.7090005@nedbatchelder.com> On 6/4/2013 12:19 PM, Rick Johnson wrote: > On Jun 4, 11:00 am, Chris Angelico wrote: >> You know, if you want a language with strict type declarations and >> extreme run-time efficiency, there are some around. > I don't like declaring types everywhere, i hate it. I prefer duck > typed languages, HOWEVER, in order for duck typing to work > consistently you must have checks and balances that the programmer can > apply when he feels necessary. My "is_valid" built in will bridge the > gap. We won't be forced to declare types, but we should ALWAYS add > "type checks" to our "truth tests" unless we want to create subtle > bugs. "is_valid" IS the answer! > You are mis-using the term "duck typing." It doesn't mean just, "no type declarations." It also means, "the type of the value is irrelevant, all that matters is what it can do." Insisting that something be a list (or a dict, ...) is unnecessary and counter to the duck-typing philosophy. What's important is that you can iterate, or index it, or whatever it is you want to do with the list. The abstract base classes in the collections module were designed to help with determining these capabilities: http://docs.python.org/2/library/collections.html#collections-abstract-base-classes Of course, often, it's best just to do what you want to do rather than checking first. Also, I have no idea why [] isn't a "valid" list. Surely different applications will have different needs for what counts as valid once the type-check is passed. --Ned. From steve+comp.lang.python at pearwood.info Wed Jun 5 01:28:49 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 05 Jun 2013 05:28:49 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51aecc90$0$11118$c3e8da3@news.astraweb.com> On Wed, 05 Jun 2013 02:27:26 +1000, Chris Angelico wrote: > On Wed, Jun 5, 2013 at 2:19 AM, Rick Johnson > wrote: >> On Jun 4, 11:00 am, Chris Angelico wrote: >>> You know, if you want a language with strict type declarations and >>> extreme run-time efficiency, there are some around. >> >> I don't like declaring types everywhere, i hate it. I prefer duck typed >> languages, HOWEVER, in order for duck typing to work consistently you >> must have checks and balances that the programmer can apply when he >> feels necessary. My "is_valid" built in will bridge the gap. We won't >> be forced to declare types, but we should ALWAYS add "type checks" to >> our "truth tests" unless we want to create subtle bugs. "is_valid" IS >> the answer! > > Option 1: > > void C_function(int x) > > Option 2: > > def Python_function(x): > assert isinstance(x,int) > > Is there a fundamental difference? You're basically proposing Option 2 > while detesting Option 1. How many years has Rick been coming here, proclaiming loudly how much he loves Python's duck-typing? Ten years? And yet, he still has no clue what it actually means. If you're performing a type-check, IT ISN'T DUCK-TYPING. Duck typing means you don't care whether you have an int, so long as whatever object you get is usable where an int is usable. Now, there are many places in my own code where I decide that I wish to prohibit duck-typing. "Here I insist on an actual int, not just any old number." There are, sometimes, good reasons for this. But every time I do this, I am *not* duck-typing, I am doing a runtime type check which is completely opposite in intent to duck-typing. (There's no short name for this -- it's not quite static typing, because it happens at runtime and isn't enforced by the language.) It's almost like Rick declares that he's a great supporter of the free market, and that everyone should be free to buy and trade in whatever property they wish, while insisting that nothing can be bought or sold without permission from the government first. -- Steven From wuwei23 at gmail.com Wed Jun 5 01:31:11 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 22:31:11 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <51aecc90$0$11118$c3e8da3@news.astraweb.com> Message-ID: <3f548bb7-f614-49c1-bbcb-1ff4782cae5e@lr16g2000pbb.googlegroups.com> On Jun 5, 3:28?pm, Steven D'Aprano wrote: > How many years has Rick been coming here, proclaiming loudly [a]nd yet, he still has no clue what > actually means. It's not just duck typing. From jason.swails at gmail.com Tue Jun 4 13:32:23 2013 From: jason.swails at gmail.com (Jason Swails) Date: Tue, 4 Jun 2013 13:32:23 -0400 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Tue, Jun 4, 2013 at 11:44 AM, Rick Johnson wrote: > > This implicit conversion seems like a good idea at first, > and i was caught up in the hype myself for some time: "Hey, > i can save a few keystrokes, AWESOME!". However, i can tell > you with certainty that this implicit conversion is folly. > It is my firm belief that truth testing a value that is not > a Boolean should raise an exception. If you want to convert > a type to Boolean then pass it to the bool function: > > lst = [1,2,3] > if bool(lst): > do_something > > This would be "explicit enough" i f lst: do_something is equivalent to if bool(lst): do_something why not just have your editor autobool so you can spend more time coding and less time stamping around? That way the person that finds booled code more readable can have what he wants and the people that find it less readable can have what they want. Win-win BTW, you should do pointless comparisons like if condition is True: do_something rather than if condition == True do_something -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.g.kelly at gmail.com Tue Jun 4 13:42:56 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Tue, 4 Jun 2013 11:42:56 -0600 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Tue, Jun 4, 2013 at 9:44 AM, Rick Johnson wrote: > It is my firm belief that truth testing a value that is not > a Boolean should raise an exception. If you want to convert > a type to Boolean then pass it to the bool function: > > lst = [1,2,3] > if bool(lst): > do_something > > This would be "explicit enough" That is *exactly* equivalent to the same test without the bool function, and it gives the reader zero additional information about what "lst" is, so it boggles me that you approve of this "if bool(lst):" monstrosity while decrying the equivalent and slightly more efficient "if lst:". I think part of your complaint concerns the fact that the reader must understand the rules by which a truth value is implicitly obtained from lst in the statement "if lst:". But the reader must know the *same* rules in order to understand the more explicit "if bool(lst):", so there is no benefit to the latter in that regard either. > Yes i do care about the length or i would not have asked. > I'm asking Python to tell me if the iterable has members, > amd if it does, i want to execute a block of code, if it > does not, i want to do nothing. But i'm also informing the > reader of my source code that the symbol i am truth testing > is expected to be an iterable with a __len__ method. Caring that the object has a length is not the same as caring about what the object's length is. Steven's point stands, that your code inefficiently asks the object for some property that you don't (yet) care about. > "if lst" does not give me the same answer (or imply the same > meaning to a reader), it merely tells me that the implict > conversion has resulted in a True value, but what if the lst > symbol is pointing to a string? Then i will falsely believe > i have a list with members when i actually have a string > with length greater than zero. Your "if len(lst) > 0" fails to differentiate lists from strings in exactly the same way. > I agree. Summing the list members just to guarantee that the > iterable has members is foolish, however, python gives me no > other choice IF i want to be "explicit enough". In a > properly designed language, the base iterable object would > supply a "hasLength" or "hasMembers" method that would > return a much faster check of: > > try: > iterable[0] > except IndexError: > return False > else: > return True > > That check would guarantee the iterable contained at least > one member without counting them all. You said earlier in your post that "bool(lst)" was "explicit enough", and this is exactly what it does. > When i am writing code i prefer to be "explicit enough" so > that IF my assumptions about the exact type of an object are > incorrect, the code will fail quickly enough that i can > easily find and correct the problem. In a duck-typing language you should not be making assumptions about the "exact type" of an object in the first place. If I'm writing a function that receives a list-like argument, then at the *most specific* I will assume that the object passed in is a MutableSequence (but since I prefer to keep my functions functional where practical, more usually I will assume only that the object is an iterable or a generic sequence). If the caller wants to pass in a deque or some user-defined generic MutableSequence instead, then let them do so. I will also clearly document that assumption; if the caller can't be bothered to read the docs and passes in an object that breaks that assumption, then that's their own damn problem when it doesn't work. This is a programming language for consenting adults. > But we are really ignoring the elephant in the room. Implict > conversion to Boolean is just a drop in the bucket compared > to the constant "shell game" we are subjected to when > reading source code. We so naively believe that a symbol > named "lst" is a list object or a symbol "age" is a integer, > when we could be totally wrong! This is the source of many > subtle bugs!!! I am more likely to believe that an object is a list based on the documentation than on the mere fact that it is named "lst". The variable *does* have documentation, doesn't it? If when debugging I have reason to suspect that the documentation is incorrect or is being ignored, then I'll add an assertion to test it. > There must be some method by which we can truth test an > iterable object and verify it has members, but do so in a > manner that is valid for all types AND exposes the "expected > type" in the method name. hmm... This is nonsense. If it exposes the "expected type" in the name, then it can only be valid for that expected type. > Adding a method like "is_valid" to every object can seem > logical, however, this can fail just as miserably as > Python's current implicit bool. And, more disastrously, an > "is_valid" method is not going to raise an error (where it > should) because it works for all types. Actually it sounds completely illogical to me. What would be an "invalid" object? > What we need is a method by which we can validate a symbol > and simultaneously do the vaidation in a manner that will > cast light on the type that is expected. In order for this > to work, you would need validators with unique "type names" > > if var.is_validList(): > elif var.is_validString(): > elif var.is_vaildTuple(): > elif var.is_validInteger(): > elif var.is_validFloat(): > elif var.is_validDict(): > etc... How are these any different from the more flexible isinstance? And where exactly are you going to stop with these is_valid methods? var.is_validObject() var.is_validDate() var.is_validTime() var.is_validDatetime() var.is_validSocket() var.is_validDeque() var.is_validMutableSequence() var.is_validSequence() var.is_validMutableSequencePlusAConcatenateMethod() var.is_validUserDefinedObjectThatDoesNotExistInTheStandardLibraryAtAll() And on and on and on. How do you plan to add every single possible one of these methods to every single object? Remember that if you miss one, e.g. if you leave is_validString() off of your socket objects, then you'll get an AttributeError instead of a simple False value when you try to test it. > By this manner, we can roll three common tests into one > method: > > * boolean conversion > * member truthiness for iterables > * type checking How exactly does this is_valid method perform the first two? Are you suggesting that an empty sequence should not be considered "valid"? From rantingrickjohnson at gmail.com Tue Jun 4 19:21:25 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Tue, 4 Jun 2013 16:21:25 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <4bb7ce20-30c9-4d26-a11e-b0b49cc320c8@z8g2000yqd.googlegroups.com> On Jun 4, 12:42 pm, Ian Kelly wrote: > > By this manner, we can roll three common tests into one > > method: > > * Boolean conversion > > * member truthiness for iterables > > * type checking > How exactly does this is_valid method perform the first two? Are you > suggesting that an empty sequence should not be considered "valid"? I'm suggesting that the rules for Python's current "implicit conversion to Boolean" simply be moved into a "explicit function" named "isvalid", that also does a type check. Here is some Python code that might help you understand. py> def isvalid(object_, type_): ... if isinstance(object_, type_) and object_: ... return True ... return False py> isvalid([], list) False py> isvalid([1], list) True py> isvalid(0, int) False py> isvalid(1, int) True py> isvalid({}, dict) False py> isvalid("", str) False py> isvalid(" ", str) True Now, let's go back to my earlier example of where i was expecting a list but got a string instead. If i use Python's current implicit conversion to Boolean my code will do something i don't want it to do. py> lst = " " py> if lst: ... print("I'm a liar") ... else: ... print("I'm honest") I'm a liar But unlike this simple example (which failed quickly) in the real world, it may not fail for a long time. And when it does fail, you will be pulling your hair out tracking down the origin of the bug. If however i use my "isvalid" function, my conditional will not lie to me: py> lst = " " py> if isvalid(lst, list): ... print("I'm a liar") ... else: ... print("I'm honest") I'm honest Now. You're not always going to need to "isvalid" function. Sometimes you just need to test type, sometimes you just need convert to Boolean, and sometimes you can just fly by the seat of your pants. The point is, remove implicitly and inject explicitly. Furthermore: If the current "implicit conversion to Boolean" can be optimized by Python, then there is no reason why an explicit "isvalid" function cannot -- any talk to the contrary is just BS. If you still feel that this idea is garbage, then, keep on writing your sloppy code. My proposal is the best method to handle the problems that arise with duck typed languages in a manner that is not restrictive or laborious -- it's actually quite elegant. *school-bell-rings* From breamoreboy at yahoo.co.uk Tue Jun 4 19:37:31 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 00:37:31 +0100 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <4bb7ce20-30c9-4d26-a11e-b0b49cc320c8@z8g2000yqd.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <4bb7ce20-30c9-4d26-a11e-b0b49cc320c8@z8g2000yqd.googlegroups.com> Message-ID: On 05/06/2013 00:21, Rick Johnson wrote: [snip] Would you be kind enough not to smoke too much wacky baccy before posting, thanks. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From torriem at gmail.com Wed Jun 5 01:28:33 2013 From: torriem at gmail.com (Michael Torrie) Date: Tue, 04 Jun 2013 23:28:33 -0600 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <4bb7ce20-30c9-4d26-a11e-b0b49cc320c8@z8g2000yqd.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <4bb7ce20-30c9-4d26-a11e-b0b49cc320c8@z8g2000yqd.googlegroups.com> Message-ID: <51AECC81.6060705@gmail.com> On 06/04/2013 05:21 PM, Rick Johnson wrote: > If you still feel that this idea is garbage, then, keep on writing > your sloppy code. My proposal is the best method to handle the > problems that arise with duck typed languages in a manner that is not > restrictive or laborious -- it's actually quite elegant. Like most of your proposals, this does not have anything to do with the python syntax itself. You just demonstrated code that does what you want. So use it then. Adopt it in your own code, encourage others to use it. No changes to Python are needed. If this technique proves its value, then it will be adopted. If not, it will die. Start using it in one of your major open source projects. > *school-bell-rings* It's one thing to patronize people as you try to do to D'Aprano (and yes I admit that most replies to your posts are often patronizing to you in return), but you do realize this infantile attempt to try to make yourself look smarter than others really reflects poorly on you? I for one feel badly for you on this count, or at least embarrassed. So just a suggestion... drop the school bell and teacher stuff (or at least share your qualifications with us). It's really tiring, though to be fair not quite as tiring as trying to help someone with an iron skull get a CGI script working. From Russ.Paielli at gmail.com Wed Jun 5 02:11:33 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Tue, 4 Jun 2013 23:11:33 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Tuesday, June 4, 2013 8:44:11 AM UTC-7, Rick Johnson wrote: > Yes, but the problem is not "my approach", rather the lack > > of proper language design (my apologizes to the "anointed > > one". ;-) If you don't like implicit conversion to Boolean, then maybe you should be using another language -- and I mean that in a constructive sense. I'm not particularly fond of it either, but I switched from Python to another language a while back. The issue is not a lack of "proper language design" but rather a language design philosophy that values conciseness and simplicity over explicitness and rigor. Implicit conversion to Boolean is only one of many language features that are questionable for critical production software. Another is the convention of interpreting negative indices as counting backward from the end of a list or sequence. Yeah, I thought that was elegant... until it bit me. Is it a bad idea? Not necessarily. It certainly enhances programmer productivity, and it can be done correctly "almost" all the time. But that one time in a hundred or a thousand when you accidentally use a negative index can be a bitch. But then, what would you expect of a language that allows you to write x = 1 x = "Hello" It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. From rosuav at gmail.com Wed Jun 5 03:15:57 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 5 Jun 2013 17:15:57 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wed, Jun 5, 2013 at 4:11 PM, Russ P. wrote: > On Tuesday, June 4, 2013 8:44:11 AM UTC-7, Rick Johnson wrote: > >> Yes, but the problem is not "my approach", rather the lack >> >> of proper language design (my apologizes to the "anointed >> >> one". ;-) > > If you don't like implicit conversion to Boolean, then maybe you should be using another language -- and I mean that in a constructive sense. I'm not particularly fond of it either, but I switched from Python to another language a while back. The issue is not a lack of "proper language design" but rather a language design philosophy that values conciseness and simplicity over explicitness and rigor. (Out of curiosity, which language? Feel free to not answer, or to answer off-list, as that's probably not constructive to the thread.) I cannot name a single modern programming language that does NOT have some kind of implicit boolification. The only such language I know of is REXX, which has a single data type for everything, but insists on the exact strings "1" and "0" for True and False, anything else is an error. Every other language has some definition of "these things are true, these are false"; for instance: * C-family languages treat all nonzero integers as true * Shells treat 0 as "success" and nonzero as "error", and therefore as "true" and "false" respectively (yes, this IS an inversion) * Pike allows any variable to contain the integer 0, regardless of its declared type, and thus is a sort of "null" value which is false; all strings, arrays, mappings, etc are true * Python treats an empty "thing" as false and a nonempty one as true SQL is like REXX in that it's fairly strict; a condition must be a boolean (example from PostgreSQL): rosuav=> select 1+2 where 1; ERROR: argument of WHERE must be type boolean, not type integer LINE 1: select 1+2 where 1; ^ But an explicit conversion is permitted: rosuav=> select 1+2 where cast (5 as boolean); ?column? ---------- 3 (1 row) > It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. The looseness doesn't preclude critical applications. It's all a question of what you're testing. Does your code care that this be a list, and not something else? Then test! You have that option. What happens if it isn't a list, and something is done that bombs with an exception? Maybe that's not a problem. Critical applications can often be built in layers. For instance, a network server might listen for multiple socket connections, and for each connection, process multiple requests. You would want to catch exceptions at the two boundaries there; if a request handler crashes, the connection should not be dropped, and if a connection handler crashes, the server should keep running. With some basic defenses like that, your code need no longer concern itself with trivialities - if something goes wrong, there'll be an exception in the log. (BTW, this is one of the places where a bare or very wide except clause is appropriate. Log and move on.) ChrisA From Russ.Paielli at gmail.com Wed Jun 5 03:47:05 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Wed, 5 Jun 2013 00:47:05 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wednesday, June 5, 2013 12:15:57 AM UTC-7, Chris Angelico wrote: > On Wed, Jun 5, 2013 at 4:11 PM, Russ P. wrote: > > > On Tuesday, June 4, 2013 8:44:11 AM UTC-7, Rick Johnson wrote: > > > > > >> Yes, but the problem is not "my approach", rather the lack > > >> > > >> of proper language design (my apologizes to the "anointed > > >> > > >> one". ;-) > > > > > > If you don't like implicit conversion to Boolean, then maybe you should be using another language -- and I mean that in a constructive sense. I'm not particularly fond of it either, but I switched from Python to another language a while back. The issue is not a lack of "proper language design" but rather a language design philosophy that values conciseness and simplicity over explicitness and rigor. > > > > (Out of curiosity, which language? Feel free to not answer, or to > > answer off-list, as that's probably not constructive to the thread.) No problem. I'm using Scala. It has a sophisticated type system. The language is not perfect, but it seems to suit my needs fairly well. > > > I cannot name a single modern programming language that does NOT have > > some kind of implicit boolification. The only such language I know of > > is REXX, which has a single data type for everything, but insists on > > the exact strings "1" and "0" for True and False, anything else is an > > error. Every other language has some definition of "these things are > > true, these are false"; for instance: Scala (and Java) don't do that. Nor does Ada. That's because Ada is designed for no-nonsense critical systems. It is the standard higher-order language for flight control systems, for example. > > It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. > > > > The looseness doesn't preclude critical applications. It's all a > > question of what you're testing. Does your code care that this be a > > list, and not something else? Then test! You have that option. What > > happens if it isn't a list, and something is done that bombs with an > > exception? Maybe that's not a problem. > > > > Critical applications can often be built in layers. For instance, a > > network server might listen for multiple socket connections, and for > > each connection, process multiple requests. You would want to catch > > exceptions at the two boundaries there; if a request handler crashes, > > the connection should not be dropped, and if a connection handler > > crashes, the server should keep running. With some basic defenses like > > that, your code need no longer concern itself with trivialities - if > > something goes wrong, there'll be an exception in the log. (BTW, this > > is one of the places where a bare or very wide except clause is > > appropriate. Log and move on.) Well, I don't really want to open the Pandora's box of static vs. dynamic typing. Yes, with enough testing, I'm sure you can get something good out of a dynamically typed language for small to medium-sized applications, but I have my doubts about larger applications. However, I don't claim to be an expert. Someone somewhere has probably developed a solid large application in Python. But I'll bet a dollar to a dime that it took more work than it would have taken in a good statically typed language. Yes, extensive testing can go a long way, but extensive testing combined with good static typing can go even further for the same level of effort. From rantingrickjohnson at gmail.com Thu Jun 6 12:49:32 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 6 Jun 2013 09:49:32 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <7127916f-7d8a-418b-bda1-595e5bde8cbd@googlegroups.com> On Wednesday, June 5, 2013 2:15:57 AM UTC-5, Chris Angelico wrote: > [...] > I cannot name a single modern programming language that does NOT have > some kind of implicit boolification. Congrats: Again you join the ranks of most children who make excuses for their foolish actions along the lines of: "Hey, they did it first!" Well, the lemmings get what they deserve i suppose. From rosuav at gmail.com Thu Jun 6 12:59:12 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 02:59:12 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <7127916f-7d8a-418b-bda1-595e5bde8cbd@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <7127916f-7d8a-418b-bda1-595e5bde8cbd@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 2:49 AM, Rick Johnson wrote: > On Wednesday, June 5, 2013 2:15:57 AM UTC-5, Chris Angelico wrote: >> [...] >> I cannot name a single modern programming language that does NOT have >> some kind of implicit boolification. > > Congrats: Again you join the ranks of most children who make excuses for their foolish actions along the lines of: > > "Hey, they did it first!" > > Well, the lemmings get what they deserve i suppose. You say that like it's a bad thing. http://www.catb.org/jargon/html/E/ELIZA-effect.html ChrisA From drsalists at gmail.com Thu Jun 6 21:26:06 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Thu, 6 Jun 2013 18:26:06 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <7127916f-7d8a-418b-bda1-595e5bde8cbd@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <7127916f-7d8a-418b-bda1-595e5bde8cbd@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 9:49 AM, Rick Johnson wrote: > Congrats: Again you join the ranks of most children who make excuses for > their foolish actions along the lines of: > > "Hey, they did it first!" > > Well, the lemmings get what they deserve i suppose. > Lemmings don't really jump off cliffs. The Disney film documenting it was staged by a film crew who'd -heard- Lemmings did, and forced the little guys over a cliff in the name of saving time. http://en.wikipedia.org/wiki/Lemming -------------- next part -------------- An HTML attachment was scrubbed... URL: From breamoreboy at yahoo.co.uk Wed Jun 5 04:59:01 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 09:59:01 +0100 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 05/06/2013 07:11, Russ P. wrote: > But then, what would you expect of a language that allows you to write > > x = 1 > x = "Hello" > > It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. > I want to launch this rocket with an expensive satellite on top. I know it's safe as the code is written in ADA. Whoops :( -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From tjreedy at udel.edu Wed Jun 5 12:10:49 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Wed, 05 Jun 2013 12:10:49 -0400 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 6/5/2013 2:11 AM, Russ P. wrote: > But then, what would you expect of a language that allows you to > write > > x = 1 > x = "Hello" > > It's all loosey goosey -- which is fine for many applications but > certainly not for critical ones. I believe Shedskin, a Python *subset* compiler*, will reject that, because it compiles ints to C ints. Some code checkers might too. From Russ.Paielli at gmail.com Wed Jun 5 12:15:01 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Wed, 5 Jun 2013 09:15:01 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> On Wednesday, June 5, 2013 1:59:01 AM UTC-7, Mark Lawrence wrote: > On 05/06/2013 07:11, Russ P. wrote: > > > > > But then, what would you expect of a language that allows you to write > > > > > > x = 1 > > > x = "Hello" > > > > > > It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. > > > > > > > I want to launch this rocket with an expensive satellite on top. I know > > it's safe as the code is written in ADA. Whoops :( So Python would have been a better choice? Yeah, right. If you know anything about that rocket mishap, you should know that Ada was not the source of the problem. Ada won't keep airplane wings from breaking either, by the way. It's not magic. From rosuav at gmail.com Wed Jun 5 12:59:07 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 02:59:07 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 2:15 AM, Russ P. wrote: > On Wednesday, June 5, 2013 1:59:01 AM UTC-7, Mark Lawrence wrote: >> I want to launch this rocket with an expensive satellite on top. I know >> >> it's safe as the code is written in ADA. Whoops :( > > > So Python would have been a better choice? Yeah, right. If you know anything about that rocket mishap, you should know that Ada was not the source of the problem. Ada won't keep airplane wings from breaking either, by the way. It's not magic. Frankly, I don't think the language much matters. It's all down to the skill of the programmers and testers. Ada wasn't the source of the problem unless Ada has a bug in it... which is going to be true of pretty much any language. Maybe Python would be a better choice, maybe not; but let me tell you this, if the choice of language means the difference between testable in three months and testable code in three years, I'm going for the former. ChrisA From Russ.Paielli at gmail.com Wed Jun 5 17:59:31 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Wed, 5 Jun 2013 14:59:31 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> On Wednesday, June 5, 2013 9:59:07 AM UTC-7, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 2:15 AM, Russ P. wrote: > > > On Wednesday, June 5, 2013 1:59:01 AM UTC-7, Mark Lawrence wrote: > > >> I want to launch this rocket with an expensive satellite on top. I know > > >> > > >> it's safe as the code is written in ADA. Whoops :( > > > > > > > > > So Python would have been a better choice? Yeah, right. If you know anything about that rocket mishap, you should know that Ada was not the source of the problem. Ada won't keep airplane wings from breaking either, by the way. It's not magic. > > > > Frankly, I don't think the language much matters. It's all down to the > > skill of the programmers and testers. Ada wasn't the source of the > > problem unless Ada has a bug in it... which is going to be true of > > pretty much any language. Maybe Python would be a better choice, maybe > > not; but let me tell you this, if the choice of language means the > > difference between testable in three months and testable code in three > > years, I'm going for the former. > > > > ChrisA I'm not an Ada guy, but Ada advocates claim that it reduces development time by half in the long run compared to C and C++ due to reduced debugging time and simpler maintenance. Then again, I think Java people make a similar claim. As for Python, my experience with it is that, as your application grows, you start getting confused about what the argument types are or are supposed to be. That requires the developer to keep much more of the design in his head, and that undesirable. Of course, you can always put the argument types in comments, but that won't be verified by the compiler. From steve+comp.lang.python at pearwood.info Wed Jun 5 21:56:23 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 01:56:23 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> Message-ID: <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: > I'm not an Ada guy, but Ada advocates claim that it reduces development > time by half in the long run compared to C and C++ due to reduced > debugging time and simpler maintenance. They may be right. Far too many people think that C and C++ are "best of breed" in static languages. They aren't. > Then again, I think Java people make a similar claim. Java people would take credit for the sun coming up if they could :-) > As for Python, my experience with it is that, as > your application grows, you start getting confused about what the > argument types are or are supposed to be. Whereas people never get confused about the arguments in static typed languages? The only difference is whether the compiler tells you that you've passed the wrong type, or your unit test tells you that you've passed the wrong type. What, you don't have unit tests? Then how do you know that the code does the right thing when passed data of the right type? Adding an extra couple of unit tests is not that big a burden. Of course, if there was a way to automate that, why wouldn't you take advantage of it? Python currently has no standard way of doing such automated type tests, and probably won't ever get one. A static typed language gives you those tests for free, but in many languages at the cost that you probably end up spending more time fighting to satisfy the compiler than you save by not writing unit tests. -- Steven From rosuav at gmail.com Wed Jun 5 22:29:44 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 12:29:44 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano wrote: > On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: >> As for Python, my experience with it is that, as >> your application grows, you start getting confused about what the >> argument types are or are supposed to be. > > Whereas people never get confused about the arguments in static typed > languages? > > The only difference is whether the compiler tells you that you've passed > the wrong type, or your unit test tells you that you've passed the wrong > type. What, you don't have unit tests? Then how do you know that the code > does the right thing when passed data of the right type? Adding an extra > couple of unit tests is not that big a burden. The valid type(s) for an argument can be divided into two categories: Those the compiler can check for, and those the compiler can't check for. Some languages have more in the first category than others, but what compiler can prove that a string is an HTML-special-characters-escaped string? In a very few languages, the compiler can insist that an integer be between 7 and 30, but there'll always be some things you can't demonstrate with a function signature. That said, though, I do like being able to make at least *some* declaration there. It helps catch certain types of error. ChrisA From Russ.Paielli at gmail.com Thu Jun 6 00:25:33 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Wed, 5 Jun 2013 21:25:33 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <6ec93870-7178-47b9-b509-38d8639735ed@googlegroups.com> On Wednesday, June 5, 2013 7:29:44 PM UTC-7, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano > > wrote: > > > On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: > > >> As for Python, my experience with it is that, as > > >> your application grows, you start getting confused about what the > > >> argument types are or are supposed to be. > > > > > > Whereas people never get confused about the arguments in static typed > > > languages? > > > > > > The only difference is whether the compiler tells you that you've passed > > > the wrong type, or your unit test tells you that you've passed the wrong > > > type. What, you don't have unit tests? Then how do you know that the code > > > does the right thing when passed data of the right type? Adding an extra > > > couple of unit tests is not that big a burden. > > > > The valid type(s) for an argument can be divided into two categories: > > Those the compiler can check for, and those the compiler can't check > > for. Some languages have more in the first category than others, but > > what compiler can prove that a string is an > > HTML-special-characters-escaped string? In a very few languages, the > > compiler can insist that an integer be between 7 and 30, but there'll > > always be some things you can't demonstrate with a function signature. > > > > That said, though, I do like being able to make at least *some* > > declaration there. It helps catch certain types of error. I recall reading a few years ago that Guido was thinking about adding optional type annotations. I don't know if that went anywhere or not, but I thought it was a good idea. Eventually I got tired of waiting, and I realized that I just wanted a statically typed language, so I started using one. Steven's view on static vs. dynamic typing are interesting, but I think they are "out of the mainstream," for whatever that's worth. Does that mean he is wrong? I don't know. But I do know that statically typed code just seems to me to fit together tighter and more solidly. Maybe it's a liberal/conservative thing. Do liberals tend to favor dynamic typing? From ian.g.kelly at gmail.com Thu Jun 6 02:06:20 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Thu, 6 Jun 2013 00:06:20 -0600 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <6ec93870-7178-47b9-b509-38d8639735ed@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <6ec93870-7178-47b9-b509-38d8639735ed@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 10:25 PM, Russ P. wrote: > I recall reading a few years ago that Guido was thinking about adding optional type annotations. I don't know if that went anywhere or not, but I thought it was a good idea. Eventually I got tired of waiting, and I realized that I just wanted a statically typed language, so I started using one. Python 3 has support for arbitrary function argument annotations. The language itself ascribes no special meaning to it, so it's up to the user to add a type-checker (or whatever else they might want to use it for). From steve+comp.lang.python at pearwood.info Thu Jun 6 05:29:02 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 09:29:02 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b0565d$0$11118$c3e8da3@news.astraweb.com> On Thu, 06 Jun 2013 12:29:44 +1000, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano > wrote: >> On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: >>> As for Python, my experience with it is that, as your application >>> grows, you start getting confused about what the argument types are or >>> are supposed to be. >> >> Whereas people never get confused about the arguments in static typed >> languages? >> >> The only difference is whether the compiler tells you that you've >> passed the wrong type, or your unit test tells you that you've passed >> the wrong type. What, you don't have unit tests? Then how do you know >> that the code does the right thing when passed data of the right type? >> Adding an extra couple of unit tests is not that big a burden. > > The valid type(s) for an argument can be divided into two categories: > Those the compiler can check for, and those the compiler can't check > for. Some languages have more in the first category than others, but > what compiler can prove that a string is an > HTML-special-characters-escaped string? In a very few languages, the > compiler can insist that an integer be between 7 and 30, but there'll > always be some things you can't demonstrate with a function signature. > > That said, though, I do like being able to make at least *some* > declaration there. It helps catch certain types of error. *shrug* I don't terribly miss type declarations. Function argument declarations are a bit simpler in Pascal, compared to Python: Function Add(A, B : Integer) : Integer; Begin Add := A + B; End; versus def add(a, b): if not (isinstance(a, int) and isinstance(b, int)): raise TypeError return a + b but not that much simpler. And while Python can trivially support multiple types, Pascal cannot. (Some other static typed languages may.) Whatever benefit there is in declaring the type of a function is lost due to the inability to duck-type or program to an interface. There's no type that says "any object with a 'next' method", for example. And having to declare local variables is a PITA with little benefit. Give me a language with type inference, and a nice, easy way to keep duck- typing, and I'll reconsider. But until then, I don't believe the benefit of static types comes even close to paying for the extra effort. -- Steven From rosuav at gmail.com Thu Jun 6 05:45:49 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 19:45:49 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51b0565d$0$11118$c3e8da3@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Thu, Jun 6, 2013 at 7:29 PM, Steven D'Aprano wrote: > Whatever benefit there is in declaring the type of a function is lost due > to the inability to duck-type or program to an interface. There's no type > that says "any object with a 'next' method", for example. And having to > declare local variables is a PITA with little benefit. > > Give me a language with type inference, and a nice, easy way to keep duck- > typing, and I'll reconsider. But until then, I don't believe the benefit > of static types comes even close to paying for the extra effort. Here are some classic ways to do the multiple-types-accepted option. //C++ style: overloading int max(int a,int b) {return a>b ? a : b;} float max(float a,float b) {return a>b ? a : b;} //C++ also lets you go for templates, but leave that aside //Pike style: piped types int|float max(int|float a,int|float b) {return a>b ? a : b;} //This lets you write one lot of code but doesn't let //you declare that both args must be the same type # Python style: accept anything, then (maybe) check def max(a,b): return a if a>b else b //Pike does this too: mixed max(mixed a,mixed b) {return a>b ? a : b;} /* So does C, but only with pointers: */ void *max(void *a,void *b) {... uhh, this is nontrivial actually ...} For the "accept any object that has a next() method" sorts of rules, I don't know of any really viable system that does that usefully. The concept of implementing interfaces in Java comes close, but the class author has to declare that it's implementing some named interface. In theory there could be something that deduces the validity from the given structure, but I'm not aware of any language that does this. But it would let you do stuff like this (prototyped in Python): class Integers: def __init__(self): self.value=0 def next(self): self.value+=1 return self.value interface Iterable: next(self) def grab_three_values(Iterable iter): return iter.next(),iter.next(),iter.next() With a language that checks these sorts of things at compile time, it's not a big deal to test. With something fully dynamic like Python, it's probably not worth the effort. But maybe checks like this could be useful to something like Coverity. ChrisA From storchaka at gmail.com Thu Jun 6 07:12:17 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Thu, 06 Jun 2013 14:12:17 +0300 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: 06.06.13 12:45, Chris Angelico ???????(??): > For the "accept any object that has a next() method" sorts of rules, I > don't know of any really viable system that does that usefully. The > concept of implementing interfaces in Java comes close, but the class > author has to declare that it's implementing some named interface. In > theory there could be something that deduces the validity from the > given structure, but I'm not aware of any language that does this. Go? From robert.kern at gmail.com Thu Jun 6 11:35:17 2013 From: robert.kern at gmail.com (Robert Kern) Date: Thu, 06 Jun 2013 16:35:17 +0100 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 2013-06-06 10:45, Chris Angelico wrote: > For the "accept any object that has a next() method" sorts of rules, I > don't know of any really viable system that does that usefully. The > concept of implementing interfaces in Java comes close, but the class > author has to declare that it's implementing some named interface. In > theory there could be something that deduces the validity from the > given structure, but I'm not aware of any language that does this. But > it would let you do stuff like this (prototyped in Python): > > class Integers: > def __init__(self): self.value=0 > def next(self): > self.value+=1 > return self.value > > interface Iterable: > next(self) > > def grab_three_values(Iterable iter): > return iter.next(),iter.next(),iter.next() > > With a language that checks these sorts of things at compile time, > it's not a big deal to test. With something fully dynamic like Python, > it's probably not worth the effort. But maybe checks like this could > be useful to something like Coverity. As Serhiy notes, Go does this, almost exactly as you wrote it (modulo syntax). http://golang.org/doc/effective_go.html#interfaces_and_types -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From rosuav at gmail.com Thu Jun 6 11:41:33 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 01:41:33 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Fri, Jun 7, 2013 at 1:35 AM, Robert Kern wrote: > On 2013-06-06 10:45, Chris Angelico wrote: > >> For the "accept any object that has a next() method" sorts of rules, I >> don't know of any really viable system that does that usefully. The >> concept of implementing interfaces in Java comes close, but the class >> author has to declare that it's implementing some named interface. In >> theory there could be something that deduces the validity from the >> given structure, but I'm not aware of any language that does this. But >> it would let you do stuff like this (prototyped in Python): > > > As Serhiy notes, Go does this, almost exactly as you wrote it (modulo > syntax). > > http://golang.org/doc/effective_go.html#interfaces_and_types Thanks (and thanks for actually providing a link). Many years ago I came to the conclusion that anything I could conceive in language design has already been done somewhere :) Anyway, regardless of your language, there's always some criteria that can't be coded. Suppose the valid input for a function were "integers whose square roots are integers but whose cube roots are not". You won't easily get compile-time checking of that. ChrisA From robert.kern at gmail.com Thu Jun 6 12:08:23 2013 From: robert.kern at gmail.com (Robert Kern) Date: Thu, 06 Jun 2013 17:08:23 +0100 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 2013-06-06 16:41, Chris Angelico wrote: > Anyway, regardless of your language, there's always some criteria that > can't be coded. Suppose the valid input for a function were "integers > whose square roots are integers but whose cube roots are not". You > won't easily get compile-time checking of that. Say that on a Haskell list, and they'll take it as a challenge. :-) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From rustompmody at gmail.com Thu Jun 6 13:27:43 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 10:27:43 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: <57582781-3bc1-4ec5-a8b9-485453a89105@a9g2000pbq.googlegroups.com> On Jun 6, 9:08?pm, Robert Kern wrote: > On 2013-06-06 16:41, Chris Angelico wrote: > > > Anyway, regardless of your language, there's always some criteria that > > can't be coded. Suppose the valid input for a function were "integers > > whose square roots are integers but whose cube roots are not". You > > won't easily get compile-time checking of that. > > Say that on a Haskell list, and they'll take it as a challenge. :-) Yes, all programming communities have blind-spots. The Haskell community's is that Haskell is safe and safe means that errors are caught at compile-time. Unfortunately* the halting problem stands. When generalized to Rice theorem it says that only trivial properties of programs are algorithmically decidable: http://mathworld.wolfram.com/RicesTheorem.html And so the semantic correctness of a program -- a non-trivial property -- is not decidable. In short the Haskell dream is a pipe-dream**. Discussed in more detail here: http://blog.languager.org/2012/08/functional-programming-philosophical.html. Nevertheless I need to say: If a programmers comes to python from Haskell, he will end up being a better programmer than one coming from C or Java or? * actually fortunately considering that for most of us programming is our job :-) ** Haskellers would point out that there is agda which grows out of Haskell and in agda one can encode arbitrary properties of types. From jeanpierreda at gmail.com Thu Jun 6 14:44:02 2013 From: jeanpierreda at gmail.com (Devin Jeanpierre) Date: Thu, 6 Jun 2013 14:44:02 -0400 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <57582781-3bc1-4ec5-a8b9-485453a89105@a9g2000pbq.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <57582781-3bc1-4ec5-a8b9-485453a89105@a9g2000pbq.googlegroups.com> Message-ID: Super OT divergence because I am a loser nerd: On Thu, Jun 6, 2013 at 1:27 PM, rusi wrote: > Yes, all programming communities have blind-spots. The Haskell > community's is that Haskell is safe and safe means that errors are > caught at compile-time. I don't think Haskell people believe this with the thoroughness you describe. There are certainly haskell programmers that are aware of basic theory of computation. > Unfortunately* the halting problem stands. When generalized to Rice > theorem it says that only trivial properties of programs are > algorithmically decidable: > http://mathworld.wolfram.com/RicesTheorem.html > > And so the semantic correctness of a program -- a non-trivial property > -- is not decidable. Just because a problem is NP-complete or undecidable, doesn't mean there aren't techniques that give the benefits you want (decidability, poly-time) for a related problem. Programmers often only or mostly care about that related problem, so it isn't the end of the line just when we hit this stumbling block. As far as undecidability goes, one possibility is to accept a subset of desired programs. For example, restrict the language to not be turing complete, and there is no problem. Another resolution to the problem of undecidability is to accept a _superset_ of the collection you want. This permits some programs without the property we want, but it's often acceptable anyway. A third approach is to attach proofs, and only accept a program with an attached and correct proof of said property. This is a huge concept, vital to understanding complexity theory. It may be undecidable to find a proof, but once it is found, it is decidable to check the proof against the program. Haskell takes something akin to the second approach, and allows errors to exist which would require "too much work" to eliminate at compile time. (Although the type system is a literal case of the first resolution). Python, by contrast, often values flexibility over correctness, regardless of how easy it might be to check an error at compile time. The two languages have different philosophies, and that is something to respect. The reduction to Rice's theorem does not respect the trade-off that Haskell is making, it ignores it. It may be a "pipe dream" to get everything ever, but that's not to say that the entire approach is invalid and that we should ignore how Haskell informs the PL discourse. For some reason both the Python and Haskell communities feel the other is foolish and ignorant, dismissing their opinions as unimportant babbling. I wish that would stop. -- Devin From rustompmody at gmail.com Thu Jun 6 23:03:57 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 20:03:57 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <57582781-3bc1-4ec5-a8b9-485453a89105@a9g2000pbq.googlegroups.com> Message-ID: On Jun 6, 11:44?pm, Devin Jeanpierre wrote: > > > Unfortunately* the halting problem stands. When generalized to Rice > > theorem it says that only trivial properties of programs are > > algorithmically decidable: > >http://mathworld.wolfram.com/RicesTheorem.html > > > And so the semantic correctness of a program -- a non-trivial property > > -- is not decidable. > > Just because a problem is NP-complete or undecidable, doesn't mean > there aren't techniques that give the benefits you want (decidability, > poly-time) for a related problem. Programmers often only or mostly > care about that related problem, so it isn't the end of the line just > when we hit this stumbling block. > > As far as undecidability goes, one possibility is to accept a subset > of desired programs. For example, restrict the language to not be > turing complete, and there is no problem. > > Another resolution to the problem of undecidability is to accept a > _superset_ of the collection you want. This permits some programs > without the property we want, but it's often acceptable anyway. > > A third approach is to attach proofs, and only accept a program with > an attached and correct proof of said property. This is a huge > concept, vital to understanding complexity theory. It may be > undecidable to find a proof, but once it is found, it is decidable to > check the proof against the program. > > Haskell takes something akin to the second approach, and allows errors > to exist which would require "too much work" to eliminate at compile > time. (Although the type system is a literal case of the first > resolution). Python, by contrast, often values flexibility over > correctness, regardless of how easy it might be to check an error at > compile time. The two languages have different philosophies, and that > is something to respect. The reduction to Rice's theorem does not > respect the trade-off that Haskell is making, it ignores it. It may be > a "pipe dream" to get everything ever, but that's not to say that the > entire approach is invalid and that we should ignore how Haskell > informs the PL discourse. > Nice 3-point summary. Could serve as a good antidote to some of the cargo-culting that goes on under Haskell. To make it very clear: In any science, when there are few people they probably understand the science. When the numbers explode, cargo-cult science happens. This does not change the fact that a few do still understand. Haskell is not exception. See below > > On Thu, Jun 6, 2013 at 1:27 PM, rusi wrote: > > Yes, all programming communities have blind-spots. ?The Haskell > > community's is that Haskell is safe and safe means that errors are > > caught at compile-time. > > I don't think Haskell people believe this with the thoroughness you > describe. There are certainly haskell programmers that are aware of > basic theory of computation. Of course! Here's cmccann from Haskell weekly news of May 31: [On reimplementing cryptography in pure Haskell] writing in Haskell lets you use type safety to ensure that all the security holes you create are subtle instead of obvious. Which is showing as parody exactly what I am talking of: All errors cannot be removed algorithmically/mechanically. And here's Bob Harper -- father of SML -- pointing out well-known and less well-known safety problems with Haskell: http://existentialtype.wordpress.com/2012/08/14/haskell-is-exceptionally-unsafe/ ---------- > Super OT divergence because I am a loser nerd: Uh? Not sure I understand? OT: OK: How can you do programming if you dont understand it? I guess in a world where majority do it without understanding, someone who understands (more) will be called 'nerd'? > For some reason both the Python and Haskell communities feel the other > is foolish and ignorant, dismissing their opinions as unimportant > babbling. I wish that would stop. Dunno whether you are addressing me specifically or python folks generally. If me, please remember my post ended with > If a programmer comes to python from Haskell, he will end up being a better programmer than one > coming from C or Java or? If addressed generally, I heartily agree. My proposed course: https://moocfellowship.org/submissions/the-dance-of-functional-programming-languaging-with-haskell-and-python is in this direction. That is it attempts to create a new generation of programmers who will be able to use Haskell's theory-power to pack an extra punch into batteries-included python. More details: http://blog.languager.org/2013/05/dance-of-functional-programming.html From dreamingforward at gmail.com Thu Jun 6 13:59:55 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Thu, 6 Jun 2013 10:59:55 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51b0565d$0$11118$c3e8da3@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: > Whatever benefit there is in declaring the type of a function is lost due > to the inability to duck-type or program to an interface. There's no type > that says "any object with a 'next' method", for example. And having to > declare local variables is a PITA with little benefit. > > Give me a language with type inference, and a nice, easy way to keep duck- > typing, and I'll reconsider. But until then, I don't believe the benefit > of static types comes even close to paying for the extra effort. Okay, I'm going straighten out you foo(l)s once and for all. Python has seduced us all into lazy typing. That's what it is. Manual type checking is obviously inferior to compiler type-checking. This is what I was trying to tell you all with the post of re-vamping the Object model. Python, and I along with it, went towards this idea of a grand god Object that is the father of everything, but it turned out to be the wrong direction. Refer to my post on OOPv2. The fact is, that none of us is close enough to God and the programming art isn't evolved enough to try to accomplish some grand generic object at the top of the ObjectModel. It just isn't. We were better off closer to the machine. Automatic conversion from int to long was good enough. -- MarkJ Tacoma, Washington P.S. See also PythonThreeThousand on wikiwikiweb From Russ.Paielli at gmail.com Thu Jun 6 14:08:52 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Thu, 6 Jun 2013 11:08:52 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51b0565d$0$11118$c3e8da3@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: <94f20dce-3d2a-4817-9ca9-22ce5823809d@googlegroups.com> On Thursday, June 6, 2013 2:29:02 AM UTC-7, Steven D'Aprano wrote: > On Thu, 06 Jun 2013 12:29:44 +1000, Chris Angelico wrote: > > > > > On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano > > > wrote: > > >> On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: > > >>> As for Python, my experience with it is that, as your application > > >>> grows, you start getting confused about what the argument types are or > > >>> are supposed to be. > > >> > > >> Whereas people never get confused about the arguments in static typed > > >> languages? > > >> > > >> The only difference is whether the compiler tells you that you've > > >> passed the wrong type, or your unit test tells you that you've passed > > >> the wrong type. What, you don't have unit tests? Then how do you know > > >> that the code does the right thing when passed data of the right type? > > >> Adding an extra couple of unit tests is not that big a burden. > > > > > > The valid type(s) for an argument can be divided into two categories: > > > Those the compiler can check for, and those the compiler can't check > > > for. Some languages have more in the first category than others, but > > > what compiler can prove that a string is an > > > HTML-special-characters-escaped string? In a very few languages, the > > > compiler can insist that an integer be between 7 and 30, but there'll > > > always be some things you can't demonstrate with a function signature. > > > > > > That said, though, I do like being able to make at least *some* > > > declaration there. It helps catch certain types of error. > > > > *shrug* > > > > I don't terribly miss type declarations. Function argument declarations > > are a bit simpler in Pascal, compared to Python: > > > > > > Function Add(A, B : Integer) : Integer; > > Begin > > Add := A + B; > > End; > > > > > > versus > > > > > > def add(a, b): > > if not (isinstance(a, int) and isinstance(b, int)): > > raise TypeError > > return a + b > Scala also has isInstanceOf[Type] which allows you to do this sort of thing, but of course it would be considered terrible style in Scala. > > > > but not that much simpler. And while Python can trivially support > > multiple types, Pascal cannot. (Some other static typed languages may.) > > > > Whatever benefit there is in declaring the type of a function is lost due > > to the inability to duck-type or program to an interface. There's no type > > that says "any object with a 'next' method", for example. And having to > > declare local variables is a PITA with little benefit. > > > > Give me a language with type inference, and a nice, easy way to keep duck- > > typing, and I'll reconsider. But until then, I don't believe the benefit > > of static types comes even close to paying for the extra effort. Scala has type inference. For example, you can write val x = 1 and the compiler figures out that x is an integer. Scala also has something called structural typing, which I think is more or less equivalent to "duck typing," although I don't think it is used very often. Are you ready to try Scala yet? 8-) From wuwei23 at gmail.com Thu Jun 6 20:53:12 2013 From: wuwei23 at gmail.com (alex23) Date: Thu, 6 Jun 2013 17:53:12 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> Message-ID: <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> On Jun 7, 3:59?am, Mark Janssen wrote: > Okay, I'm going straighten out you foo(l)s once and for all. Gosh, really?! THANKS. > Python has seduced us all into lazy typing. ?That's what it is. Bulshytt. If you have no idea what polymorphism is, you shouldn't even be participating in this conversation. > The fact is, that none of us is close enough to God More bulshytt. From dreamingforward at gmail.com Thu Jun 6 21:44:49 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Thu, 6 Jun 2013 18:44:49 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> Message-ID: >> Python has seduced us all into lazy typing. That's what it is. > > Bulshytt. If you have no idea what polymorphism is, you shouldn't even > be participating in this conversation. I am aware of what it means, but Python doesn't really have it (although it may evolve to it with annotations). But then these debates were over a decade ago. MarkJ Tacoma, Washington From wuwei23 at gmail.com Thu Jun 6 22:03:31 2013 From: wuwei23 at gmail.com (alex23) Date: Thu, 6 Jun 2013 19:03:31 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> Message-ID: On Jun 7, 11:44?am, Mark Janssen wrote: > > Bulshytt. If you have no idea what polymorphism is, you shouldn't even > > be participating in this conversation. > > I am aware of what it means, but Python doesn't really have it You really need to stop commenting when you clearly have no understanding of what you're talking about. From dreamingforward at gmail.com Fri Jun 7 01:01:33 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Thu, 6 Jun 2013 22:01:33 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> Message-ID: On 6/6/13, alex23 wrote: > On Jun 7, 11:44 am, Mark Janssen wrote: >> > Bulshytt. If you have no idea what polymorphism is, you shouldn't even >> > be participating in this conversation. >> >> I am aware of what it means, but Python doesn't really have it > > You really need to stop commenting when you clearly have no > understanding of what you're talking about. "Clearly", okay. You've added a wee bit of constructive argument *if* you're considered reputable to the rest of the list; however, "polymorophism", should really only be considered "true" when specifically in a "functional enclosure". C++ has this, through it's type system, more strictly when there is no references to variables outside the function scope. Python does not. But this all relates to theoretical ObjectArchitecture and ModelsOfComputation that aren't well-understood outside a few specialized folks. Good luck trying to work through the chaff, if you don't want to know the difference. -- MarkJ Tacoma, Washington From steve+comp.lang.python at pearwood.info Thu Jun 6 22:29:08 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 02:29:08 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> Message-ID: <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> On Thu, 06 Jun 2013 18:44:49 -0700, Mark Janssen wrote: >>> Python has seduced us all into lazy typing. That's what it is. >> >> Bulshytt. If you have no idea what polymorphism is, you shouldn't even >> be participating in this conversation. > > I am aware of what it means, but Python doesn't really have it (although > it may evolve to it with annotations). No polymorphism huh? py> len([1, 2, 3]) # len works on lists 3 py> len((1, 2)) # and on tuples 2 py> len({}) # and on dicts 0 py> len('I pity the fool') # and on strings 15 py> len(b'\x23') # and on bytes 1 py> len(set(range(2))) # and on sets 2 py> len(frozenset(range(4))) # and on frozensets 4 py> len(range(1000)) # and on range objects 1000 Looks pretty polymorphic to me. -- Steven From dreamingforward at gmail.com Thu Jun 6 23:14:08 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Thu, 6 Jun 2013 20:14:08 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: >> I am aware of what it means, but Python doesn't really have it (although >> it may evolve to it with annotations). > > No polymorphism huh? > > > py> len([1, 2, 3]) # len works on lists > 3 > py> len((1, 2)) # and on tuples > 2 > py> len({}) # and on dicts > 0 > py> len('I pity the fool') # and on strings > 15 > py> len(b'\x23') # and on bytes > 1 > py> len(set(range(2))) # and on sets > 2 > py> len(frozenset(range(4))) # and on frozensets > 4 > py> len(range(1000)) # and on range objects > 1000 Okay, wow, it looks like we need to define some new computer science terms here. You are making an "outside view of a function" (until a better term is found). So that give you one possible view of polymorphism. However, *within* a class that I would write, you would not see polymorphism like you have in C++, where it is within the *function closure* itself. Instead you would see many if/then combinations to define the behavior given several input types. I would call this simulated polymorphism. But don't quote me on this because I have to review my 20 years of CS and see if it matches what the field says -- if the field has settled on a definition. If not, I go with the C++ definition, and there it is very different than python. But then, you weren't going to quote me anyway, right? -- MarkJ Tacoma, Washington From rustompmody at gmail.com Thu Jun 6 23:24:41 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 20:24:41 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <2a31d89e-c805-47ad-86d0-9f4ffa3edf9c@z10g2000pbn.googlegroups.com> On Jun 7, 8:14?am, Mark Janssen wrote: > >> I am aware of what it means, but Python doesn't really have it (although > >> it may evolve to it with annotations). > > > No polymorphism huh? > > > py> len([1, 2, 3]) ?# len works on lists > > 3 > > py> len((1, 2)) ?# and on tuples > > 2 > > py> len({}) ?# and on dicts > > 0 > > py> len('I pity the fool') ?# and on strings > > 15 > > py> len(b'\x23') ?# and on bytes > > 1 > > py> len(set(range(2))) ?# and on sets > > 2 > > py> len(frozenset(range(4))) ?# and on frozensets > > 4 > > py> len(range(1000)) ?# and on range objects > > 1000 > > Okay, wow, it looks like we need to define some new computer science > terms here. Fairly definitive terms have existed since 1985: http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf > > You are making an "outside view of a function" (until a better term is > found). ?So that give you one possible view of polymorphism. ?However, > *within* a class that I would write, you would not see polymorphism > like you have in C++, ?where it is within the *function closure* > itself. ? Instead you would see many if/then combinations to define > the behavior given several input types. ?I would call this simulated > polymorphism. Cardelli and Wegner cited above call this ad-hoc polymorphism. What you are calling polymorphism, they call universal polymorphism. See sect 1.3 for a summary diagram From dreamingforward at gmail.com Thu Jun 6 23:30:02 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Thu, 6 Jun 2013 20:30:02 -0700 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <2a31d89e-c805-47ad-86d0-9f4ffa3edf9c@z10g2000pbn.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> <2a31d89e-c805-47ad-86d0-9f4ffa3edf9c@z10g2000pbn.googlegroups.com> Message-ID: > Fairly definitive terms have existed since 1985: > http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf >> >> You are making an "outside view of a function" (until a better term is >> found). So that give you one possible view of polymorphism. However, >> *within* a class that I would write, you would not see polymorphism >> like you have in C++, where it is within the *function closure* >> itself. Instead you would see many if/then combinations to define >> the behavior given several input types. I would call this simulated >> polymorphism. > > Cardelli and Wegner cited above call this ad-hoc polymorphism. > What you are calling polymorphism, they call universal polymorphism. Okay, THANK YOU for the reference. The main thing to note is that there is a difference. Those terms sound good enough. -- MarkJ Tacoma, Washington From rustompmody at gmail.com Thu Jun 6 23:43:23 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 20:43:23 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> <2a31d89e-c805-47ad-86d0-9f4ffa3edf9c@z10g2000pbn.googlegroups.com> Message-ID: On Jun 7, 8:24?am, rusi wrote: > On Jun 7, 8:14?am, Mark Janssen wrote: > > > > > > > > > > > >> I am aware of what it means, but Python doesn't really have it (although > > >> it may evolve to it with annotations). > > > > No polymorphism huh? > > > > py> len([1, 2, 3]) ?# len works on lists > > > 3 > > > py> len((1, 2)) ?# and on tuples > > > 2 > > > py> len({}) ?# and on dicts > > > 0 > > > py> len('I pity the fool') ?# and on strings > > > 15 > > > py> len(b'\x23') ?# and on bytes > > > 1 > > > py> len(set(range(2))) ?# and on sets > > > 2 > > > py> len(frozenset(range(4))) ?# and on frozensets > > > 4 > > > py> len(range(1000)) ?# and on range objects > > > 1000 > > > Okay, wow, it looks like we need to define some new computer science > > terms here. > > Fairly definitive terms have existed since 1985:http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf > > > > > You are making an "outside view of a function" (until a better term is > > found). ?So that give you one possible view of polymorphism. ?However, > > *within* a class that I would write, you would not see polymorphism > > like you have in C++, ?where it is within the *function closure* > > itself. ? Instead you would see many if/then combinations to define > > the behavior given several input types. ?I would call this simulated > > polymorphism. > > Cardelli and Wegner cited above call this ad-hoc polymorphism. > What you are calling polymorphism, they call universal polymorphism. > > See sect 1.3 for a summary diagram I should have added that python has the universal polymorphism that you want: $ python Python 2.7.5 (default, May 20 2013, 13:49:25) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> len([1,2]) 2 >>> len([[1,2]]) 1 >>> len([[[1,2]],[[3]],[[4,5]]]) 3 >>> The main thing to note about universal -> parametric polymorphism is that one definition works for an infinite set of types, without any extra code(ing) From rantingrickjohnson at gmail.com Thu Jun 6 11:49:42 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 6 Jun 2013 08:49:42 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: On Wednesday, June 5, 2013 11:59:07 AM UTC-5, Chris Angelico wrote: > Frankly, I don't think the language much matters. It's all > down to the skill of the programmers and testers. Ada > wasn't the source of the problem unless Ada has a bug in > it... which is going to be true of pretty much any > language. Maybe Python would be a better choice, maybe > not; but let me tell you this, if the choice of language > means the difference between testable in three months and > testable code in three years, I'm going for the former. Yes EVEN IF life or property hangs in the balance, the only important decision is how much work YOU will be required to do -- Chris, why i am not amazed by this bombastic display of selfishness? From rosuav at gmail.com Thu Jun 6 12:00:14 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 02:00:14 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 1:49 AM, Rick Johnson wrote: > On Wednesday, June 5, 2013 11:59:07 AM UTC-5, Chris Angelico wrote: > >> Frankly, I don't think the language much matters. It's all >> down to the skill of the programmers and testers. Ada >> wasn't the source of the problem unless Ada has a bug in >> it... which is going to be true of pretty much any >> language. Maybe Python would be a better choice, maybe >> not; but let me tell you this, if the choice of language >> means the difference between testable in three months and >> testable code in three years, I'm going for the former. > > Yes EVEN IF life or property hangs in the balance, the only important decision is how much work YOU will be required to do -- Chris, why i am not amazed by this bombastic display of selfishness? I would like to say that you're not amazed because you're intelligent enough to understand what I was saying, but I'm not sure it'd be true. Let me spell it out for you. * Deadlines are real things. They make a very audible "whooosh" as they go past. * If the time frame for developing this is five years, then in five years, the code must either be shipped or scrapped. * Taking three years to get to a testable codebase allows two years to test. * Taking three months to get testable allows over four years to test. Would you say that doubling the testing period is a good thing or a bad thing? ChrisA From invalid at invalid.invalid Thu Jun 6 13:32:42 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Thu, 6 Jun 2013 17:32:42 +0000 (UTC) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: On 2013-06-06, Chris Angelico wrote: > Would you say that doubling the testing period is a good thing or a > bad thing? It could be a neutral thing (ignoring the costs involved). I once read read an article claiming that as you test (and fix) any large, complex piece of software, you asymptotically approach a certain fixed "minimum number of bugs" that's determined by the system's overall architecture, design and implentation. Once you get sufficiently close to that minimum, additional testing doesn't reduce the number/severity of bugs -- it just "moves them around" by creating additional bugs at the same rate you are eliminating old ones. When you get to that point, the only way to significantly improve the situation is to toss the whole thing out and start over with a better system architecture and/or development model. After having maintined a few largish pieces of software for well over a decade, I'm fairly convinced that's true -- especially if you also consider post-deployment maintenance (since at that point you're usually also trying to add features at the same time you're fixing bugs). -- Grant Edwards grant.b.edwards Yow! I just went below the at poverty line! gmail.com From steve+comp.lang.python at pearwood.info Wed Jun 5 21:37:20 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 01:37:20 GMT Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> Message-ID: <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> On Wed, 05 Jun 2013 09:15:01 -0700, Russ P. wrote: > On Wednesday, June 5, 2013 1:59:01 AM UTC-7, Mark Lawrence wrote: >> On 05/06/2013 07:11, Russ P. wrote: >> >> > But then, what would you expect of a language that allows you to >> > write >> > >> > x = 1 >> > x = "Hello" >> > >> > It's all loosey goosey -- which is fine for many applications but >> > certainly not for critical ones. >> > >> >> >> I want to launch this rocket with an expensive satellite on top. I >> know it's safe as the code is written in ADA. Whoops :( > > > So Python would have been a better choice? Yeah, right. Putting issues of efficiency aside, yes, it probably would have. Had the programmers not been so sure that the compiler was protecting them from bugs, a misplaced hope if there ever was one, they might have written some tests and noticed that their simulated rocket launch ended up going boom instead of into orbit. I'm referring to the first test flight of the Ariane 5, which failed due to a software bug. There was no actual satellite on this flight. The failure Mark refers to was due to a leak in coolant pipes, which of course is a hardware problem and cannot be blamed on the software. http://en.wikipedia.org/wiki/Ariane_5#Notable_launches > If you know > anything about that rocket mishap, you should know that Ada was not the > source of the problem. Ada won't keep airplane wings from breaking > either, by the way. It's not magic. Again, referring to the infamous 64-bit float to 16-bit integer bug, Ada may not have been the *source* of the problem, but neither did it prevent it. What prevents bugs is the skill of the people writing the code, not the compiler. Compile-time static type checking is merely a tool, which has costs and benefits. It is ludicrous to think that any one single tool, or the lack of that tool, will make all the difference between working code and non-working code. Static type-checking is no better, or worse, for "critical code" than dynamic type-checking. One language chooses to deal with some errors at compile-time, others deal with them at run-time. Either way, the programmer has to deal with them in some way. A static type system forces you to deal with a limited subset of errors, "type errors", in one way only: by removing any execution paths in the software which would assign data of type X to a variable of type Y. For reasons of machine efficiency, that is often a good was to deal with such errors. But a dynamic type system makes different trade-offs. And of course, type errors are such a vanishingly small subset of all the possible errors that might be made that, frankly, the difference in code quality between those with static typing and those without is essentially indistinguishable. There's no evidence that code written in static typed languages is less buggy than code written in dynamic languages. -- Steven From rosuav at gmail.com Wed Jun 5 21:45:24 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 11:45:24 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 6, 2013 at 11:37 AM, Steven D'Aprano wrote: > What prevents bugs is the skill of the people writing the code, not the > compiler. +1 QOTW. ChrisA From rustompmody at gmail.com Thu Jun 6 10:09:54 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 07:09:54 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Jun 6, 6:45?am, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 11:37 AM, Steven D'Aprano > > wrote: > > What prevents bugs is the skill of the people writing the code, not the > > compiler. > > +1 QOTW. In many Indian languages there is a saying: A poor dancer blames the crooked floor. [Yeah? sounds tame in English] -- which is probably what Steven is saying. However in defence of the crooked floor? When I taught C at the university in the early 90s[1], every third/ fourth compile+run of the kids would result in 'segmentation fault' if they were lucky enough to be on unix, and OS crashes if they were on DOS. At first I would rail at the kids for not doing due diligence. Over time I came to the conclusion that if a system is designed in such a way that everyone is wrong, then its the system that is wrong and not everyone. When we switched from to python (via Scheme and a haskell- predecessor), I dont remember ever getting a segmentation fault. [Well once RR gave some Wx code that I tried and python core dumped. Whether this speaks for RR or Wx or a dangerous combo...] So yes, elegant programming languages are not proof against inelegant programmers. Nevertheless, programming languages can be made in a way that makes certain class of errors harder/easier to make. Joel Spolsky moans that: Java is not, generally, a hard enough programming language that it can be used to discriminate between great programmers and mediocre programmers. http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html And Paul Graham is even more provocative: Java programmers are not as smart as python programmers http://www.paulgraham.com/gh.html [1] Prompted a paper in the 90s, with some modernizing modifications http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html From rosuav at gmail.com Thu Jun 6 11:26:40 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 01:26:40 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Fri, Jun 7, 2013 at 12:09 AM, rusi wrote: > When we switched from to python (via Scheme and a haskell- > predecessor), I dont remember ever getting a segmentation fault. Oh, it's easy to segfault Python. import sys sys.setrecursionlimit(999999999) def foo(): foo() foo() :) ChrisA From rustompmody at gmail.com Thu Jun 6 11:36:05 2013 From: rustompmody at gmail.com (rusi) Date: Thu, 6 Jun 2013 08:36:05 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <3df52c82-da50-4770-8646-97de65196ecd@v5g2000pbv.googlegroups.com> On Jun 6, 8:26?pm, Chris Angelico wrote: > On Fri, Jun 7, 2013 at 12:09 AM, rusi wrote: > > When we switched from to python (via Scheme and a haskell- > > predecessor), I dont remember ever getting a segmentation fault. > > Oh, it's easy to segfault Python. > > import sys > sys.setrecursionlimit(999999999) > def foo(): foo() > foo() > > :) > > ChrisA And so you are hereby anointed into the august company of RR!! From rosuav at gmail.com Thu Jun 6 11:46:31 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 01:46:31 +1000 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <3df52c82-da50-4770-8646-97de65196ecd@v5g2000pbv.googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> <3df52c82-da50-4770-8646-97de65196ecd@v5g2000pbv.googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 1:36 AM, rusi wrote: > On Jun 6, 8:26 pm, Chris Angelico wrote: >> On Fri, Jun 7, 2013 at 12:09 AM, rusi wrote: >> > When we switched from to python (via Scheme and a haskell- >> > predecessor), I dont remember ever getting a segmentation fault. >> >> Oh, it's easy to segfault Python. >> >> import sys >> sys.setrecursionlimit(999999999) >> def foo(): foo() >> foo() >> >> :) >> >> ChrisA > > And so you are hereby anointed into the august company of RR!! Eh? No, I'm just adept at breaking stuff... I could probably segfault a 100Mbit switch if I tried (or just got careless). ChrisA From rantingrickjohnson at gmail.com Thu Jun 6 14:03:24 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 6 Jun 2013 11:03:24 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <110c91d8-2447-4c5c-9e4d-f3b20ca16070@googlegroups.com> On Wednesday, June 5, 2013 8:37:20 PM UTC-5, Steven D'Aprano wrote: > On Wed, 05 Jun 2013 09:15:01 -0700, Russ P. wrote: > > On Wednesday, June 5, 2013 1:59:01 AM UTC-7, Mark Lawrence wrote: > >> On 05/06/2013 07:11, Russ P. wrote: > What prevents bugs is the skill of the people writing the code, not the > compiler. Compile-time static type checking is merely a tool, which has > costs and benefits. It is ludicrous to think that any one single tool, or > the lack of that tool, will make all the difference between working code > and non-working code. Yes, just as ludicrous as thinking that dynamic languages have abolished the evil practice of "type checking". > Static type-checking is no better, or worse, for "critical code" than > dynamic type-checking. One language chooses to deal with some errors at > compile-time, others deal with them at run-time. Wow, talk about ignoring the elephant in the room! I don't feel i need static typed languages for EVERY problem, however, i'm not foolish enough to believe that "compile time type checking" and "run-time type checking" are even comparable. Oversimplification? > Either way, the > programmer has to deal with them in some way. > A static type system forces you to deal with a limited subset of errors, > "type errors", in one way only: by removing any execution paths in the > software which would assign data of type X to a variable of type Y. For > reasons of machine efficiency, that is often a good was to deal with such > errors. But a dynamic type system makes different trade-offs. > And of course, type errors are such a vanishingly small subset of all the > possible errors that might be made that, frankly, the difference in code > quality between those with static typing and those without is essentially > indistinguishable. There's no evidence that code written in static typed > languages is less buggy than code written in dynamic languages. WOW! Your skill with the implicit Ad hominem is approaching guru status. First you cleverly convert the base argument of this ongoing discussion from: "implicit conversion to boolean is bad", into the hot button topic of: "static vs dynamic typing". In this manner you can ratchet up the emotion of your supporters by employing the same political "slight of hand" used by countless political hacks: "Liberal vs Republican" ring a bell? When there is only two choices, the sheeple can be easily manipulated by the football game. Especially when the opposing sides have the same end-goal in mind. It's all a game of diversions you idiots! Then you go and make a blanket statement that "appears" to weigh the differences of the two styles fairly, when in fact, what you've done is to falsely invalidate the opposition's entire argument based on a complete overstatement (not to mention that you stopped short of explaining the "trade offs" in detail): > And of course, type errors are such a vanishingly > small subset of all the possible errors that might be > made that, frankly, the difference in code quality > between those with static typing and those without is > essentially indistinguishable. Nice! Well, then. You've slayed the enemy. If type errors are as rare as you claim, then by golly these crazy people who use static languages are really just fools. I mean, how could they not be? If they were as intelligent as YOU then they would see the truth! Your attempts at sleight of hand are rather amusing. The whole point of this "implicit conversion to Boolean" discussion hinges around the fact that dynamic languages are okay for small to medium problems ( or for prototyping larger problems). But they cannot be depended on for mission critical code. And mission critical does not only encompass manned flights to mars, it could be any code that places your reputation on the line. I don't want Python to be a static typed language. Neither do i believe that duck typing is wrong for Python. HOWEVER, what i DO believe is that dynamic languages can be unreliable if we do not: 1. Choose to be "explicit enough" I've explained this in detail Ad-nauseam. 2. Fail to type check where type checking is due. The second covers type checking objects that enter into new namespaces. That would cover all functions/methods arguments (at a minimum). We don't need to type check EVERY single object (but of course the programmer could IF he wanted to). If i declare a variable[1] that points to a list in a block of code, then i reference that variable[1] in the same block of code, i see no reason to type check that variable[1] first. That is overkill and that is why people are turned off by static languages. However, if i declare the same variable[1] and then pass that variable[1] into a function, the function should do a type check on all the arguments to guarantee that these arguments are in fact what they should be. This is how you strike a balance between explicit and implicit. This is how you inject sanity into your code bases. [1]: stop your whining already about "python does not have variables". The word variable has both a technical meaning (which is another example of transforming a word improperly) and a general meaning. When used in a Python context the word "variable" takes on it's general meaning. Feel free to consult a dictionary if your still confused. From rantingrickjohnson at gmail.com Thu Jun 6 14:11:17 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 6 Jun 2013 11:11:17 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: <110c91d8-2447-4c5c-9e4d-f3b20ca16070@googlegroups.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <51afe7cf$0$29966$c3e8da3$5496439d@news.astraweb.com> <110c91d8-2447-4c5c-9e4d-f3b20ca16070@googlegroups.com> Message-ID: On Thursday, June 6, 2013 1:03:24 PM UTC-5, Rick Johnson wrote: > The second covers type checking objects that enter into new > namespaces. That would cover all functions/methods arguments > (at a minimum). Yeah, before anyone starts complaining about this, i meant to say "scope". Now you can focus on the *real* argument instead of spending all your time pointing out minutiae. From torriem at gmail.com Wed Jun 5 19:18:13 2013 From: torriem at gmail.com (Michael Torrie) Date: Wed, 05 Jun 2013 17:18:13 -0600 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51AFC735.1080004@gmail.com> On 06/05/2013 12:11 AM, Russ P. wrote: > But then, what would you expect of a language that allows you to > write > > x = 1 > x = "Hello" > > It's all loosey goosey -- which is fine for many applications but > certainly not for critical ones. This comment shows me that you don't understand the difference between names, objects, and variables. May sound like a minor quibble, but there're actually major differences between binding names to objects (which is what python does) and variables (which is what languages like C have). It's very clear Rick does not have an understanding of this either. From Russ.Paielli at gmail.com Wed Jun 5 19:52:33 2013 From: Russ.Paielli at gmail.com (Russ P.) Date: Wed, 5 Jun 2013 16:52:33 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wednesday, June 5, 2013 4:18:13 PM UTC-7, Michael Torrie wrote: > On 06/05/2013 12:11 AM, Russ P. wrote: > > > But then, what would you expect of a language that allows you to > > > write > > > > > > x = 1 > > > x = "Hello" > > > > > > It's all loosey goosey -- which is fine for many applications but > > > certainly not for critical ones. > > > > This comment shows me that you don't understand the difference between > > names, objects, and variables. May sound like a minor quibble, but > > there're actually major differences between binding names to objects > > (which is what python does) and variables (which is what languages like > > C have). It's very clear Rick does not have an understanding of this > > either. My comment shows you nothing about what I understand about names, objects, and variables. You have chosen to question my understanding apparently because my point bothered you but you don't have a good reply. Then you link me with Rick for good measure. That's two ad hominems in three sentences. From torriem at gmail.com Wed Jun 5 21:20:59 2013 From: torriem at gmail.com (Michael Torrie) Date: Wed, 05 Jun 2013 19:20:59 -0600 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <51AFE3FB.6020503@gmail.com> On 06/05/2013 05:52 PM, Russ P. wrote: > My comment shows you nothing about what I understand about names, > objects, and variables. Yes that probably is true. > You have chosen to question my understanding apparently because my > point bothered you but you don't have a good reply. Then you link me > with Rick for good measure. That's two ad hominems in three > sentences. Your statement didn't bother me. I just felt, perhaps erroneously, that such a comment needs clarification. We get into trouble in python when we get caught up in treating python names exactly like variables and blame it on the lack of static typing. In uni we looked at various means of dealing with the name covering/hiding issue including renaming or requiring that each binding be a unique name (meaning the second x = "hello word" statement would be a runtime error). Anyway, I got a bit distracted by your example of using the same name twice with different objects when the real issue that can cause pain is function call parameter expectation. My apologies for linking you to Rick. You're right that was an ad-hominem attack, though I didn't intend that! From rantingrickjohnson at gmail.com Thu Jun 6 12:24:57 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 6 Jun 2013 09:24:57 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Wednesday, June 5, 2013 6:18:13 PM UTC-5, Michael Torrie wrote: > On 06/05/2013 12:11 AM, Russ P. wrote: > > But then, what would you expect of a language that allows you to > > write > > x = 1 > > x = "Hello" > > It's all loosey goosey -- which is fine for many applications but > > certainly not for critical ones. > This comment shows me that you don't understand the difference between > names, objects, and variables. May sound like a minor quibble, but > there're actually major differences between binding names to objects > (which is what python does) and variables (which is what languages like > C have). It's very clear Rick does not have an understanding of this > either. Just because someone does not "prefer" this or that aspect of Python, does not mean they don't understand it. I understand "implicit conversion to Boolean" just fine, however, i don't like it. Actually, i hate it! I think it's foolish. It was invented by people who rather save a few keystrokes at the cost writing cryptic code. There are many good reasons for saving keystrokes, implicit conversion to Boolean is NOT one of them. I make the same argument for "return". Some languages allow implicit return values from functions/methods. When writing a function with Ruby, the return statement is optional: ## START RUBY CODE ## def foo: "implicit return" end rb> puts foo "implicit return" ## END RUBY CODE ## This is one area where Python shines! In Python, if you fail to use the return statement, then Python will return None, NOT some some value that just happens to be the last line executed in the function -- Ruby breaks the law of least astonishment. The point is we must balance our selfish need to save keystrokes against the need of a reader to QUICKLY understand what he is reading. Python's "explicit return statement" satisfies both requirements, whereas, the optional return value of Ruby does not. We don't want to overly implicit, or overly explicit (as in the nightmare of "public static void foo", which is overkill (at least for a language as high level as Python)). From jeanpierreda at gmail.com Thu Jun 6 12:39:59 2013 From: jeanpierreda at gmail.com (Devin Jeanpierre) Date: Thu, 6 Jun 2013 12:39:59 -0400 Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: On Thu, Jun 6, 2013 at 12:24 PM, Rick Johnson wrote: > In Python, if you fail to use the return statement, then Python will return None, NOT some some value that just happens to be the last line executed in the function -- Ruby breaks the law of least astonishment. Ruby comes from a tradition where this behavior is not astonishing. Languages do not exist in a vacuum. -- Devin From wuwei23 at gmail.com Thu Jun 6 20:55:29 2013 From: wuwei23 at gmail.com (alex23) Date: Thu, 6 Jun 2013 17:55:29 -0700 (PDT) Subject: Bools and explicitness [was Re: PyWart: The problem with "print"] References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Message-ID: <9c3cf384-e627-4f52-96a7-2cf4f85c4bb6@qz2g2000pbb.googlegroups.com> On Jun 7, 2:39?am, Devin Jeanpierre wrote: > Languages do not exist in a vacuum. They do if all you use them for is academic point scoring over practical purposes. From rosuav at gmail.com Tue Jun 4 03:30:25 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 17:30:25 +1000 Subject: PyWart: The problem with "print" In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Tue, Jun 4, 2013 at 11:37 AM, Rick Johnson wrote: > The print function is the very definition of a "syntactic sugar". > > For example: > print("some sting") > > is much more readable than: > > sys.stdout.write("some string"+"\n") > ... > Again, the removal of a print function (or print statement) > will not prevent users from calling the write method on > sys.stdout or sys.stderr (or ANY "stream object" for that matter!) And you could abolish ALL of the builtins by requiring that you import ctypes and implement them all yourself. That is not the point of the term. If print() is mere syntactic sugar, then everything is syntactic sugar for Brainf* code. The point of syntactic sugar is that there is a trivially-equivalent underlying interpretation. For instance, in C, array subscripting is trivially equivalent to addition and dereferencing: a[i] <-> *(a+i) This is syntactic sugar. The Python print() function does much more than write(), so it is NOT syntactic sugar. > Many times you'll get a result (or an input) that you expect > to be a Boolean, but instead is a string. A good example of > poor coding is "dialog box return values". Take your > standard yes/no/cancel dialog, i would expect it to return > True|False|None respectively, HOWEVER, some *idiot* decided > to return the strings 'yes'|'no'|'cancel'. Why True|False|None? Why should they represent Yes|No|Cancel? Especially, *why None*? What has None to do with Cancel? > However, with Python's implicit conversion to Boolean, the > same conditional will ALWAYS be True: because any string > that is not the null string is True (as far as Python is > concerned). This is an example of Python devs breaking TWO > Zens at once: > > "explicit is better than implicit" > "errors should NEVER pass silently" Right, because it's Python's fault that you can't use implicit boolean conversion to sanely test for something that has three possible outcomes. I think there's something in the nature of a boolean test that makes this awkward, but I can't quite see it... hmm, some kind of integer issue, I think... > Obviously you don't appreciate the value of "explicit enough". > > if VALUE: > > is not explicit enough, however > > if bool(VALUE) > > or at least: > > if VALUE == True > > is "explicit enough". Why? The 'if' implies a boolean context. In C, it's common to compare integers for nonzeroness with a bare if; it's also common, though far from universal, to compare strings for nullness - effectively equivalent to "is not None". You don't need to be any more explicit than that. Granted, the definitions of truthiness differ from language to language. In C, a NULL pointer is false and any actual pointer is true, so an empty string is true (to the extent that C even has the concept of strings, but leave that aside). In Pike, any array is true, but the absence of an array can be indicated with (effectively) a null, whereas Python deems that an empty list is false. Still, most languages do have some system of coercion-to-boolean. (Notable exception: REXX. An IF statement will accept *only* the two permitted boolean values, anything else is an error.) > However, if i choose to be explicit and use: > > "if len(VALUE) > 0: > > then the code will fail when it should: at the comparison > line. Because any object that does not provide a __len__ > method would cause Python to raise NameError. I thought you were dead against wasting CPU cycles! Your code here has to calculate the actual length of the object, then compare it with zero; the simple boolean check merely has to announce the presence or absence of content. This is a HUGE difference in performance, and you should totally optimize this down for the sake of that. Don't bother measuring it, this will make more difference to your code than replacing bubble sort with bogosort! ChrisA From bakbakinfo123 at gmail.com Sun Jun 2 14:19:46 2013 From: bakbakinfo123 at gmail.com (bakbakinfo123 at gmail.com) Date: Sun, 2 Jun 2013 11:19:46 -0700 (PDT) Subject: Arp cache poisoning using scapy Message-ID: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> I am trying to get the arp cache poisoning working with scapy and python but having problems The python script itself is very simple: root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# cat arp_poison.py #!/usr/bin/env python import sys from scapy.all import * arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") The error I am getting is illegal IP address. How do I fix it? root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# python arp_poison.py WARNING: No route found for IPv6 destination :: (no default route?) Traceback (most recent call last): File "arp_poison.py", line 7, in arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 440, in arpcachepoison tmac = getmacbyip(target) File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 53, in getmacbyip tmp = map(ord, inet_aton(ip)) socket.error: illegal IP address string passed to inet_aton root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# From drsalists at gmail.com Sun Jun 2 15:16:25 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Sun, 2 Jun 2013 12:16:25 -0700 Subject: Arp cache poisoning using scapy In-Reply-To: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> References: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> Message-ID: On Sun, Jun 2, 2013 at 11:19 AM, wrote: > > I am trying to get the arp cache poisoning working with scapy and python > but having problems > > The python script itself is very simple: > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# cat arp_poison.py > #!/usr/bin/env python > > import sys > > from scapy.all import * > > arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") > > The error I am getting is illegal IP address. How do I fix it? > It looks to me like arpcachepoison wants two IP's, not a MAC and an IP. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bakbakinfo123 at gmail.com Sun Jun 2 16:46:31 2013 From: bakbakinfo123 at gmail.com (bakbakinfo123 at gmail.com) Date: Sun, 2 Jun 2013 13:46:31 -0700 (PDT) Subject: Arp cache poisoning using scapy In-Reply-To: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> References: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> Message-ID: <9404d1dc-c584-4797-b5d4-f25cec0fa09c@googlegroups.com> On Sunday, June 2, 2013 11:19:46 AM UTC-7, bakbak... at gmail.com wrote: > I am trying to get the arp cache poisoning working with scapy and python but having problems > > > > The python script itself is very simple: > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# cat arp_poison.py > > #!/usr/bin/env python > > > > import sys > > > > from scapy.all import * > > > > arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") > > > > The error I am getting is illegal IP address. How do I fix it? > > > > > > > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# python arp_poison.py > > WARNING: No route found for IPv6 destination :: (no default route?) > > Traceback (most recent call last): > > File "arp_poison.py", line 7, in > > arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") > > File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 440, in arpcachepoison > > tmac = getmacbyip(target) > > File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 53, in getmacbyip > > tmp = map(ord, inet_aton(ip)) > > socket.error: illegal IP address string passed to inet_aton > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# This works. Although it shouldn't. The documentation should be changed to reflect this. As per document: arpcachepoison arpcachepoison(target,victim,interval=60) Poison target?s cache with (your MAC,victim?s IP) It makes more sense to assign a MAC to the vitim ip to falsly claim and poison the network so ideally the documentation is correct the the command does not work as such. However the command with 2 IPs does the thing correctly. So change documentation? How do one go about it? Also all the items in () need to have "" or it gives syntax error. Is that how it should work? From bakbakinfo123 at gmail.com Sun Jun 2 16:47:29 2013 From: bakbakinfo123 at gmail.com (bakbakinfo123 at gmail.com) Date: Sun, 2 Jun 2013 13:47:29 -0700 (PDT) Subject: Arp cache poisoning using scapy In-Reply-To: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> References: <609f0450-4ab7-4489-87c6-5926bb09d1fd@googlegroups.com> Message-ID: <737720e6-67df-4e2a-87a6-f2416e42531e@googlegroups.com> On Sunday, June 2, 2013 11:19:46 AM UTC-7, bakbak... at gmail.com wrote: > I am trying to get the arp cache poisoning working with scapy and python but having problems > > > > The python script itself is very simple: > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# cat arp_poison.py > > #!/usr/bin/env python > > > > import sys > > > > from scapy.all import * > > > > arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") > > > > The error I am getting is illegal IP address. How do I fix it? > > > > > > > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# python arp_poison.py > > WARNING: No route found for IPv6 destination :: (no default route?) > > Traceback (most recent call last): > > File "arp_poison.py", line 7, in > > arpcachepoison("00:22:fa:98:5e:04", "192.168.1.131") > > File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 440, in arpcachepoison > > tmac = getmacbyip(target) > > File "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 53, in getmacbyip > > tmp = map(ord, inet_aton(ip)) > > socket.error: illegal IP address string passed to inet_aton > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# > > root at ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# From fsdama at gmail.com Sun Jun 2 21:12:33 2013 From: fsdama at gmail.com (Fdama) Date: Sun, 2 Jun 2013 18:12:33 -0700 (PDT) Subject: Issue converting to string to integer. Message-ID: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> Hi, I was following an exercise in a book when I edited the code and came across something I did not get. Here is the relevant part of the code that works: start=None #initialise while start !="": start=input("\nStart: ") if start: start=int(start) finish=int(input("Finish: ")) print("word[",start,":",finish,"] is", word[start:finish]) I then changed the code to this: start=None #initialise while start !="": start=int(input("\nStart: ")) if start: finish=int(input("Finish: ")) print("word[",start,":",finish,"] is", word[start:finish]) I combined the int conversion and the input on the same line, rather than to have two different statements. But got an error message: Traceback (most recent call last): File "C:\Users\Faisal\Documents\python\pizza_slicer.py", line 23, in start=int(input("\nStart: ")) ValueError: invalid literal for int() with base 10: '' Could someone tell me why I got this error message? Thanks From drsalists at gmail.com Sun Jun 2 21:44:02 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Sun, 2 Jun 2013 18:44:02 -0700 Subject: Issue converting to string to integer. In-Reply-To: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> References: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> Message-ID: On Sun, Jun 2, 2013 at 6:12 PM, Fdama wrote: > Hi, > > I was following an exercise in a book when I edited the code and came > across something I did not get. Here is the relevant part of the code that > works: > > start=None #initialise > while start !="": > start=input("\nStart: ") > > if start: > start=int(start) > finish=int(input("Finish: ")) > > print("word[",start,":",finish,"] is", word[start:finish]) > > I then changed the code to this: > > start=None #initialise > while start !="": > start=int(input("\nStart: ")) > > if start: > > finish=int(input("Finish: ")) > > print("word[",start,":",finish,"] is", word[start:finish]) > > I combined the int conversion and the input on the same line, rather than > to have two different statements. But got an error message: > > Traceback (most recent call last): > File "C:\Users\Faisal\Documents\python\pizza_slicer.py", line 23, in > > start=int(input("\nStart: ")) > ValueError: invalid literal for int() with base 10: '' > Converting an empty string to base 10 doesn't fly, so if you hit a blank line on the input(), you get a bad conversion. In the first version, you're only converting to base 10 if the string is non-empty. In the second, you're attempting to convert irrespective. BTW, I'm partial to: if not start: continue ...but that's a stylistic thing. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan at tombstonezero.net Sun Jun 2 21:52:35 2013 From: dan at tombstonezero.net (Dan Sommers) Date: Mon, 03 Jun 2013 01:52:35 GMT Subject: Issue converting to string to integer. References: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> Message-ID: On Sun, 02 Jun 2013 18:12:33 -0700, Fdama wrote: > I combined the int conversion and the input on the same line, rather > than to have two different statements. But got an error message: > Traceback (most recent call last): > File "C:\Users\Faisal\Documents\python\pizza_slicer.py", line 23, in > start=int(input("\nStart: ")) > ValueError: invalid literal for int() with base 10: '' > > Could someone tell me why I got this error message? The difference is what used to happen in between the input and the conversion. In the first version, the "if" statement prevents the conversion from happening when there is no input. In the second version, though, python tries to do the conversion with no input, and fails. Dan From rosuav at gmail.com Sun Jun 2 22:08:07 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 3 Jun 2013 12:08:07 +1000 Subject: Issue converting to string to integer. In-Reply-To: References: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> Message-ID: On Mon, Jun 3, 2013 at 11:52 AM, Dan Sommers wrote: > On Sun, 02 Jun 2013 18:12:33 -0700, Fdama wrote: > >> I combined the int conversion and the input on the same line, rather >> than to have two different statements. But got an error message: > >> Traceback (most recent call last): >> File "C:\Users\Faisal\Documents\python\pizza_slicer.py", line 23, in >> start=int(input("\nStart: ")) >> ValueError: invalid literal for int() with base 10: '' >> >> Could someone tell me why I got this error message? > > The difference is what used to happen in between the input and the > conversion. In the first version, the "if" statement prevents the > conversion from happening when there is no input. In the second > version, though, python tries to do the conversion with no input, and > fails. You could combine them in, as long as you're okay with blank input and input of '0' being folded to the same: start = int(input("\nStart: ") or 0) ChrisA From wuwei23 at gmail.com Sun Jun 2 22:02:23 2013 From: wuwei23 at gmail.com (alex23) Date: Sun, 2 Jun 2013 19:02:23 -0700 (PDT) Subject: Issue converting to string to integer. References: <55c2eb06-7b9f-480f-8668-5e19e236799f@googlegroups.com> Message-ID: On Jun 3, 11:12?am, Fdama wrote: > I combined the int conversion and the input on the same line, rather than to have two different statements. But ?got an error message: > > Traceback (most recent call last): > ? File "C:\Users\Faisal\Documents\python\pizza_slicer.py", line 23, in > ? ? start=int(input("\nStart: ")) > ValueError: invalid literal for int() with base 10: '' > > Could someone tell me why I got this error message? When you were presented the 'Start' prompt, you hit Enter, which causes `input` to return an empty string. As it's passed directly into `int`, which requires a valid string-representing-a-number, you get the ValueError traceback, which shows you the failing input it received: '' This doesn't happen in your original code, because your condition `if start:` will fail on an empty string, and not try to turn it into an int. You don't want to wrap your `input` with an `int`. You want to test the return result from `input` to ensure it can be coerced: start = input("\nStart: ")) if start and start.isdigit(): start=int(start) ... else: start='' # set start to empty string so the while loop repeats Here we check that all of the characters in the string `start` are actually numbers before coercing. This is known as the "Look Before You Leap" (LBYL) approach. Another approach is to catch the ValueError exception: start = input("\nStart: ")) try: start = int(start) except ValueError: start = '' if start: .... This is known as "Easier to for Ask Forgiveness than Permission" (EAFP). They both have their advantages. try/excepts tends to be quicker if few exceptions are called, while an if/else will test every time, although at this point it's not something you need to overly concern yourself with. Go with whichever is easiest for you to understand & extend. From steve+comp.lang.python at pearwood.info Mon Jun 3 03:55:41 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Jun 2013 07:55:41 GMT Subject: Interactive interpreter hooks Message-ID: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> The sys module defines two hooks that are used in the interactive interpreter: * sys.displayhook(value) gets called with the result of evaluating the line when you press ENTER; * sys.excepthook(type, value, traceback) gets called with the details of the exception when your line raises an exception. Is there a way to hook into the interactive interpreter *before* it is evaluated? That is, if I type "len([])" at the prompt and hit ENTER, I want a hook that runs before len([]) is evaluated to 0, so that I get the string "len([])". -- Steven From fabiosantosart at gmail.com Mon Jun 3 05:00:35 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Mon, 3 Jun 2013 10:00:35 +0100 Subject: Interactive interpreter hooks In-Reply-To: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> References: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 3 Jun 2013 09:04, "Steven D'Aprano" wrote: > > The sys module defines two hooks that are used in the interactive > interpreter: > > * sys.displayhook(value) gets called with the result of evaluating the > line when you press ENTER; > > * sys.excepthook(type, value, traceback) gets called with the details of > the exception when your line raises an exception. > > Is there a way to hook into the interactive interpreter *before* it is > evaluated? That is, if I type "len([])" at the prompt and hit ENTER, I > want a hook that runs before len([]) is evaluated to 0, so that I get the > string "len([])". > I don't know whether that is possible, but you could recreate the repl. This page seems to have good resources for that: http://stackoverflow.com/questions/1395913/python-drop-into-repl-read-eval-print-loop A trace function could also work. See docs for sys.settrace. The source code for the python GOTO module is a good example of its usage. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Mon Jun 3 09:03:31 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Mon, 03 Jun 2013 09:03:31 -0400 Subject: Interactive interpreter hooks In-Reply-To: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> References: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 6/3/2013 3:55 AM, Steven D'Aprano wrote: > The sys module defines two hooks that are used in the interactive > interpreter: > > * sys.displayhook(value) gets called with the result of evaluating the > line when you press ENTER; > > * sys.excepthook(type, value, traceback) gets called with the details of > the exception when your line raises an exception. > > Is there a way to hook into the interactive interpreter *before* it is > evaluated? That is, if I type "len([])" at the prompt and hit ENTER, I > want a hook that runs before len([]) is evaluated to 0, so that I get the > string "len([])". You have not said what you are actually trying to do, but you could definitely modify Idle to do something with user input before it sends it to the user process. From robert.kern at gmail.com Mon Jun 3 09:19:33 2013 From: robert.kern at gmail.com (Robert Kern) Date: Mon, 03 Jun 2013 14:19:33 +0100 Subject: Interactive interpreter hooks In-Reply-To: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> References: <51ac4bfc$0$11118$c3e8da3@news.astraweb.com> Message-ID: On 2013-06-03 08:55, Steven D'Aprano wrote: > The sys module defines two hooks that are used in the interactive > interpreter: > > * sys.displayhook(value) gets called with the result of evaluating the > line when you press ENTER; > > * sys.excepthook(type, value, traceback) gets called with the details of > the exception when your line raises an exception. > > Is there a way to hook into the interactive interpreter *before* it is > evaluated? That is, if I type "len([])" at the prompt and hit ENTER, I > want a hook that runs before len([]) is evaluated to 0, so that I get the > string "len([])". You will need to write your own REPL for this. Use the code.InteractiveConsole class: http://docs.python.org/2/library/code I recommend source-diving to see what you need to override, but I suspect you can just wrap around the `runsource()` method. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From embrujada_w at hotmail.com Mon Jun 3 08:02:37 2013 From: embrujada_w at hotmail.com (Carmen Campos Bordons) Date: Mon, 3 Jun 2013 12:02:37 +0000 Subject: Extract UTFGrid from MBTiles database Message-ID: I would appreciate any help or comment. The idea is to create a server in python that serves maps on the internet. The maps have to be in MBTiles format, which is a SQLite database that store all the map tiles in a single file. Taking this as an example http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 The tiles are images of the map in png, like this one http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png and apart from the tiles, in the database is stored the UTFGrid information, like this file http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.grid.json. The UTFGrid (you can consult in http://www.mapbox.com/developers/utfgrid/) permits than when you hover in the map, some extra information appears referring to the point where the mouse is. As you can see in this example http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 a infobox appears with the flag of every country(which is the information stored in the UTFGrid file). In the MBTiles database there are two table (also other, but not important in this case): ?tiles?, where are stored the tiles; and ?grids?, where is stored the UTFGrid associated to every tile. >From the MBTiles I can extract the tiles and display a normal map, and I can also extract the UTFGrid file individually (not all together, like the tiles that I can see the whole map; with the UTFGrid I just get one file). When I show the map normally, the infoboxes do not appear. But I do not get any error in command line or in the website. It just like the UTFGrid is empty. Attached is the code I am using to access the MBtiles file. I am using this SQL to access the MBTiles file ?select grid from grids where tile_column=? and tile_row=? and zoom_level=?", (x, y, z) And if I change it for this "select grid from grids where tile_column=? and tile_row=? and zoom_level=?", (67, 84, 7) I am getting always the same UTFGrid, but in this case it shows the infoboxes on the map, that one for all the tiles. It is like if I have this part of the map http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/10.14/17.31 but I always get the infoboxes of this tile http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png I get the infoboxes in all the tiles, but all of them are showing the flag of that tile. Thanks,Carmen -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: python_code.py Type: text/x-script.phyton Size: 2807 bytes Desc: not available URL: From carlosnepomuceno at outlook.com Mon Jun 3 10:49:12 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Mon, 3 Jun 2013 17:49:12 +0300 Subject: [Python-Dev] New FreeBSD 10.0-CURRENT buildbot In-Reply-To: References: <51AAD44B.4090802@FreeBSD.org>, , Message-ID: ________________________________ > Date: Sun, 2 Jun 2013 13:43:24 -0700 > Subject: Re: [Python-Dev] New FreeBSD 10.0-CURRENT buildbot > From: drsalists at gmail.com > To: carlosnepomuceno at outlook.com > CC: python-dev at python.org > > > On Sun, Jun 2, 2013 at 12:51 PM, Carlos Nepomuceno > > > wrote: > ---------------------------------------- > > Date: Sun, 2 Jun 2013 15:12:43 +1000 > > From: koobs.freebsd at gmail.com > > To: python-dev at python.org > > Subject: [Python-Dev] New FreeBSD 10.0-CURRENT buildbot > [...] > > koobs-freebsd10-amd64 (clang is default here) > > > Does CPython code compiled with clang runs faster than gcc? > > Why did you chose clang? Any benchmarks? Any benefits? > > Clang is sometimes favored over gcc for its non-GPL license; I believe > the FreeBSD project sees this as an important issue. > > In general, the more C compilers a piece of C code compiles on, the > fewer bugs are left in it, because different C compilers tend to catch > different problems - even with cranked up warnings. > I've been to a Clang presentation and one of the important features they've shown were the improved error messages. But I didn't try it yet. From consultski at gmail.com Mon Jun 3 12:23:37 2013 From: consultski at gmail.com (consultski at gmail.com) Date: Mon, 3 Jun 2013 09:23:37 -0700 (PDT) Subject: Pillow lib for x86_64 GNU/Linux Message-ID: It is great that Pillow wants to be "setuptools compatible" but without a suitable compiled library for x86_64 GNU/Linux, I am stuck between a rock and a hard place. Any suggestions? From irmen.NOSPAM at xs4all.nl Mon Jun 3 12:41:17 2013 From: irmen.NOSPAM at xs4all.nl (Irmen de Jong) Date: Mon, 03 Jun 2013 18:41:17 +0200 Subject: Pillow lib for x86_64 GNU/Linux In-Reply-To: References: Message-ID: <51acc72e$0$15905$e4fe514c@news.xs4all.nl> On 3-6-2013 18:23, consultski at gmail.com wrote: > It is great that Pillow wants to be "setuptools compatible" but without a suitable compiled library for x86_64 GNU/Linux, I am stuck between a rock and a hard place. > > Any suggestions? > Try your distribution's package repository. $ sudo apt-get install python-pillow Or failing that, $ sudo apt-get install python-imaging Worked fine for me (Ubuntu 64-bit) Irmen From consultski at gmail.com Mon Jun 3 22:29:53 2013 From: consultski at gmail.com (Jeff SKI Kinsey) Date: Mon, 3 Jun 2013 19:29:53 -0700 (PDT) Subject: Pillow lib for x86_64 GNU/Linux In-Reply-To: <51acc72e$0$15905$e4fe514c@news.xs4all.nl> References: <51acc72e$0$15905$e4fe514c@news.xs4all.nl> Message-ID: Sorry. Should have been more clear. This is a hosting account server. I am not in the sudoers file. Was able to get PIL v1.1.7 to create a tiff file. Problem solved. Thanks. On Monday, June 3, 2013 12:41:17 PM UTC-4, Irmen de Jong wrote: > On 3-6-2013 18:23, consultski at gmail.com wrote: > > > It is great that Pillow wants to be "setuptools compatible" but without a suitable compiled library for x86_64 GNU/Linux, I am stuck between a rock and a hard place. > > > > > > Any suggestions? > > > > > > > Try your distribution's package repository. > > > > $ sudo apt-get install python-pillow > > > > Or failing that, > > > > $ sudo apt-get install python-imaging > > > > > > Worked fine for me (Ubuntu 64-bit) > > > > Irmen From biolord9 at gmail.com Mon Jun 3 16:30:06 2013 From: biolord9 at gmail.com (Thrinaxodon) Date: Mon, 3 Jun 2013 13:30:06 -0700 (PDT) Subject: THRINAXODON MURDERS THE ATHEISTS OF REDVILLE. Message-ID: <2c174c1a-77e0-488a-80cf-4afe1245b14a@w8g2000yqf.googlegroups.com> THRINAXODON SECRETLY STALKS THE ATHEISTS OF REDVILLE. NOW, THRINAXODON PUNCHES RABBIT HOLE IN HIS FACE. HE SLAUGHTERED DAVID IAIN GREIG, WITH A ROUNDHOUSE KICK. HE BEAT HARRIS TO DEATH, AND SENT FIRE TO DR. NYIKOS. NOW, RICHARD DAWKINS SETS OUT WITH FIRE, TO HUNT THRINAXODON. THRINAOXDON USES WATER TO SHED OFF THE WATER, AND SHITS ON DAWKINS' HEAD, AND DAWKINS DIES!!! THRINAXODON WINS. =========================================================================== ======================== HERE'S THRINAXODON SCARING SOMEONE TO DEATH. http://www.youtube.com/watch?v=9Zlzin6PIo8 ________________________________________________________ ================================================== Thrinaxodon, in the form of prion, infecting this person's temporal lobe, and causing DEATH SLOWLY!!!! http://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/CJD_spongios... ___________________________________________________________________________ ___________ YE EVILUTIONISTS, THEY INFECT THE SOUL< AND GIVE YOU NIGHTMARES. THEY GIVE YOU... EVVVVVVVVVVVVVVVVVVVVVVVOOOOOOOOOOOOOOOOOOLUTIONIST"S DESEASE! ___________________________________________________________________________ _____________ PROOF OF GHOSTS!!! http://media.tumblr.com/tumblr_lxlws5u4tE1qjlz5q.jpg From umjoda at gmail.com Mon Jun 3 19:52:17 2013 From: umjoda at gmail.com (usman mjoda) Date: Tue, 4 Jun 2013 07:52:17 +0800 Subject: AES 128 bits Message-ID: <-7080932211754553943@unknownmsgid> Good day everyone, I need assistance for python codes of aes 128 bits key that can be run on SAGE Application. Thanks Sent from my Windows Phone -------------- next part -------------- An HTML attachment was scrubbed... URL: From denismfmcmahon at gmail.com Mon Jun 3 22:10:04 2013 From: denismfmcmahon at gmail.com (Denis McMahon) Date: Tue, 4 Jun 2013 02:10:04 +0000 (UTC) Subject: AES 128 bits References: Message-ID: On Tue, 04 Jun 2013 07:52:17 +0800, usman mjoda wrote: > Good day everyone, I need assistance for python codes of aes 128 bits > key that can be run on SAGE Application. Thanks google pycrypto -- Denis McMahon, denismfmcmahon at gmail.com From eschneider92 at comcast.net Mon Jun 3 23:39:28 2013 From: eschneider92 at comcast.net (eschneider92 at comcast.net) Date: Mon, 3 Jun 2013 20:39:28 -0700 (PDT) Subject: Beginner question Message-ID: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Is there a more efficient way of doing this? Any help is gratly appreciated. import random def partdeux(): print('''A man lunges at you with a knife! Do you DUCK or PARRY?''') option1=('duck') option2=('parry') optionsindex=[option1, option2] randomizer=random.choice(optionsindex) while randomizer==option1: if input() in option1: print('he tumbles over you') break else: print('he stabs you') break while randomizer==option2: if input() in option2: print('you trip him up') break else: print('he stabs you') break partdeux() From carlosnepomuceno at outlook.com Tue Jun 4 02:46:03 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 09:46:03 +0300 Subject: Beginner question In-Reply-To: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: That doesn't even works because input() is the same as eval(raw_input()). So you'll get a NameError exception. I think you know that. Perhaps you mean raw_input() instead of input(). In that case the answer is yes, it can be more 'efficient' because the if-then-else clause always breaks the while loop. I think you are looking for is a switch statement, which Python don't have. You can use the following structure to emulate a switch statement: def function1(): if raw_input() in option1: print('he tumbles over you') else: print('he stabs you') def function2(): if raw_input() in option2: print('you trip him up') else: print('he stabs you') def default(): print 'DEFAULT' switch = { option1: function1, option2: function2 } switch.get(randomizer, default)() Note that switch is a dictionary and you can use it without creating a variable, for example: { option1: function1, option2: function2 }.get(randomizer, default)() > Date: Mon, 3 Jun 2013 20:39:28 -0700 > Subject: Beginner question > From: eschneider92 at comcast.net > To: python-list at python.org > > Is there a more efficient way of doing this? Any help is gratly appreciated. > > > import random > def partdeux(): > print('''A man lunges at you with a knife! > Do you DUCK or PARRY?''') > option1=('duck') > option2=('parry') > optionsindex=[option1, option2] > randomizer=random.choice(optionsindex) > while randomizer==option1: > if input() in option1: > print('he tumbles over you') > break > else: > print('he stabs you') > break > while randomizer==option2: > if input() in option2: > print('you trip him up') > break > else: > print('he stabs you') > break > partdeux() > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From as at sci.fi Tue Jun 4 03:45:38 2013 From: as at sci.fi (Anssi Saari) Date: Tue, 04 Jun 2013 10:45:38 +0300 Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: eschneider92 at comcast.net writes: > Is there a more efficient way of doing this? Any help is gratly appreciated. Efficiency in a short program isn't a big thing. You have some pretty weird things in there, there's no need make single element tuples out of your strings and then putting those in a list. Just put the strings in a tuple and go. Likewise there's really no point in having while loops where you exit on the first round now is there? Just use an if. BTW, did I get the logic correctly, the end result is random? If true then the logic can be simplified greatly, you can just discard the user input and print a random choice of your three result strings... From john_ladasky at sbcglobal.net Tue Jun 4 03:57:42 2013 From: john_ladasky at sbcglobal.net (John Ladasky) Date: Tue, 4 Jun 2013 00:57:42 -0700 (PDT) Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> On Tuesday, June 4, 2013 12:45:38 AM UTC-7, Anssi Saari wrote: > BTW, did I get the logic correctly, the end result is random? You're right! I'm guessing that's not what the OP wants? From rosuav at gmail.com Tue Jun 4 04:24:15 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 18:24:15 +1000 Subject: Beginner question In-Reply-To: <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 5:57 PM, John Ladasky wrote: > On Tuesday, June 4, 2013 12:45:38 AM UTC-7, Anssi Saari wrote: > >> BTW, did I get the logic correctly, the end result is random? > > You're right! I'm guessing that's not what the OP wants? I'm guessing that's exactly what the OP wants. This is a fairly classic programming puzzle; on the surface it appears that you have some influence on the outcome, but ultimately you're playing rock-paper-scissors with the Random Number God. ChrisA From __peter__ at web.de Tue Jun 4 05:23:22 2013 From: __peter__ at web.de (Peter Otten) Date: Tue, 04 Jun 2013 11:23:22 +0200 Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: Chris Angelico wrote: > On Tue, Jun 4, 2013 at 5:57 PM, John Ladasky > wrote: >> On Tuesday, June 4, 2013 12:45:38 AM UTC-7, Anssi Saari wrote: >> >>> BTW, did I get the logic correctly, the end result is random? >> >> You're right! I'm guessing that's not what the OP wants? > > I'm guessing that's exactly what the OP wants. This is a fairly > classic programming puzzle; on the surface it appears that you have > some influence on the outcome, but ultimately you're playing > rock-paper-scissors with the Random Number God. As it is written, don't you always win if you hit enter? It may be the approved cheat code, though... OP: ("some string") is not a tuple, it is the same as just "some string" therefore option1 = "some string" if input() in option1: print("yes") prints 'yes' if the user types in a substring of option1, and the shortest substring of any string is "". For a single-item tuple the trailing comma is mandatory: >>> ("some string") # string 'some string' >>> "some string", # tuple ('some string',) >>> ("some string",) # tuple, parens added for clarity ('some string',) In general a tuple is consituted by the comma(s), not the parentheses: >>> "one", "two" ('one', 'two') From carlosnepomuceno at outlook.com Tue Jun 4 07:23:39 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:23:39 +0300 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , Message-ID: Started answering... now I'm asking! lol I've tried to use dict() to create a dictionary to use like the switch statement providing variable names instead of literals, such as: >>> a='A' >>> b='B' >>> {a:0,b:1} #here the variables are resolved {'A': 0, 'B': 1} That's ok! But if I use dict() declaration: >>> dict(a=0,b=1) {'a': 0, 'b': 1} #here variable names are taken as literals What's going on? Is there a way to make dict() to resolve the variables? -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabiosantosart at gmail.com Tue Jun 4 07:34:26 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 12:34:26 +0100 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: On 4 Jun 2013 12:28, "Carlos Nepomuceno" wrote: > > Started answering... now I'm asking! lol > > I've tried to use dict() to create a dictionary to use like the switch statement providing variable names instead of literals, such as: > > >>> a='A' > >>> b='B' > >>> {a:0,b:1} #here the variables are resolved > {'A': 0, 'B': 1} > > That's ok! But if I use dict() declaration: > > >>> dict(a=0,b=1) > {'a': 0, 'b': 1} #here variable names are taken as literals > > What's going on? Is there a way to make dict() to resolve the variables? Well yes. dict(**{a:0,b:1}) The dict() constructor makes a dictionary from keyword arguments. So you just have to feed it keyword arguments using **. And if you're in a bad day, dict(**locals()) -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosnepomuceno at outlook.com Tue Jun 4 07:53:29 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 14:53:29 +0300 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , , , Message-ID: >On 4 Jun 2013 12:28, "Carlos Nepomuceno" wrote: [...] >> What's going on? Is there a way to make dict() to resolve the variables? >Well yes. >dict(**{a:0,b:1}) >The dict() constructor makes a dictionary from keyword arguments. So you just have to feed it keyword arguments using **. >And if you're in a bad day, >dict(**locals()) That's exactly the same! >>>dict(**{a:0,b:1})=={a:0,b:1} True Are there any benefits from using dict() instead of {}? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Tue Jun 4 07:57:24 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 4 Jun 2013 21:57:24 +1000 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: On Tue, Jun 4, 2013 at 9:53 PM, Carlos Nepomuceno wrote: > Are there any benefits from using dict() instead of {}? Not for what you're doing, but you can use dict() with an iterable. Most of the time, use the literal. ChrisA From fabiosantosart at gmail.com Tue Jun 4 08:15:18 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 13:15:18 +0100 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: On 4 Jun 2013 12:57, "Carlos Nepomuceno" wrote: > > >On 4 Jun 2013 12:28, "Carlos Nepomuceno" wrote: > [...] > > >> What's going on? Is there a way to make dict() to resolve the variables? > >Well yes. > >dict(**{a:0,b:1}) > >The dict() constructor makes a dictionary from keyword arguments. So you just have to feed it keyword arguments using **. > >And if you're in a bad day, > >dict(**locals()) > > That's exactly the same! > >>>dict(**{a:0,b:1})=={a:0,b:1} > True > > Are there any benefits from using dict() instead of {}? Other than being able to create a dict from a list of tuples, and copying a dict using dict(anotherdict.items()), not that I know of. -------------- next part -------------- An HTML attachment was scrubbed... URL: From msirenef at lightbird.net Tue Jun 4 13:16:36 2013 From: msirenef at lightbird.net (Mitya Sirenef) Date: Tue, 04 Jun 2013 13:16:36 -0400 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , , , Message-ID: <51AE20F4.4000406@lightbird.net> On 06/04/2013 07:53 AM, Carlos Nepomuceno wrote: > >On 4 Jun 2013 12:28, "Carlos Nepomuceno" wrote: > [...] > >> What's going on? Is there a way to make dict() to resolve the variables? > >Well yes. > >dict(**{a:0,b:1}) > >The dict() constructor makes a dictionary from keyword arguments. So you just have to feed it keyword arguments using **. > >And if you're in a bad day, > >dict(**locals()) > > That's exactly the same! > >>>dict(**{a:0,b:1})=={a:0,b:1} > True > > Are there any benefits from using dict() instead of {}? > Other than what Steven already mentioned, a big advantage is that it's easier to make a dict if you have a lot of keys that are valid identifiers, and it's more readable, to boot: dict(red=1, blue=2, orange=3, violet=4, crimson=5, ...) VS. {'red':1, 'blue':2, 'orange':3, 'violet':4, 'crimson':5, ...} -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ Although the most acute judges of the witches and even the witches themselves, were convinced of the guilt of witchery, the guilt nevertheless was non-existent. It is thus with all guilt. Friedrich Nietzsche From steve+comp.lang.python at pearwood.info Tue Jun 4 08:25:27 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 12:25:27 GMT Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: <51addcb7$0$29966$c3e8da3$5496439d@news.astraweb.com> On Tue, 04 Jun 2013 14:53:29 +0300, Carlos Nepomuceno wrote: > That's exactly the same! >>>>dict(**{a:0,b:1})=={a:0,b:1} > True Of course it is. Isn't that what you wanted? It's also a waste of time, because you create a dict literal using {}, then unpack it into keyword arguments, then call dict() to create a new dict with the same content. Rather like doing this: n = int(str(42)) only even more expensive. > Are there any benefits from using dict() instead of {}? Of course there are. {} can be used for creating dict literals, which means you are limited to key/values that you explicitly include. dict(), on the other hand, has a rich set of constructor APIs: py> help(dict) Help on class dict in module builtins: class dict(object) | dict() -> new empty dictionary | dict(mapping) -> new dictionary initialized from a mapping object's | (key, value) pairs | dict(iterable) -> new dictionary initialized as if via: | d = {} | for k, v in iterable: | d[k] = v | dict(**kwargs) -> new dictionary initialized with the name=value pairs | in the keyword argument list. For example: dict(one=1, two=2) py> dict(zip('abcd', range(4)), x=23, y=42, z=999) {'a': 0, 'c': 2, 'b': 1, 'd': 3, 'y': 42, 'x': 23, 'z': 999} Try doing that with {} alone! -- Steven From carlosnepomuceno at outlook.com Tue Jun 4 08:37:22 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 15:37:22 +0300 Subject: Beginner question In-Reply-To: <51addcb7$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , , , , , <51addcb7$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: > From: steve+comp.lang.python at pearwood.info > Subject: Re: Beginner question > Date: Tue, 4 Jun 2013 12:25:27 +0000 > To: python-list at python.org > > On Tue, 04 Jun 2013 14:53:29 +0300, Carlos Nepomuceno wrote: > > > That's exactly the same! > >>>>dict(**{a:0,b:1})=={a:0,b:1} > > True > > > Of course it is. Isn't that what you wanted? Indeed! But that form isn't economically viable as you noted. > > It's also a waste of time, because you create a dict literal using {}, > then unpack it into keyword arguments, then call dict() to create a new > dict with the same content. Rather like doing this: > > n = int(str(42)) > > only even more expensive. > > > > Are there any benefits from using dict() instead of {}? > > Of course there are. {} can be used for creating dict literals, which > means you are limited to key/values that you explicitly include. dict(), > on the other hand, has a rich set of constructor APIs: > > py> help(dict) > > Help on class dict in module builtins: > > class dict(object) > | dict() -> new empty dictionary > | dict(mapping) -> new dictionary initialized from a mapping object's > | (key, value) pairs > | dict(iterable) -> new dictionary initialized as if via: > | d = {} > | for k, v in iterable: > | d[k] = v > | dict(**kwargs) -> new dictionary initialized with the name=value pairs > | in the keyword argument list. For example: dict(one=1, two=2) > > > py> dict(zip('abcd', range(4)), x=23, y=42, z=999) > {'a': 0, 'c': 2, 'b': 1, 'd': 3, 'y': 42, 'x': 23, 'z': 999} Awesome! Now I can do it just like that: >>> dict([(chr(ord('a')+x),x) for x in range(2)]) {'a': 0, 'b': 1} Thanks a lot! ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabiosantosart at gmail.com Tue Jun 4 08:47:44 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 13:47:44 +0100 Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> <51addcb7$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: > > Awesome! Now I can do it just like that: > > >>> dict([(chr(ord('a')+x),x) for x in range(2)]) > {'a': 0, 'b': 1} > > Thanks a lot! ;) > Or dict((c, i) for (i, c) in enumerate('ab')) But at this point you could just use a dict comprehension. {c: i for i, c in enumerate('ab')} -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve+comp.lang.python at pearwood.info Tue Jun 4 08:35:59 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 04 Jun 2013 12:35:59 GMT Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> Message-ID: <51addf2f$0$29966$c3e8da3$5496439d@news.astraweb.com> On Tue, 04 Jun 2013 14:23:39 +0300, Carlos Nepomuceno wrote: > Started answering... now I'm asking! lol > > I've tried to use dict() to create a dictionary to use like the switch > statement providing variable names instead of literals, such as: > >>>> a='A' >>>> b='B' >>>> {a:0,b:1} #here the variables are resolved > {'A': 0, 'B': 1} > > That's ok! But if I use dict() declaration: > >>>> dict(a=0,b=1) > {'a': 0, 'b': 1} #here variable names are taken as literals > > What's going on? Is there a way to make dict() to resolve the variables? This is by design. You're calling a function, dict(), and like all functions, code like: func(name=value) provides a *keyword argument*, where the argument is called "name" and the argument's value is as given. dict is no different from any other function, it has no superpowers, keyword arguments are still keyword arguments. In this case, there is no simple way to use the dict() function[1] the way you want. You could build up a string and then call eval(): s = "dict(%s=0, %s=1)" % (a, b) d = eval(s) but that's slow and inconvenient and dangerous if your data is untrusted. So in this specific case, you should stick to the {} method. [1] Technically it's a type, not a function, but the difference makes no difference here. -- Steven From carlosnepomuceno at outlook.com Tue Jun 4 08:51:38 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 15:51:38 +0300 Subject: Beginner question In-Reply-To: <51addf2f$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , , , <51addf2f$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: > From: steve+comp.lang.python at pearwood.info > Subject: Re: Beginner question > Date: Tue, 4 Jun 2013 12:35:59 +0000 > To: python-list at python.org > > On Tue, 04 Jun 2013 14:23:39 +0300, Carlos Nepomuceno wrote: > > > Started answering... now I'm asking! lol > > > > I've tried to use dict() to create a dictionary to use like the switch > > statement providing variable names instead of literals, such as: > > > >>>> a='A' > >>>> b='B' > >>>> {a:0,b:1} #here the variables are resolved > > {'A': 0, 'B': 1} > > > > That's ok! But if I use dict() declaration: > > > >>>> dict(a=0,b=1) > > {'a': 0, 'b': 1} #here variable names are taken as literals > > > > What's going on? Is there a way to make dict() to resolve the variables? > > > This is by design. You're calling a function, dict(), and like all > functions, code like: > > func(name=value) > > provides a *keyword argument*, where the argument is called "name" and > the argument's value is as given. dict is no different from any other > function, it has no superpowers, keyword arguments are still keyword > arguments. > > In this case, there is no simple way to use the dict() function[1] the > way you want. You could build up a string and then call eval(): > > s = "dict(%s=0, %s=1)" % (a, b) > d = eval(s) > > but that's slow and inconvenient and dangerous if your data is untrusted. > > So in this specific case, you should stick to the {} method. > > > > [1] Technically it's a type, not a function, but the difference makes no > difference here. > > -- > Steven It's superclear now! You're an excelent teacher! Can you explain me the difference of the type and function you've just mentioned? -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve+comp.lang.python at pearwood.info Thu Jun 6 22:21:22 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 02:21:22 GMT Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com> <51addf2f$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b143a2$0$29966$c3e8da3$5496439d@news.astraweb.com> Sorry for the delay in replying. On Tue, 04 Jun 2013 15:51:38 +0300, Carlos Nepomuceno wrote: >> [1] Technically it's a type, not a function, but the difference makes >> no difference here. > Can you explain me the difference of the type and function you've just > mentioned? We were talking about dict(). In Python, "type" is another name for "class". There is a built-in class called "dict": py> dict The way we create a new instance of a class is to call it, as if it were a function: py> dict() {} just like you might call some other function: py> len([]) 0 so sometimes it is convenient to be lazy and just refer to the type/class as a function. The general term for things which can be called in Python is "callable", which includes functions, methods, and types. (Back in the ancient days of Python 1.x, dict *actually was a function*, just like len() or ord(), and the type/class system was radically different. But that's ancient history now.) -- Steven From john_ladasky at sbcglobal.net Tue Jun 4 03:53:04 2013 From: john_ladasky at sbcglobal.net (John Ladasky) Date: Tue, 4 Jun 2013 00:53:04 -0700 (PDT) Subject: Beginner question In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: <48f73b41-9ff0-4fc0-a23b-f3eba8d02c80@googlegroups.com> On Monday, June 3, 2013 11:46:03 PM UTC-7, Carlos Nepomuceno wrote: > That doesn't even works because input() is the same as eval(raw_input()). So you'll get a NameError exception. > > I think you know that. Perhaps you mean raw_input() instead of input(). But the OP's code shows print() functions... which is not the habit of Python 2 programmers, even though it's legal code. And the OP says s/he's a beginning programmer... so why start learning Python 2 in 2013? Let me ask the OP, are you programming in Python 2 or Python 3? If the answer is indeed Python 3: raw_input() has been banished from Python 3, in favor of plain-old input(). From carlosnepomuceno at outlook.com Tue Jun 4 04:17:42 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 11:17:42 +0300 Subject: Beginner question In-Reply-To: <48f73b41-9ff0-4fc0-a23b-f3eba8d02c80@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <48f73b41-9ff0-4fc0-a23b-f3eba8d02c80@googlegroups.com> Message-ID: > Date: Tue, 4 Jun 2013 00:53:04 -0700 > Subject: Re: Beginner question > From: john_ladasky at sbcglobal.net > To: python-list at python.org > > On Monday, June 3, 2013 11:46:03 PM UTC-7, Carlos Nepomuceno wrote: > > That doesn't even works because input() is the same as eval(raw_input()). So you'll get a NameError exception. > > > > I think you know that. Perhaps you mean raw_input() instead of input(). > > But the OP's code shows print() functions... which is not the habit of Python 2 programmers, even though it's legal code. And the OP says s/he's a beginning programmer... so why start learning Python 2 in 2013? Let me ask the OP, are you programming in Python 2 or Python 3? > > If the answer is indeed Python 3: raw_input() has been banished from Python 3, in favor of plain-old input(). Didn't know that. Thanks! > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From orgnut at yahoo.com Tue Jun 4 05:13:16 2013 From: orgnut at yahoo.com (Larry Hudson) Date: Tue, 04 Jun 2013 02:13:16 -0700 Subject: Beginner question In-Reply-To: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: On 06/03/2013 08:39 PM, eschneider92 at comcast.net wrote: > Is there a more efficient way of doing this? Any help is gratly appreciated. > > > import random > def partdeux(): > print('''A man lunges at you with a knife! > Do you DUCK or PARRY?''') > option1=('duck') > option2=('parry') > optionsindex=[option1, option2] > randomizer=random.choice(optionsindex) > while randomizer==option1: > if input() in option1: > print('he tumbles over you') > break > else: > print('he stabs you') > break > while randomizer==option2: > if input() in option2: > print('you trip him up') > break > else: > print('he stabs you') > break > partdeux() > Yes, you are making this much more complicated than necessary. It seems that what you are trying to do is input the option, then randomly print a success or failure message for that option. I suspect you didn't plan it, but it also prints the "stab" message for invalid entries. Like any program, it can be approached in many different ways. Here is one possibility. (Just the function def, add the import and function call as well. Also I am not adding any comments. See if you can follow the logic here yourself.) ---------- def partdeux(): print('A man lunges at you with a knife!') option = input('Do you DUCK or PARRY? ').lower() success = random.randint(0, 1) if success: if option == 'duck': print('He tumbles over you') return if option == 'parry': print('You trip him up') return print('He stabs you') ------------ BTW, ignore the response from Carlos. I can see from the print() functions in your original that you're using Python 3. His answer is only valid for Python 2. -=- Larry -=- From roy at panix.com Tue Jun 4 09:16:20 2013 From: roy at panix.com (Roy Smith) Date: Tue, 04 Jun 2013 09:16:20 -0400 Subject: Beginner question References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: In article , Larry Hudson wrote: > def partdeux(): > print('A man lunges at you with a knife!') > option = input('Do you DUCK or PARRY? ').lower() > success = random.randint(0, 1) > if success: > if option == 'duck': > print('He tumbles over you') > return > if option == 'parry': > print('You trip him up') > return > print('He stabs you') I'm going to suggest another possible way to organize this. I'm not claiming it's necessarily better, but as this is a learning exercise, it's worth exploring. Get rid of all the conditional logic and make this purely table-driven: responses = {(0, 'duck'): "He tumbles over you", (0, 'parry'): "You trip him up", (1, 'duck'): "He stabs you", (1, 'parry'): "He stabs you", } and then.... def partdeux(): print('A man lunges at you with a knife!') option = input('Do you DUCK or PARRY? ').lower() success = random.randint(0, 1) print responses[(success, option)] Consider what happens when the game evolves to the point where you have four options (DUCK, PARRY, RETREAT, FEINT), multiple levels of success, and modifiers for which hand you and/or your opponent are holding your weapons in? Trying to cover all that with nested logic will quickly drive you insane. From joshua.landau.ws at gmail.com Tue Jun 4 15:43:46 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Tue, 4 Jun 2013 20:43:46 +0100 Subject: Beginner question In-Reply-To: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: On 4 June 2013 04:39, wrote: > Is there a more efficient way of doing this? Any help is gratly appreciated. > > > import random > def partdeux(): > print('''A man lunges at you with a knife! > Do you DUCK or PARRY?''') > option1=('duck') > option2=('parry') > optionsindex=[option1, option2] > randomizer=random.choice(optionsindex) > while randomizer==option1: > if input() in option1: > print('he tumbles over you') > break > else: > print('he stabs you') > break > while randomizer==option2: > if input() in option2: > print('you trip him up') > break > else: > print('he stabs you') > break > partdeux() I'm going to look directly at the code for my comment, here, and explain what's up. I imagine you were given this code to "fix up", I'll lead you through the steps. > import random You only use "random.choice", never anything else, so in this case I'd be tempted to do: > from random import choice This is *entirely optional*: I tend to do quite a lot of "from import " but others prefer to be more explicit about where things come from; your choice. > def partdeux(): Other than the atrocious name this is as simple as it gets to define a function - you should like that it's a function, though. > print('''A man lunges at you with a knife! > Do you DUCK or PARRY?''') This is iffy! Triple-quotes? Personally this is a really bad time to use them - they break indentation and whatnot. I'd write: > print('A man lunges at you with a knife!') > print('Do you DUCK or PARRY?') This, in my opinion, is much nicer. But we haven't "simplified" much yet. > option1=('duck') > option2=('parry') > optionsindex=[option1, option2] There are two things off about this. Firstly, no-one should be so addicted to brackets to use them here, and you should space variables. > option1 = 'duck' > option2 = 'parry' BUT this is not needed anyway. The next line puts both of these in a variable. You can add them straight in: > optionsindex = ['duck', 'parry'] There are some things wrong though: 1) *Never* lie. This is not an "index" of any sort, unless you're referring to one of these: [http://shop.pageprotectors.com/images/Index-Ring-Binder-2-Rings-Recipe-3x5-Card.jpg] This should be named "options" or, better, "valid_responses". 2) You write "Do you DUCK or PARRY?". None of this suggests uppercase. We shall deal with this later. Thus: > valid_responses = ['duck', 'parry'] > randomizer=random.choice(optionsindex) > while randomizer==option1: ... > while randomizer==option2: This is odd! What do you think this does? This says that you choose an option, "duck" or "parry". If it is "duck", then do A. If it is "parry", then do B. But why would a computer choose options like that? Surely it's better to do: (I'm properly spacing it as I go along, by the way) > randomizer = random.choice([True, False]) > while randomizer: ... > while not randomizer: Oh, that's odd! As randomizer never changes after you set it, you can be sure that the "while randomizer" is equivalent to "while True" or "while False". This means it will loop forever without a break. Looking at the breaks it is clear that *all paths lead to a break*. A while *LOOP* should only ever be used to *LOOP*. This makes the looping redundant. Thus remove the breaks and use: > randomizer = random.choice([True, False]) > if randomizer: ... > if not randomizer: which can be better written: > if random.choice([True, False]): ... > else: (BUT you may have to write "if choice([True, False]):" if you've followed all of my advice) > if input() in option1: "option1" no longer exists, so this is now written: > if input() in valid_responses[0]: BUT why "in"? You want to check whether that *equals* the response, not whether that is *in* the response: > if input() == valid_responses[0]: > else: > print('he stabs you') Why "else"? This means that if you wrote "Seppuku" *he'd* stab you. You want to check that you actually wrote the right thing! > elif input() == valid_responses[1]: > print('he stabs you') This does not work, but we'll fix it later. > if input() in option2: For the same reason, change this to: > if input() == valid_responses[1]: > else: > print('he stabs you') and this to: > elif input() == valid_responses[0]: > print('he stabs you') The rest is better. That leaves you with a much nicer looking function: ### START CODE ### from random import choice def partdeux(): print("A man lunges at you with a knife!") print("Do you DUCK or PARRY?") valid_responses = ["duck", "parry"] if choice([True, False]): if input() == valid_responses[0]: print('he tumbles over you') elif input() == valid_responses[0]: print('he stabs you') else: if input() == valid_responses[1]: print('you trip him up') elif input() == valid_responses[1]:: print('he stabs you') partdeux() ### END CODE ### There are some things to note. One is the multiple calls to "input()". It actually makes sense to do this when you ask the question (you don't ask someone if they want coffee, take a jog and then get your answer, do you?). Thus: > print("Do you DUCK or PARRY?") changes to > response = input("Do you DUCK or PARRY?\n") The "\n" is because "input" doesn't automatically add a new line whereas print does. Secondly, you want to catch if it's not valid. You can do this immediately after calling input (make sure you define valid_responses first - move it to the top): > if response not in valid_responses: > # OH NO! The way I deal with these is often with a while loop until there is a correct response: > while "trying to get response": > response = input("Do you DUCK or PARRY?\n") > if response in valid_input: > break What this does is constantly ask "Do you DUCK or PARRY" until the response is valid. Finally, you want to convert the response to lowercase in case they thought they had to type in UPPERCASE because it looked like that. > while "trying to get response": > response = input("Do you DUCK or PARRY?\n").lower() > if response in valid_input: > break Done. Here's the code: (I added three bugs for fun; they're not hard to find but it should stop you just taking the code without either understanding it or reading what I wrote. It's also good practice) ### CODE ### from random import choice def partdeux(): valid_responses = ["duck", "parry"] print("A man lunges at you with a knife!") while "trying to get response": response = input("Do you DUCK or PARRY?").lower() if response in valid_responses: break if choice([True, False]): if response == valid_responses[0]: print("he tumbles over you'') elif response == valid_responses[1]: print('he stabs you') else: if response == valid_responses[1]: print('you trip him up') elif response == valid_responses[1]: print('he stabs you') partdeux() ### END CODE ### NOTE THAT ROY SMITH'S VERSION IS BETTER, BUT COMPLETELY DIFFERENT CODE From eschneider92 at comcast.net Wed Jun 5 23:42:35 2013 From: eschneider92 at comcast.net (eschneider92 at comcast.net) Date: Wed, 5 Jun 2013 20:42:35 -0700 (PDT) Subject: Beginner question In-Reply-To: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com> Message-ID: Thanks everyone! From nikos.gr33k at gmail.com Tue Jun 4 06:05:27 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 03:05:27 -0700 (PDT) Subject: files.py failing when run via browser while properly executed via terminal Message-ID: <2ecf267a-cd92-4472-9323-92a41288cb5e@googlegroups.com> nikos at superhost.gr [~/www/cgi-bin]# nikos at superhost.gr [~/www/cgi-bin]# python Python 3.3.2 (default, Jun 3 2013, 16:18:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit() Okey after compiling from source python 3.3.2 and 'easy_install pymysql' now i'm receiving this error whiuch prohibit my files.py script to run. ===================================== nikos at superhost.gr [~/www/cgi-bin]# python files.py Error in sys.excepthook: ValueError: underlying buffer has been detached Original exception was: Traceback (most recent call last): File "/usr/local/lib/python3.3/os.py", line 673, in __getitem__ value = self._data[self.encodekey(key)] KeyError: b'REMOTE_ADDR' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "files.py", line 17, in host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] File "/usr/local/lib/python3.3/os.py", line 676, in __getitem__ raise KeyError(key) KeyError: 'REMOTE_ADDR' nikos at superhost.gr [~/www/cgi-bin]# ===================================== host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] Is not the proeblem here becaus ei ahve the exact same statemnt inside metriets.py and pelatologio.py and they dont provide me an error. If i run the script from chrome as http://superhost.gr/cgi-bin/files.py i get na internal server error. But since it complained i switched the above host to host = "nikos" then run python files.py and it compiled properly with no error but via browser i receive internal server error agian. So since the script interprets okey i decided to tail the error log to see the live error messages when i call it via browser: nikos at superhost.gr [~/www/cgi-bin]# tail -F /usr/local/apache/logs/error_log & [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Error in sys.excepthook: [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] ValueError: underlying buffer has been detached [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Original exception was: [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Traceback (most recent call last): [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File "files.py", line 67, in [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] query = query.encode(charset) [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcce' in position 61: surrogates not allowed [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Premature end of script headers: files.py [Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml I tried anything i can think of, hti sis beyond me, so please shed some light. Thank you. From nikos.gr33k at gmail.com Tue Jun 4 07:22:17 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Tue, 4 Jun 2013 04:22:17 -0700 (PDT) Subject: files.py failing when run via browser while properly executed via terminal In-Reply-To: <2ecf267a-cd92-4472-9323-92a41288cb5e@googlegroups.com> References: <2ecf267a-cd92-4472-9323-92a41288cb5e@googlegroups.com> Message-ID: <48f73ef8-3dba-4043-b2bd-6f50be131e3d@googlegroups.com> i tried somehtign else too. uploaded 1.mp3 and 1.exe from windows 8 via FileZilla to linux webhost and then renamed them both to Greek letters so that the renaming take place from within the CentOS and after that i tried: http://superhost.gr/cgi-bin/files.py Guess what? Still same error :( [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Error in sys.excepthook: [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] ValueError: underlying buffer has been detached [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Original exception was: [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Traceback (most recent call last): [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File "files.py", line 67, in [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) ) [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] query = query.encode(charset) [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcd3' in position 61: surrogates not allowed [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Premature end of script headers: files.py [Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml What the hell is it with these Greek filenames, why everyhting breaks? From vinay_sajip at yahoo.co.uk Tue Jun 4 08:05:42 2013 From: vinay_sajip at yahoo.co.uk (Vinay Sajip) Date: Tue, 4 Jun 2013 05:05:42 -0700 (PDT) Subject: ANN: Version 0.1.1 of sarge (a subprocess wrapper library) has been released. Message-ID: <85cf2fd1-7dd0-421d-96e9-2c3adcc1f2b6@googlegroups.com> Version 0.1.1 of Sarge, a cross-platform library which wraps the subprocess module in the standard library, has been released. What changed? ------------- - Added the ability to scan for specific patterns in subprocess output streams. - Added convenience methods to operate on wrapped subprocesses. - Exceptions which occur while spawning subprocesses are now propagated. - Fixed issues #2, #3, and #4. - Improved shell_shlex resilience with Unicode on 2.x. - Added get_stdout, get_stderr and get_both for when subprocess output is not expected to be voluminous. - Added an internal lock to serialise access to shared data. - Added tests to cover added functionality and reported issues. - Added numerous documentation updates. What does Sarge do? ------------------- Sarge tries to make interfacing with external programs from your Python applications easier than just using subprocess alone. Sarge offers the following features: * A simple way to run command lines which allows a rich subset of Bash- style shell command syntax, but parsed and run by sarge so that you can run on Windows without cygwin (subject to having those commands available): >>> from sarge import capture_stdout >>> p = capture_stdout('echo foo | cat; echo bar') >>> for line in p.stdout: print(repr(line)) ... 'foo\n' 'bar\n' * The ability to format shell commands with placeholders, such that variables are quoted to prevent shell injection attacks. * The ability to capture output streams without requiring you to program your own threads. You just use a Capture object and then you can read from it as and when you want. Advantages over subprocess --------------------------- Sarge offers the following benefits compared to using subprocess: * The API is very simple. * It's easier to use command pipelines - using subprocess out of the box often leads to deadlocks because pipe buffers get filled up. * It would be nice to use Bash-style pipe syntax on Windows, but Windows shells don't support some of the syntax which is useful, like &&, ||, |& and so on. Sarge gives you that functionality on Windows, without cygwin. * Sometimes, subprocess.Popen.communicate() is not flexible enough for one's needs - for example, when one needs to process output a line at a time without buffering the entire output in memory. * It's desirable to avoid shell injection problems by having the ability to quote command arguments safely. * subprocess allows you to let stderr be the same as stdout, but not the other way around - and sometimes, you need to do that. Python version and platform compatibility ----------------------------------------- Sarge is intended to be used on any Python version >= 2.6 and is tested on Python versions 2.6, 2.7, 3.1, 3.2 and 3.3 on Linux, Windows, and Mac OS X (not all versions are tested on all platforms, but sarge is expected to work correctly on all these versions on all these platforms). Finding out more ---------------- You can read the documentation at http://sarge.readthedocs.org/ There's a lot more information, with examples, than I can put into this post. You can install Sarge using "pip install sarge" to try it out. The project is hosted on BitBucket at https://bitbucket.org/vinay.sajip/sarge/ And you can leave feedback on the issue tracker there. I hope you find Sarge useful! Regards, Vinay Sajip From madmaxthc at yahoo.it Tue Jun 4 11:21:53 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:21:53 -0700 (PDT) Subject: lstrip problem - beginner question Message-ID: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Hi everyone, I am a beginner in python and trying to find my way through... :) I am writing a script to get numbers from the headers of a text file. If the header is something like: h01 = ('>scaffold_1') I just use: h01.lstrip('>scaffold_') and this returns me '1' But, if the header is: h02: ('>contig-100_0') if I use: h02.lstrip('>contig-100_') this returns me with: '' ...basically nothing. What surprises me is that if I do in this other way: h02b = h02.lstrip('>contig-100') I get h02b = ('_1') and subsequently: h02b.lstrip('_') returns me with: '1' which is what I wanted! Why is this happening? What am I missing? Thanks for your help and attention Max From madmaxthc at yahoo.it Tue Jun 4 11:24:01 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:24:01 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: <2bb8cd50-4e6e-4929-96c5-9d825ad592a2@googlegroups.com> On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > Hi everyone, > > > > I am a beginner in python and trying to find my way through... :) > > > > I am writing a script to get numbers from the headers of a text file. > > > > If the header is something like: > > h01 = ('>scaffold_1') > > I just use: > > h01.lstrip('>scaffold_') > > and this returns me with '1' > > > > But, if the header is: > > h02: ('>contig-100_1') > > if I use: > > h02.lstrip('>contig-100_') > > this returns me with: '' > > ...basically nothing. What surprises me is that if I do in this other way: > > h02b = h02.lstrip('>contig-100') > > I get h02b = ('_1') > > and subsequently: > > h02b.lstrip('_') > > returns me with: '1' which is what I wanted! > > > > Why is this happening? What am I missing? > > > > Thanks for your help and attention > > Max From madmaxthc at yahoo.it Tue Jun 4 11:25:13 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:25:13 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > Hi everyone, > > > > I am a beginner in python and trying to find my way through... :) > > > > I am writing a script to get numbers from the headers of a text file. > > > > If the header is something like: > > h01 = ('>scaffold_1') > > I just use: > > h01.lstrip('>scaffold_') > > and this returns me '1' > > > > But, if the header is: > > h02: ('>contig-100_0') > > if I use: > > h02.lstrip('>contig-100_') > > this returns me with: '' > > ...basically nothing. What surprises me is that if I do in this other way: > > h02b = h02.lstrip('>contig-100') > > I get h02b = ('_1') > > and subsequently: > > h02b.lstrip('_') > > returns me with: '1' which is what I wanted! > > > > Why is this happening? What am I missing? > > > > Thanks for your help and attention > > Max edit: h02: ('>contig-100_1') From fabiosantosart at gmail.com Tue Jun 4 11:41:43 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 16:41:43 +0100 Subject: lstrip problem - beginner question In-Reply-To: <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> Message-ID: On 4 Jun 2013 16:34, "mstagliamonte" wrote: > > On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > > Hi everyone, > > > > > > > > I am a beginner in python and trying to find my way through... :) > > > > > > > > I am writing a script to get numbers from the headers of a text file. > > > > > > > > If the header is something like: > > > > h01 = ('>scaffold_1') > > > > I just use: > > > > h01.lstrip('>scaffold_') > > > > and this returns me '1' > > > > > > > > But, if the header is: > > > > h02: ('>contig-100_0') > > > > if I use: > > > > h02.lstrip('>contig-100_') > > > > this returns me with: '' > > > > ...basically nothing. What surprises me is that if I do in this other way: > > > > h02b = h02.lstrip('>contig-100') > > > > I get h02b = ('_1') > > > > and subsequently: > > > > h02b.lstrip('_') > > > > returns me with: '1' which is what I wanted! > > > > > > > > Why is this happening? What am I missing? > > > > > > > > Thanks for your help and attention > > > > Max > > edit: h02: ('>contig-100_1') You don't have to use ('..') to declare a string. Just 'your string' will do. You can use str.split to split your string by a character. (Not tested) string_on_left, numbers = '>contig-100_01'.split('-') left_number, right_number = numbers.split('_') left_number, right_number = int(left_number), int(right_number) Of course, you will want to replace the variable names. If you have more advanced parsing needs, you will want to look at regular expressions or blobs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From madmaxthc at yahoo.it Tue Jun 4 11:49:45 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:49:45 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> Message-ID: <1c5227af-75a2-4a78-881d-ff16074b556a@googlegroups.com> On Tuesday, June 4, 2013 11:41:43 AM UTC-4, F?bio Santos wrote: > On 4 Jun 2013 16:34, "mstagliamonte" wrote: > > > > > > On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > > > > Hi everyone, > > > > > > > > > > > > > > > > I am a beginner in python and trying to find my way through... :) > > > > > > > > > > > > > > > > I am writing a script to get numbers from the headers of a text file. > > > > > > > > > > > > > > > > If the header is something like: > > > > > > > > h01 = ('>scaffold_1') > > > > > > > > I just use: > > > > > > > > h01.lstrip('>scaffold_') > > > > > > > > and this returns me '1' > > > > > > > > > > > > > > > > But, if the header is: > > > > > > > > h02: ('>contig-100_0') > > > > > > > > if I use: > > > > > > > > h02.lstrip('>contig-100_') > > > > > > > > this returns me with: '' > > > > > > > > ...basically nothing. What surprises me is that if I do in this other way: > > > > > > > > h02b = h02.lstrip('>contig-100') > > > > > > > > I get h02b = ('_1') > > > > > > > > and subsequently: > > > > > > > > h02b.lstrip('_') > > > > > > > > returns me with: '1' which is what I wanted! > > > > > > > > > > > > > > > > Why is this happening? What am I missing? > > > > > > > > > > > > > > > > Thanks for your help and attention > > > > > > > > Max > > > > > > edit: h02: ('>contig-100_1') > > You don't have to use ('..') to declare a string. Just 'your string' will do. > > You can use str.split to split your string by a character. > > (Not tested) > > string_on_left, numbers = '>contig-100_01'.split('-') > > left_number, right_number = numbers.split('_') > > left_number, right_number = int(left_number), int(right_number) > > Of course, you will want to replace the variable names. > > If you have more advanced parsing needs, you will want to look at regular expressions or blobs. Thanks, I will try it straight away. Still, I don't understand why the original command is returning me with nothing !? Have you got any idea? I am trying to understand a bit the 'nuts and bolts' of what I am doing and this result does not make any sense to me Regards Max From breamoreboy at yahoo.co.uk Tue Jun 4 12:01:31 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Tue, 04 Jun 2013 17:01:31 +0100 Subject: lstrip problem - beginner question In-Reply-To: <1c5227af-75a2-4a78-881d-ff16074b556a@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> <1c5227af-75a2-4a78-881d-ff16074b556a@googlegroups.com> Message-ID: On 04/06/2013 16:49, mstagliamonte wrote: [strip the double line spaced nonsense] Can you please check your email settings. It's bad enough being plagued with double line spaced mail from google, having it come from yahoo is just adding insult to injury, thanks :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From davea at davea.name Tue Jun 4 17:48:10 2013 From: davea at davea.name (Dave Angel) Date: Tue, 04 Jun 2013 17:48:10 -0400 Subject: lstrip problem - beginner question In-Reply-To: References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> <1fb7c07f-d974-43d0-815b-2739f7a4b965@googlegroups.com> <1c5227af-75a2-4a78-881d-ff16074b556a@googlegroups.com> Message-ID: <51AE609A.3000109@davea.name> On 06/04/2013 12:01 PM, Mark Lawrence wrote: > On 04/06/2013 16:49, mstagliamonte wrote: > > [strip the double line spaced nonsense] > > Can you please check your email settings. It's bad enough being plagued > with double line spaced mail from google, having it come from yahoo is > just adding insult to injury, thanks :) > Mark: The OP is posting from googlegroups, just using a yahoo return address. So you just have one buggy provider to hate, not two. >> >>> If the header is something like: >> >>> h01 = ('>scaffold_1') >> >>> I just use: >> >>> h01.lstrip('>scaffold_') >> >>> and this returns me '1' >> >>> >> >>> But, if the header is: >> madmaxthc at yahoo.it: If you must use googlegroups, at least fix the double-posting and double-spacing bugs it has. Start by reading: http://wiki.python.org/moin/GoogleGroupsPython -- DaveA From madmaxthc at yahoo.it Tue Jun 4 11:28:16 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:28:16 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: <78065652-a363-4e9e-a9c5-913b71459444@googlegroups.com> On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > Hi everyone, > > > > I am a beginner in python and trying to find my way through... :) > > > > I am writing a script to get numbers from the headers of a text file. > > > > If the header is something like: > > h01 = ('>scaffold_1') > > I just use: > > h01.lstrip('>scaffold_') > > and this returns me '1' > > > > But, if the header is: > > h02: ('>contig-100_0') > > if I use: > > h02.lstrip('>contig-100_') > > this returns me with: '' > > ...basically nothing. What surprises me is that if I do in this other way: > > h02b = h02.lstrip('>contig-100') > > I get h02b = ('_1') > > and subsequently: > > h02b.lstrip('_') > > returns me with: '1' which is what I wanted! > > > > Why is this happening? What am I missing? > > > > Thanks for your help and attention > > Max edit: h02= ('>contig-100_1') From madmaxthc at yahoo.it Tue Jun 4 11:29:49 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:29:49 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: On Tuesday, June 4, 2013 11:21:53 AM UTC-4, mstagliamonte wrote: > Hi everyone, > > > > I am a beginner in python and trying to find my way through... :) > > > > I am writing a script to get numbers from the headers of a text file. > > > > If the header is something like: > > h01 = ('>scaffold_1') > > I just use: > > h01.lstrip('>scaffold_') > > and this returns me '1' > > > > But, if the header is: > > h02: ('>contig-100_0') > > if I use: > > h02.lstrip('>contig-100_') > > this returns me with: '' > > ...basically nothing. What surprises me is that if I do in this other way: > > h02b = h02.lstrip('>contig-100') > > I get h02b = ('_1') > > and subsequently: > > h02b.lstrip('_') > > returns me with: '1' which is what I wanted! > > > > Why is this happening? What am I missing? > > > > Thanks for your help and attention > > Max edit: h02= ('>contig-100_1') From python at mrabarnett.plus.com Tue Jun 4 11:48:55 2013 From: python at mrabarnett.plus.com (MRAB) Date: Tue, 04 Jun 2013 16:48:55 +0100 Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: <51AE0C67.9030108@mrabarnett.plus.com> On 04/06/2013 16:21, mstagliamonte wrote: > Hi everyone, > > I am a beginner in python and trying to find my way through... :) > > I am writing a script to get numbers from the headers of a text file. > > If the header is something like: > h01 = ('>scaffold_1') > I just use: > h01.lstrip('>scaffold_') > and this returns me '1' > > But, if the header is: > h02: ('>contig-100_0') > if I use: > h02.lstrip('>contig-100_') > this returns me with: '' > ...basically nothing. What surprises me is that if I do in this other way: > h02b = h02.lstrip('>contig-100') > I get h02b = ('_1') > and subsequently: > h02b.lstrip('_') > returns me with: '1' which is what I wanted! > > Why is this happening? What am I missing? > The methods 'lstrip', 'rstrip' and 'strip' don't strip a string, they strip characters. You should think of the argument as a set of characters to be removed. This code: h01.lstrip('>scaffold_') will return the result of stripping the characters '>', '_', 'a', 'c', 'd', 'f', 'l', 'o' and 's' from the left-hand end of h01. A simpler example: >>> 'xyyxyabc'.lstrip('xy') 'abc' It strips the characters 'x' and 'y' from the string, not the string 'xy' as such. They are that way because they have been in Python for a long time, long before sets and such like were added to the language. From __peter__ at web.de Tue Jun 4 11:52:37 2013 From: __peter__ at web.de (Peter Otten) Date: Tue, 04 Jun 2013 17:52:37 +0200 Subject: lstrip problem - beginner question References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: mstagliamonte wrote: > Hi everyone, > > I am a beginner in python and trying to find my way through... :) > > I am writing a script to get numbers from the headers of a text file. > > If the header is something like: > h01 = ('>scaffold_1') > I just use: > h01.lstrip('>scaffold_') > and this returns me '1' > > But, if the header is: > h02: ('>contig-100_0') > if I use: > h02.lstrip('>contig-100_') > this returns me with: '' > ...basically nothing. What surprises me is that if I do in this other way: > h02b = h02.lstrip('>contig-100') > I get h02b = ('_1') > and subsequently: > h02b.lstrip('_') > returns me with: '1' which is what I wanted! > > Why is this happening? What am I missing? "abba".lstrip("ab") does not remove the prefix "ab" from the string "abba". Instead it removes chars from the beginning until it encounters one that is not in "ab". So t = s.lstrip(chars_to_be_removed) is roughly equivalent to t = s while len(t) > 0 and t[0] in chars_to_be_removed: t = t[1:] If you want to remove a prefix use s = "abba" prefix = "ab" if s.startswith(prefix): s = s[len(prefix):] From madmaxthc at yahoo.it Tue Jun 4 11:53:11 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 08:53:11 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: On Tuesday, June 4, 2013 11:48:55 AM UTC-4, MRAB wrote: > On 04/06/2013 16:21, mstagliamonte wrote: > > > Hi everyone, > > > > > > I am a beginner in python and trying to find my way through... :) > > > > > > I am writing a script to get numbers from the headers of a text file. > > > > > > If the header is something like: > > > h01 = ('>scaffold_1') > > > I just use: > > > h01.lstrip('>scaffold_') > > > and this returns me '1' > > > > > > But, if the header is: > > > h02: ('>contig-100_0') > > > if I use: > > > h02.lstrip('>contig-100_') > > > this returns me with: '' > > > ...basically nothing. What surprises me is that if I do in this other way: > > > h02b = h02.lstrip('>contig-100') > > > I get h02b = ('_1') > > > and subsequently: > > > h02b.lstrip('_') > > > returns me with: '1' which is what I wanted! > > > > > > Why is this happening? What am I missing? > > > > > The methods 'lstrip', 'rstrip' and 'strip' don't strip a string, they > > strip characters. > > > > You should think of the argument as a set of characters to be removed. > > > > This code: > > > > h01.lstrip('>scaffold_') > > > > will return the result of stripping the characters '>', '_', 'a', 'c', > > 'd', 'f', 'l', 'o' and 's' from the left-hand end of h01. > > > > A simpler example: > > > > >>> 'xyyxyabc'.lstrip('xy') > > 'abc' > > > > It strips the characters 'x' and 'y' from the string, not the string > > 'xy' as such. > > > > They are that way because they have been in Python for a long time, > > long before sets and such like were added to the language. Hey, Great! Now I understand! So, basically, it is also stripping the numbers after the '_' !! Thank you, I know a bit more now! Have a nice day everyone :) Max From gordon at panix.com Tue Jun 4 11:55:06 2013 From: gordon at panix.com (John Gordon) Date: Tue, 4 Jun 2013 15:55:06 +0000 (UTC) Subject: lstrip problem - beginner question References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: In <1829efca-935d-4049-ba61-7138015a2806 at googlegroups.com> mstagliamonte writes: > Hi everyone, > I am a beginner in python and trying to find my way through... :) > I am writing a script to get numbers from the headers of a text file. > If the header is something like: > h01 = ('>scaffold_1') > I just use: > h01.lstrip('>scaffold_') > and this returns me '1' > But, if the header is: > h02: ('>contig-100_0') > if I use: > h02.lstrip('>contig-100_') > this returns me with: '' > ...basically nothing. What surprises me is that if I do in this other way: > h02b = h02.lstrip('>contig-100') > I get h02b = ('_1') > and subsequently: > h02b.lstrip('_') > returns me with: '1' which is what I wanted! > Why is this happening? What am I missing? It's happening because the argument you pass to lstrip() isn't an exact string to be removed; it's a set of individual characters, all of which will be stripped out. So, when you make this call: h02.lstrip('>contig-100_') You're telling python to remove all of the characters in '>contig-100_' from the base string, which leaves nothing remaining. The reason it "worked" on your first example was that the character '1' didn't occur in your sample header string 'scaffold_'. If the underscore character is always the separating point in your headers, a better way might be to use the split() method instead of lstrip(). -- John Gordon A is for Amy, who fell down the stairs gordon at panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" From madmaxthc at yahoo.it Tue Jun 4 12:06:38 2013 From: madmaxthc at yahoo.it (mstagliamonte) Date: Tue, 4 Jun 2013 09:06:38 -0700 (PDT) Subject: lstrip problem - beginner question In-Reply-To: References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: <2e917225-8598-45a6-9c3f-e49b9cbc5b47@googlegroups.com> Thanks to everyone! I didn't expect so many replies in such a short time! Regards, Max From orgnut at yahoo.com Wed Jun 5 00:53:53 2013 From: orgnut at yahoo.com (Larry Hudson) Date: Tue, 04 Jun 2013 21:53:53 -0700 Subject: lstrip problem - beginner question In-Reply-To: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> References: <1829efca-935d-4049-ba61-7138015a2806@googlegroups.com> Message-ID: On 06/04/2013 08:21 AM, mstagliamonte wrote: > Hi everyone, > > I am a beginner in python and trying to find my way through... :) > > I am writing a script to get numbers from the headers of a text file. > > If the header is something like: > h01 = ('>scaffold_1') > I just use: > h01.lstrip('>scaffold_') > and this returns me '1' > > But, if the header is: > h02: ('>contig-100_0') > if I use: > h02.lstrip('>contig-100_') > this returns me with: '' > ...basically nothing. What surprises me is that if I do in this other way: > h02b = h02.lstrip('>contig-100') > I get h02b = ('_1') > and subsequently: > h02b.lstrip('_') > returns me with: '1' which is what I wanted! > > Why is this happening? What am I missing? > > Thanks for your help and attention > Max > The lstrip() function is the wrong one to use here. The command help(str.lstrip) gives: lstrip(...) S.lstrip([chars]) -> str Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. IOW, it does NOT strip the given string, but all the characters in the given string. So in your second example it (correctly) removes everything and gives you an empty string as the result. One possible alternative is to use slicing: h02 = '>contig-100_0' h03 = '>contig-100_' result = h02[len(h03):] Or some similar variation, possibly adding a startswith() function for some simple error checking. Of course, other approaches are possible as well, -=- Larry -=- From kakararunachalservice at gmail.com Tue Jun 4 12:07:54 2013 From: kakararunachalservice at gmail.com (kakararunachalservice at gmail.com) Date: Tue, 4 Jun 2013 09:07:54 -0700 (PDT) Subject: create new python file Message-ID: Hi, Can anyone please tell me how to dynamically create a new python file within a program??? From fabiosantosart at gmail.com Tue Jun 4 12:18:28 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Tue, 4 Jun 2013 17:18:28 +0100 Subject: create new python file In-Reply-To: References: Message-ID: On 4 Jun 2013 17:14, wrote: > > Hi, > Can anyone please tell me how to dynamically create a new python file within a program??? That's generally a bad idea. Why are you doing that? That said, it's just like writing to a text file. So if you write python in a text file, you're good. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherron at digipen.edu Tue Jun 4 13:44:32 2013 From: gherron at digipen.edu (Gary Herron) Date: Tue, 04 Jun 2013 10:44:32 -0700 Subject: create new python file In-Reply-To: References: Message-ID: <51AE2780.5060602@digipen.edu> On 06/04/2013 09:07 AM, kakararunachalservice at gmail.com wrote: > Hi, > Can anyone please tell me how to dynamically create a new python file within a program??? What do you mean by a "python file"? If you mean a text file containing python code, then create it like any other text file. For instance: with open("Hello.py", "w") as f: print("print('Hello world')\n", file=f) will create a file containing a simple one-line Python program. If you meant something else, then please take the time to provide more detail. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 From kakararunachalservice at gmail.com Tue Jun 4 14:09:51 2013 From: kakararunachalservice at gmail.com (kakararunachalservice at gmail.com) Date: Tue, 4 Jun 2013 11:09:51 -0700 (PDT) Subject: create new python file In-Reply-To: References: Message-ID: <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com> On Tuesday, June 4, 2013 11:14:32 PM UTC+5:30, Gary Herron wrote: > On 06/04/2013 09:07 AM, kakararunachalservice at gmail.com wrote: > > > Hi, > > > Can anyone please tell me how to dynamically create a new python file within a program??? > > > > What do you mean by a "python file"? If you mean a text file > > containing python code, then create it like any other text file. For > > instance: > > > > with open("Hello.py", "w") as f: > > print("print('Hello world')\n", file=f) > > > > will create a file containing a simple one-line Python program. > > > > If you meant something else, then please take the time to provide more > > detail. > > > > Gary Herron > > > > > > -- > > Dr. Gary Herron > > Department of Computer Science > > DigiPen Institute of Technology > > (425) 895-4418 Thank you so much! Why didn't i thought about that. So, can i program within just by the print statement? Or do i have to do something else. I'm sorry, i just learning python. Thanks again! From rustompmody at gmail.com Tue Jun 4 14:21:46 2013 From: rustompmody at gmail.com (rusi) Date: Tue, 4 Jun 2013 11:21:46 -0700 (PDT) Subject: create new python file References: <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com> Message-ID: <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com> On Jun 4, 11:09?pm, kakararunachalserv... at gmail.com wrote: > Thank you so much! Why didn't i thought about that. So, can i program within just by the print > statement? Or do i have to do something else. I'm sorry, i just learning python. Thanks again! If you are just learning python, you almost certainly dont want to do what you are asking for. So take some time, think through what you want, tell us, without worrying too much about the python angle -- we'll handle that side. And yes, please spell-n-grammar check your question, if necessary with a friend who knows English a bit. An odd English error here and there we can get on with. However with > So, can i program within just by the print statement? Or do i have to do something else. it is completely indecipherable (to me at least) what you are saying, leave aside any issues with python. From kakararunachalservice at gmail.com Tue Jun 4 14:54:52 2013 From: kakararunachalservice at gmail.com (kakararunachalservice at gmail.com) Date: Tue, 4 Jun 2013 11:54:52 -0700 (PDT) Subject: create new python file In-Reply-To: <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com> References: <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com> <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com> Message-ID: <8ff37e27-6e24-4a4a-b07e-42d5892ce9ac@googlegroups.com> On Tuesday, June 4, 2013 11:51:46 PM UTC+5:30, rusi wrote: > On Jun 4, 11:09?pm, kakararunachalserv... at gmail.com wrote: > > > Thank you so much! Why didn't i thought about that. So, can i program within just by the print > > > statement? Or do i have to do something else. I'm sorry, i just learning python. Thanks again! > > > > If you are just learning python, you almost certainly dont want to do > > what you are asking for. > > So take some time, think through what you want, tell us, without > > worrying too much about the python angle -- we'll handle that side. > > > > And yes, please spell-n-grammar check your question, if necessary with > > a friend who knows English a bit. An odd English error here and there > > we can get on with. However with > > > > > So, can i program within just by the print statement? Or do i have to do something else. > > > > it is completely indecipherable (to me at least) what you are saying, > > leave aside any issues with python. God! Thanks "Dr." Rusi! From carlosnepomuceno at outlook.com Tue Jun 4 16:00:39 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Tue, 4 Jun 2013 23:00:39 +0300 Subject: create new python file In-Reply-To: <8ff37e27-6e24-4a4a-b07e-42d5892ce9ac@googlegroups.com> References: , , <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com>, <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com>, <8ff37e27-6e24-4a4a-b07e-42d5892ce9ac@googlegroups.com> Message-ID: > Date: Tue, 4 Jun 2013 11:54:52 -0700 > Subject: Re: create new python file > From: kakararunachalservice at gmail.com [...] > > > > > So, can i program within just by the print statement? Or do i have to do something else. > > > > > > > > it is completely indecipherable (to me at least) what you are saying, > > > > leave aside any issues with python. > > God! Thanks "Dr." Rusi! lol -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby at tobiah.org Tue Jun 4 16:24:24 2013 From: toby at tobiah.org (Tobiah) Date: Tue, 04 Jun 2013 13:24:24 -0700 Subject: create new python file In-Reply-To: <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com> References: <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com> <0be03f4e-019d-47fa-a214-bf2f923e2367@jr6g2000pbb.googlegroups.com> Message-ID: >> So, can i program within just by the print statement? Or do i have to do something else. > > it is completely indecipherable (to me at least) what you are saying, > leave aside any issues with python. He said, "Oh, so writing python statements into a text file is as simple as printing them, referencing a handle to the file? That seems simpler than I had imagined. Is there nothing else that I must do in order to achieve my goal?". From lionelgreenstreet at gmail.com Tue Jun 4 17:25:21 2013 From: lionelgreenstreet at gmail.com (lionelgreenstreet at gmail.com) Date: Tue, 4 Jun 2013 14:25:21 -0700 (PDT) Subject: Problems with serial port interface Message-ID: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> Hi, i'm programming in python for the first time: i want to create a serial port reader. I'm using python3.3 and pyQT4; i'm using also pyserial. Below a snippet of the code: class CReader(QThread): def start(self, ser, priority = QThread.InheritPriority): self.ser = ser QThread.start(self, priority) self._isRunning = True self.numData=0; def run(self): print("Enter Creader") while True: if self._isRunning: try: data = self.ser.read(self.numData) n = self.ser.inWaiting() if n: data = self.ser.read(n) self.emit(SIGNAL("newData(QString)"), data.decode('cp1252', 'ignore')) self.ser.flushInput() except: pass else: return def stop(self): self._isRunning = False self.wait() This code seems work well, but i have problems in this test case: +baud rate:19200 +8/n/1 +data transmitted: 1 byte every 5ms After 30seconds (more or less) the program crashes: seems a buffer problem, but i'm not really sure. What's wrong? Thanks From lionelgreenstreet at gmail.com Fri Jun 7 06:17:25 2013 From: lionelgreenstreet at gmail.com (lionelgreenstreet at gmail.com) Date: Fri, 7 Jun 2013 03:17:25 -0700 (PDT) Subject: Problems with serial port interface In-Reply-To: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> Message-ID: <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Sorry for my quote, but do you have any suggestion? Il giorno marted? 4 giugno 2013 23:25:21 UTC+2, lionelgr... at gmail.com ha scritto: > Hi, > > i'm programming in python for the first time: i want to create a serial port reader. I'm using python3.3 and pyQT4; i'm using also pyserial. > > Below a snippet of the code: > > > > class CReader(QThread): > > def start(self, ser, priority = QThread.InheritPriority): > > self.ser = ser > > QThread.start(self, priority) > > self._isRunning = True > > self.numData=0; > > > > def run(self): > > print("Enter Creader") > > while True: > > if self._isRunning: > > try: > > data = self.ser.read(self.numData) > > n = self.ser.inWaiting() > > if n: > > data = self.ser.read(n) > > self.emit(SIGNAL("newData(QString)"), data.decode('cp1252', 'ignore')) > > self.ser.flushInput() > > except: > > pass > > else: > > return > > > > def stop(self): > > self._isRunning = False > > self.wait() > > > > This code seems work well, but i have problems in this test case: > > > > +baud rate:19200 > > +8/n/1 > > +data transmitted: 1 byte every 5ms > > > > After 30seconds (more or less) the program crashes: seems a buffer problem, but i'm not really sure. > > What's wrong? > > Thanks From __peter__ at web.de Fri Jun 7 07:23:00 2013 From: __peter__ at web.de (Peter Otten) Date: Fri, 07 Jun 2013 13:23 +0200 Subject: Problems with serial port interface References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Message-ID: lionelgreenstreet at gmail.com wrote: > Sorry for my quote, > but do you have any suggestion? >> After 30seconds (more or less) the program crashes: seems a buffer >> problem, but i'm not really sure. >> >> What's wrong? I don't use qt or pyserial myself, but your problem description is too vague anyway. Some random remarks: Does your script segfault or do you get a traceback? If the latter, post it. As you are using two external libraries, can you limit the problem to a single one? For example: temporarily replace pyserial with a file. Do the problems persist? What happens if you remove the bare try: ... except: pass ? It may hide useful information. Finally, can you make a self-contained example that we can run? Make it as simple as possible. I'd start with something like class CReader(QThread): def __init__(self, ser): self.ser = ser def run(self): while True: data = self.ser.read(1) if data: n = self.ser.inWaiting() if n: data += self.ser.read(n) text = data.decode('cp1252', 'ignore') print(text) # adding the following would be the next step #self.emit(SIGNAL("newData(QString)"), text) and once you have something that does run you can gradually increase complexity until it breaks. From python at mrabarnett.plus.com Fri Jun 7 10:18:17 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 15:18:17 +0100 Subject: Problems with serial port interface In-Reply-To: <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Message-ID: <51B1EBA9.3070007@mrabarnett.plus.com> On 07/06/2013 11:17, lionelgreenstreet at gmail.com wrote: > Sorry for my quote, > but do you have any suggestion? > > Il giorno marted? 4 giugno 2013 23:25:21 UTC+2, lionelgr... at gmail.com ha scritto: >> Hi, >> >> i'm programming in python for the first time: i want to create a serial port reader. I'm using python3.3 and pyQT4; i'm using also pyserial. >> >> Below a snippet of the code: >> >> >> class CReader(QThread): >> def start(self, ser, priority = QThread.InheritPriority): >> self.ser = ser >> QThread.start(self, priority) >> self._isRunning = True >> self.numData=0; >> >> def run(self): >> print("Enter Creader") >> while True: >> if self._isRunning: >> try: >> data = self.ser.read(self.numData) >> n = self.ser.inWaiting() >> if n: >> data = self.ser.read(n) >> self.emit(SIGNAL("newData(QString)"), data.decode('cp1252', 'ignore')) >> self.ser.flushInput() >> except: >> pass >> else: >> return >> >> def stop(self): >> self._isRunning = False >> self.wait() >> >> This code seems work well, but i have problems in this test case: >> >> +baud rate:19200 >> +8/n/1 >> +data transmitted: 1 byte every 5ms >> >> After 30seconds (more or less) the program crashes: seems a buffer problem, but i'm not really sure. >> >> What's wrong? >> Using a "bare except" like this: try: ... except: ... is virtually always a bad idea. The only time I'd ever do that would be, say, to catch something, print a message, and then re-raise it: try: ... except: print("Something went wrong!") raise Even then, catching Exception would be better than a bare except. A bare except will catch _every_ exception, including NameError (which would mean that it can't find a name, possibly due to a spelling error). A bare except with pass, like you have, is _never_ a good idea. Python might be trying to complain about a problem, but you're preventing it from doing so. Try removing the try...except: pass and let Python tell you if it has a problem. From lionelgreenstreet at gmail.com Sat Jun 8 14:15:33 2013 From: lionelgreenstreet at gmail.com (lionelgreenstreet at gmail.com) Date: Sat, 8 Jun 2013 11:15:33 -0700 (PDT) Subject: Problems with serial port interface In-Reply-To: References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Message-ID: Ok, thanks for your reply. But i have another problem: i hadn't always the hardware needed for the tests. Before i've used a terminal and com0com to simulate a serial input: if i want to simulate a transmission every 5ms how can i do? I need a program or a code that i'm sure about its correctness. Another question: may i have some problems (for example timings) to simulate with the same pc a serial transmission? Any suggestion? Thanks From lionelgreenstreet at gmail.com Wed Jun 12 04:39:14 2013 From: lionelgreenstreet at gmail.com (lionelgreenstreet at gmail.com) Date: Wed, 12 Jun 2013 01:39:14 -0700 (PDT) Subject: Problems with serial port interface In-Reply-To: References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Message-ID: I've done some tests: i've simulated a serial transmission with 1. Terminal.exe https://sites.google.com/site/terminalbpp/ 2. Com0com I've made a script that transmit a char every 5ms. The test system is Terminal---Com0Com---Terminal so i haven't used my program. After 3-4minutes the terminal program crashes, so i think that i have an OS problem: what do you think?I'm using Windows7/64bit... Any suggestion? Thanks From lionelgreenstreet at gmail.com Thu Jun 13 04:01:17 2013 From: lionelgreenstreet at gmail.com (lionelgreenstreet at gmail.com) Date: Thu, 13 Jun 2013 01:01:17 -0700 (PDT) Subject: Problems with serial port interface In-Reply-To: References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Message-ID: I've some other informations: i've created a class like this class CReader(QThread): def start(self, ser, priority = QThread.InheritPriority): self.ser = ser QThread.start(self, priority) self._isRunning = True self.numData=0; def run(self): print("Enter Creader") while True: if self._isRunning: try: data = self.ser.read(self.numData) n = self.ser.inWaiting() if n: data = self.ser.read(n) print(data) except: errMsg = "Reader thread is terminated unexpectedly." self.emit(SIGNAL("error(QString)"), errMsg) else: return def stop(self): self._isRunning = False self.wait() I've tested my class and it works well and i have no error messages. So, i think that my problem is this line (taken from previous code) self.emit(SIGNAL("newData(QString)"), data.decode('cp1252', 'ignore')) i need this line to display all data received to my QT interface, so can't be removed. I've tried to use a timer to display data every 500ms: my program crasches after 5minutes. Can you help me? Thanks From r90230 at gmail.com Tue Jun 4 17:31:07 2013 From: r90230 at gmail.com (PieGuy) Date: Tue, 4 Jun 2013 14:31:07 -0700 (PDT) Subject: How to increment date by week? Message-ID: Starting on any day/date, I would like to create a one year list, by week (start date could be any day of week). Having a numerical week index in front of date, ie 1-52, would be a bonus. ie, 1. 6/4/2013 2. 6/11/2013 3. 6/18/2013....etc to # 52. And to save that result to a file. Moving from 2.7 to 3.3 TIA From joshua.landau.ws at gmail.com Tue Jun 4 17:44:52 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Tue, 4 Jun 2013 22:44:52 +0100 Subject: How to increment date by week? In-Reply-To: References: Message-ID: On 4 June 2013 22:31, PieGuy wrote: > Starting on any day/date, I would like to create a one year list, by week (start date could be any day of week). Having a numerical week index in front of date, ie 1-52, would be a bonus. > ie, 1. 6/4/2013 > 2. 6/11/2013 > 3. 6/18/2013....etc to # 52. > > And to save that result to a file. > Moving from 2.7 to 3.3 > TIA What have you tried? What are you stuck on? We're not here to do your work for you. See http://docs.python.org/3/library/datetime.html for where to get started. From python.list at tim.thechases.com Tue Jun 4 17:50:03 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Tue, 4 Jun 2013 16:50:03 -0500 Subject: How to increment date by week? In-Reply-To: References: Message-ID: <20130604165003.32735531@bigbox.christie.dr> On 2013-06-04 14:31, PieGuy wrote: > Starting on any day/date, I would like to create a one year > list, by week (start date could be any day of week). Having a > numerical week index in front of date, ie 1-52, would be a bonus. > ie, 1. 6/4/2013 2. 6/11/2013 3. 6/18/2013....etc to # 52. import datetime start = datetime.date.today() for i in range(53): dt = start + datetime.timedelta(days=7*i) result = "%i. %s" % ( i+1, dt.strftime('%m/%d/%Y') ) do_something_with(result) -tkc From gordon at panix.com Tue Jun 4 17:48:54 2013 From: gordon at panix.com (John Gordon) Date: Tue, 4 Jun 2013 21:48:54 +0000 (UTC) Subject: How to increment date by week? References: Message-ID: In PieGuy writes: > Starting on any day/date, I would like to create a one year list, by week (start date could be any day of week). Having a numerical week index in front of date, ie 1-52, would be a bonus. > ie, 1. 6/4/2013 > 2. 6/11/2013 > 3. 6/18/2013....etc to # 52. > And to save that result to a file. > Moving from 2.7 to 3.3 > TIA from datetime import date, timedelta the_date = date(year=2013, month=6, day=4) print "%d. %s" % (1, the_date) for n in range(2, 53): the_date = the_date + timedelta(days=7) print "%d. %s" % (n, the_date) -- John Gordon A is for Amy, who fell down the stairs gordon at panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" From giorgos.tzampanakis at gmail.com Tue Jun 4 17:47:02 2013 From: giorgos.tzampanakis at gmail.com (Giorgos Tzampanakis) Date: Tue, 4 Jun 2013 21:47:02 +0000 (UTC) Subject: How to increment date by week? References: Message-ID: On 2013-06-04, PieGuy wrote: > Starting on any day/date, I would like to create a one year list, by > week (start date could be any day of week). Having a numerical week > index in front of date, ie 1-52, would be a bonus. > ie, 1. 6/4/2013 > 2. 6/11/2013 > 3. 6/18/2013....etc to # 52. date2 = date1 + datetime.timedelta(7) -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ From carlosnepomuceno at outlook.com Tue Jun 4 18:52:01 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 01:52:01 +0300 Subject: How to increment date by week? In-Reply-To: References: Message-ID: > Date: Tue, 4 Jun 2013 14:31:07 -0700 > Subject: How to increment date by week? > From: r90230 at gmail.com > To: python-list at python.org > > Starting on any day/date, I would like to create a one year list, by week (start date could be any day of week). Having a numerical week index in front of date, ie 1-52, would be a bonus. > ie, 1. 6/4/2013 > 2. 6/11/2013 > 3. 6/18/2013....etc to # 52. > > And to save that result to a file. > Moving from 2.7 to 3.3 > TIA YAS: import datetime today = datetime.datetime.today() week = datetime.timedelta(weeks=1) f=open('output.txt','w') for i in range(52): f.write((today+i*week).strftime(str(i+1)+'. %Y-%m-%d\n')) f.close() -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Tue Jun 4 21:17:00 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 4 Jun 2013 20:17:00 -0500 Subject: How to increment date by week? In-Reply-To: References: Message-ID: Check out the rrule module in the python-dateutil package: http://labix.org/python-dateutil https://pypi.python.org/pypi/python-dateutil Skip From steve.ferg.bitbucket at gmail.com Tue Jun 4 23:43:22 2013 From: steve.ferg.bitbucket at gmail.com (steve.ferg.bitbucket at gmail.com) Date: Tue, 4 Jun 2013 20:43:22 -0700 (PDT) Subject: How to increment date by week? In-Reply-To: References: Message-ID: <673d2f2c-4051-4b15-a262-eeba1748d0d9@googlegroups.com> pyfdate -- http://www.ferg.org/pyfdate/ from pyfdate import Time w = Time(2013,1,2) # start with January 2, 2013, just for example # print the ISO weeknumber and date for 52 weeks # date looks like this: October 31, 2005 for i in range(52): w = w.plus(weeks=1) print (w.weeknumber, w.d) From r90230 at gmail.com Wed Jun 5 12:39:34 2013 From: r90230 at gmail.com (PieGuy) Date: Wed, 5 Jun 2013 09:39:34 -0700 (PDT) Subject: How to increment date by week? In-Reply-To: References: Message-ID: On Tuesday, June 4, 2013 2:31:07 PM UTC-7, PieGuy wrote: > Starting on any day/date, I would like to create a one year list, by week (start date could be any day of week). Having a numerical week index in front of date, ie 1-52, would be a bonus. > > ie, 1. 6/4/2013 > > 2. 6/11/2013 > > 3. 6/18/2013....etc to # 52. > > Thank you Python Community! I am almost 75, moving from 2.7 to 3.n, just started with Linux Ubuntu, and using WING IDE but my 3 Python books do not offer the clarity of this group. Again, thanks to all who responded. > > And to save that result to a file. > > Moving from 2.7 to 3.3 > > TIA From carlosnepomuceno at outlook.com Tue Jun 4 19:53:21 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 02:53:21 +0300 Subject: Do you consider Python a 4GL? Why (not)? Message-ID: Do you consider Python a 4GL? Why (not)? -------------- next part -------------- An HTML attachment was scrubbed... URL: From python.list at tim.thechases.com Tue Jun 4 20:14:22 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Tue, 4 Jun 2013 19:14:22 -0500 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: References: Message-ID: <20130604191422.105eacd8@bigbox.christie.dr> On 2013-06-05 02:53, Carlos Nepomuceno wrote: > Do you consider Python a 4GL? Why (not)? Of course it's a 4GL ("4 Guido Language"). You think he wrote it for somebody else? Unless you have some magical list of criteria that makes your own definition of "4GL", in which case you should look at your list of those "4GL" definitions and weigh them against publicly known facts about Python, yielding the answer to your question. :-P -tkc From breamoreboy at yahoo.co.uk Tue Jun 4 20:21:44 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 01:21:44 +0100 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: <20130604191422.105eacd8@bigbox.christie.dr> References: <20130604191422.105eacd8@bigbox.christie.dr> Message-ID: On 05/06/2013 01:14, Tim Chase wrote: > On 2013-06-05 02:53, Carlos Nepomuceno wrote: >> Do you consider Python a 4GL? Why (not)? > > Of course it's a 4GL ("4 Guido Language"). You think he wrote it for > somebody else? > > Unless you have some magical list of criteria that makes your own > definition of "4GL", in which case you should look at your list of > those "4GL" definitions and weigh them against publicly known facts > about Python, yielding the answer to your question. :-P > > -tkc > > "Publicly known facts" as in Python is a weakly typed language? :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From carlosnepomuceno at outlook.com Tue Jun 4 20:38:37 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 03:38:37 +0300 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: References: , <20130604191422.105eacd8@bigbox.christie.dr>, Message-ID: I don't have an opinion yet, but I've found contradictory evidence from many sources, such as: "A domain-specific language (DSL) is a type of programming language or specification language in software development and domain engineering dedicated to a particular problem domain, [...] The opposite is: a general-purpose programming language, such as C, Java or Python,"http://en.wikipedia.org/wiki/Domain-specific_programming_language Since, 4GL is considered a subset of DSLs, this wiki page doesn't consider Python a 4GL. Is is true? Why??? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.g.kelly at gmail.com Wed Jun 5 23:15:59 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Wed, 5 Jun 2013 21:15:59 -0600 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: References: <20130604191422.105eacd8@bigbox.christie.dr> Message-ID: On Tue, Jun 4, 2013 at 6:38 PM, Carlos Nepomuceno wrote: > I don't have an opinion yet, but I've found contradictory evidence from many > sources, such as: > > "A domain-specific language (DSL) is a type of programming language or > specification language in software development and domain engineering > dedicated to a particular problem domain, > [...] > The opposite is: > > a general-purpose programming language, such as C, Java or Python," > > http://en.wikipedia.org/wiki/Domain-specific_programming_language > > Since, 4GL is considered a subset of DSLs, this wiki page doesn't consider > Python a 4GL. > > Is is true? Why??? I wasn't previously familiar with the 3GL / 4GL nomenclature, but based upon the definitions given at Wikipedia, Python is clearly a 3GL. That said, virtually all general-purpose languages in common usage today would be 3GLs, so the distinction does not seem terribly useful to me. The terms "4GL" and "5GL" while suggesting a language that is somehow more "advanced" than a 3GL, seem to be mainly 80s hype. From drsalists at gmail.com Tue Jun 4 21:17:33 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Tue, 4 Jun 2013 18:17:33 -0700 Subject: [Python-Dev] Do you consider Python a 4GL? Why (not)? In-Reply-To: References: Message-ID: On Tue, Jun 4, 2013 at 4:53 PM, Carlos Nepomuceno < carlosnepomuceno at outlook.com> wrote: > Do you consider Python a 4GL? Why (not)? > By the wikipedia definition of 4GL and 5GL, I'd say Python is neither. And it's not a VHLL either, again according to the wikipedia definition. But IMO it is too high level to be a traditional 3GL too. Perhaps "Scripting language" is the best general category we have that Python fits into. But I hope not. -------------- next part -------------- An HTML attachment was scrubbed... URL: From laurent.pointal at free.fr Tue Jun 11 15:48:52 2013 From: laurent.pointal at free.fr (Laurent Pointal) Date: Tue, 11 Jun 2013 21:48:52 +0200 Subject: Do you consider Python a 4GL? Why (not)? References: Message-ID: <51b77f24$0$2271$426a74cc@news.free.fr> Dennis Lee Bieber wrote: > On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg > declaimed the following in gmane.comp.python.general: > > >> Perhaps "Scripting language" is the best general category we have that >> Python fits into. But I hope not. > > Heh... Having encountered ARexx (the Amiga version of REXX), Python > is NOT a scripting language... The ARexx implementation (along with the > Amiga's interprocess communication system) allowed for scripting any > application that opened an "ARexx Port"... Other than, maybe, the > original IBM REXX, I've not seen any other REXX implementation that > would permit embedding application specific commands into a script. > > Python's subprocess (and related) are all based on explicit startup > and communication over stdin/stdout... Nothing like: > > address TextEditor /* a fictitious application port */ > 'DN 5' /* move down five lines *?: > 'MARK' /* start a selection */ > 'RW 5' /* move right five words */ > 'COPY' /* copy selection to operation result */ > string = result > address PageSetter /* fictitious here, but a real program */ > 'PASTE' string /* insert selected string into page document /* > > Yes, maybe the above could be done as two sessions of subprocess -- > presuming both programs had a command line interface. But what if the > script was going to switch between the two of them throughout one > session. For me this is not a DSL, but an external API of an application, like you have with COM under Windows, DBUS under Linux. Unix streams are just an ancestor way of communication, you could have local-RPC also, or CORBA. So, as this is just inter-process communication procotol, if you have the Amigaes interprocess communication system tool written for Python, you could easily write things using a Python syntax: te = TextEditor() te.dn(5) te.mark() te.rw(5) te.copy() string = te.result() ps = PageSetter() ps.paste(string) Python is a scripting language, and a nice one to use as glue between different components, eventually of different technologies. (note: if you have more than one process to control via streams, you can open more than one pipe) And... here http://www.solie.ca/articles/pythonmod/pythonmod.html you could find modules for using Python with Amiga APIs and combining it with ARexx. > The C compiler suites used this ability to read the error log from a > compile, and move to the line/column in the source file associated with > each error. (Before "integrated" development environments) This is a + for compiled environments that you effectively cannot have with Python, non-syntaxic errors found at runtime. A+ Laurent. -- Laurent POINTAL - laurent.pointal at laposte.net From davea at davea.name Tue Jun 11 22:02:52 2013 From: davea at davea.name (Dave Angel) Date: Tue, 11 Jun 2013 22:02:52 -0400 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: <51b77f24$0$2271$426a74cc@news.free.fr> References: <51b77f24$0$2271$426a74cc@news.free.fr> Message-ID: <51B7D6CC.40309@davea.name> On 06/11/2013 03:48 PM, Laurent Pointal wrote: > Dennis Lee Bieber wrote: > >> On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg >> declaimed the following in gmane.comp.python.general: >> >> > >> The C compiler suites used this ability to read the error log from a >> compile, and move to the line/column in the source file associated with >> each error. (Before "integrated" development environments) > > This is a + for compiled environments that you effectively cannot have with > Python, non-syntaxic errors found at runtime. > Sure. I think they're usually called exceptions. And lo and behold, they come with filenames and line numbers. -- DaveA From rosuav at gmail.com Tue Jun 11 22:10:27 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 12 Jun 2013 12:10:27 +1000 Subject: Do you consider Python a 4GL? Why (not)? In-Reply-To: <51B7D6CC.40309@davea.name> References: <51b77f24$0$2271$426a74cc@news.free.fr> <51B7D6CC.40309@davea.name> Message-ID: On Wed, Jun 12, 2013 at 12:02 PM, Dave Angel wrote: > On 06/11/2013 03:48 PM, Laurent Pointal wrote: >> >> Dennis Lee Bieber wrote: >> >>> On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg >>> declaimed the following in gmane.comp.python.general: >>> >>> >> >> >>> The C compiler suites used this ability to read the error log from a >>> compile, and move to the line/column in the source file associated with >>> each error. (Before "integrated" development environments) >> >> >> This is a + for compiled environments that you effectively cannot have >> with >> Python, non-syntaxic errors found at runtime. >> > > Sure. I think they're usually called exceptions. And lo and behold, they > come with filenames and line numbers. Nearly every language has parse-time and run-time errors. Some skew it further one way than the other, but (a) there will always be run-time errors (interrupted, out of memory, etc), and (b) it'd be a stupid language[1] that didn't even *try* to parse a file before running it. The only difference is that C has a much heavier compile-time phase than Python does, so the latter has to throw TypeError for 1+[] instead of failing the compilation. ChrisA [1] I opened with "Nearly" because MS-DOS batch does seem to be this stupid. From vasudevram at gmail.com Tue Jun 4 20:40:09 2013 From: vasudevram at gmail.com (vasudevram) Date: Tue, 4 Jun 2013 17:40:09 -0700 (PDT) Subject: Multiple Python one-liners Message-ID: http://jugad2.blogspot.com/2013/06/multiple-python-one-liners.html Some interesting and useful one-liners there ... From claire.morandin at gmail.com Tue Jun 4 22:41:38 2013 From: claire.morandin at gmail.com (claire morandin) Date: Tue, 4 Jun 2013 19:41:38 -0700 (PDT) Subject: Issue values dictionary Message-ID: I have two text file with a bunch of transcript name and their corresponding length, it looks like this: ERCC.txt ERCC-00002 1061 ERCC-00003 1023 ERCC-00004 523 ERCC-00009 984 ERCC-00012 994 ERCC-00013 808 ERCC-00014 1957 ERCC-00016 844 ERCC-00017 1136 ERCC-00019 644 blast.tx ERCC-00002 1058 ERCC-00003 1017 ERCC-00004 519 ERCC-00009 977 ERCC-00019 638 ERCC-00022 746 ERCC-00024 134 ERCC-00024 126 ERCC-00024 98 ERCC-00025 445 I want to compare the length of the transcript and see if the length in blast.txt is at least 90% of the length in ERCC.txt for the corresponding transcript name ( I hope I am clear!) So I wrote the following script: ercctranscript_size = {} for line in open('ERCC.txt'): columns = line.strip().split() transcript = columns[0] size = columns[1] ercctranscript_size[transcript] = int(size) unknown_transcript = open('Not_sequenced_ERCC_transcript.txt', 'w') blast_file = open('blast.txt') out_file = open ('out.txt', 'w') blast_transcript = {} blast_file.readline() for line in blast_file: blasttranscript = columns[0].strip() blastsize = columns[1].strip() blast_transcript[blasttranscript] = int(blastsize) blastsize = blast_transcript[blasttranscript] size = ercctranscript_size[transcript] print size if transcript not in blast_transcript: unknown_transcript.write('{0}\n'.format(transcript)) else: size = ercctranscript_size[transcript] if blastsize >= 0.9*size: print >> out_file, transcript, True else: print >> out_file, transcript, False But I have a problem storing all size length to the value size as it is always comes back with the last entry. Could anyone explain to me what I am doing wrong and how I should set the values for each dictionary? I am really new to python and this is my first script Thanks for your help everybody! From wuwei23 at gmail.com Tue Jun 4 23:17:03 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 4 Jun 2013 20:17:03 -0700 (PDT) Subject: Issue values dictionary References: Message-ID: On Jun 5, 12:41?pm, claire morandin wrote: > But I have a problem storing all size length to the value size as it is always comes back with the last entry. > Could anyone explain to me what I am doing wrong and how I should set the values for each dictionary? Your code has two for loops, one that reads ERCC.txt into a dict, and one that reads blast.txt into a dict. The first assigns to `transcript`, the second to `blasttranscript`. When the loops are finished, you're using the _last_ value set for both `transcript` and `blasttranscript`. So, really, you want _three_ loops: two to load the files into dicts, then another to compare the two of them. If the transcripts in blast.txt are guaranteed to be a subset of ERCC.txt, then you could get away with two loops: # convenience function for splitting lines into values def get_transcript_and_size(line): columns = line.strip().split() return columns[0].strip(), int(columns[1].strip()) # read in blast_file blast_transcripts = {} with open('transcript_blast.txt') as blast_file: # this is a context manager, it'll close the file when it's finished for line in blast_file: blasttranscript, blastsize = get_transcript_and_size(line) blast_transcripts[blasttranscript] = blastsize # read in ERCC and compare to blast with open('transcript_ERCC.txt') as ercc_file, \ open('Not_sequenced_ERCC_transcript.txt', 'w') as unknown_transcript, \ open('transcript_out.txt', 'w') as out_file: # this is called a _nested_ context manager, and requires 2.7+ or 3.1+ for line in ercc_file: ercctranscript, erccsize = get_transcript_and_size(line) if ercctranscript not in blast_transcripts: print >> unknown_transcript, ercctranscript else: is_ninety_percent = blast_transcripts[ercctranscript] >= 0.9*erccsize print >> out_file, ercctranscript, is_ninety_percent I've cleaned up your code a bit, using more similar naming schemes and the same open/write procedures for all file access. Generally, any time you're repeating code, you should stick it into a function and use that instead, like the `get_transcript_and_size` func. If the columns in your two files are separated by tabs, or always by the same number of spaces, you can simplify this even further by using the csv module: http://docs.python.org/2/library/csv.html Hope this helps. From __peter__ at web.de Wed Jun 5 03:43:09 2013 From: __peter__ at web.de (Peter Otten) Date: Wed, 05 Jun 2013 09:43:09 +0200 Subject: Issue values dictionary References: Message-ID: alex23 wrote: > def get_transcript_and_size(line): > columns = line.strip().split() > return columns[0].strip(), int(columns[1].strip()) You can remove all strip() methods here as split() already strips off any whitespace from the columns. Not really important, but the nitpicker in me keeps nagging ;) From wuwei23 at gmail.com Wed Jun 5 05:46:20 2013 From: wuwei23 at gmail.com (alex23) Date: Wed, 5 Jun 2013 02:46:20 -0700 (PDT) Subject: Issue values dictionary References: Message-ID: <09f7cf28-70cc-425b-8e93-872ac49a55f3@ks18g2000pbb.googlegroups.com> On Jun 5, 5:43?pm, Peter Otten <__pete... at web.de> wrote: > You can remove all strip() methods here as split() already strips off any > whitespace from the columns. > > Not really important, but the nitpicker in me keeps nagging ;) Thanks, I really should have checked but just pushed the OPs code into a function, I didn't want to startle them with completely different code :) As I mentioned, I would've used the csv module for this anyway, which is why I never remember the split/strip behaviour. Nitpickery can be a virtue in this field :) From claire.morandin at gmail.com Wed Jun 5 00:05:28 2013 From: claire.morandin at gmail.com (claire morandin) Date: Tue, 4 Jun 2013 21:05:28 -0700 (PDT) Subject: Issue values dictionary In-Reply-To: References: Message-ID: @alex23 I can't thank you enough this really helped me so much, not only fixing my issue but also understanding where was my original error Thanks a lot From projecktzero at yahoo.com Tue Jun 4 23:45:08 2013 From: projecktzero at yahoo.com (Mike Hansen) Date: Tue, 4 Jun 2013 20:45:08 -0700 (PDT) Subject: Pywart: The problem with "Rick Johnson" Message-ID: <1370403908.36210.YahooMailNeo@web162701.mail.bf1.yahoo.com> Is "Rick Johnson" the alter ego of Xah Lee, or is he the result of a cross breeding experiement with a troll by Saruman at Isengard? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Wed Jun 12 15:17:49 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 12 Jun 2013 15:17:49 -0400 Subject: Pywart: The problem with "Rick Johnson" In-Reply-To: <1370403908.36210.YahooMailNeo@web162701.mail.bf1.yahoo.com> References: <1370403908.36210.YahooMailNeo@web162701.mail.bf1.yahoo.com> Message-ID: On 6/4/2013 11:45 PM, Mike Hansen wrote: > > Is "Rick Johnson" the alter ego of Xah Lee, or is he the result of a > cross breeding experiement with a troll by Saruman at Isengard? He is a Python programmer competent enough with tkinter to have given useful answers to me and others. He occasionally enjoys verbal jousting, as in a bar, but pollutes his rants with ad hominem slurs. In other words, your subject line was funny, as a spot on parody of his subject lines. Your content was, to me, not funny, and missed the mark. -- Terry Jan Reedy From rantingrickjohnson at gmail.com Wed Jun 12 21:30:29 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Wed, 12 Jun 2013 18:30:29 -0700 (PDT) Subject: Pywart: The problem with "Rick Johnson" In-Reply-To: References: <1370403908.36210.YahooMailNeo@web162701.mail.bf1.yahoo.com> Message-ID: <43fe08b8-6591-4f63-b8ec-f868f254f4f2@googlegroups.com> On Wednesday, June 12, 2013 2:17:49 PM UTC-5, Terry Reedy wrote: > On 6/4/2013 11:45 PM, Mike Hansen wrote: > > Is "Rick Johnson" the alter ego of Xah Lee, or is he the result of a > > cross breeding experiement with a troll by Saruman at Isengard? > He is a Python programmer competent enough with tkinter to have given > useful answers to me and others. Well thanks Terry. You've always been a knowledgeable and kind force on this list and the Python community could definitely use a few more like you. Hey, i would trade one-hundred Ricks for five or six more Terrys. :-) > He occasionally enjoys verbal jousting, > as in a bar, but pollutes his rants with ad hominem slurs. Urm, well i will admit my methods can be a bit "confrontational", however my intentions are always virtuous. "Ad hominem slurs" may be a bit too harsh, or, maybe my definition of "ad hominem" is different than others. I'll admit, I've never been the type that "works well with others". I'm more of a "one man army" than a "team player". But then again, some of the greatest intellects in history share my awkward social skills! And even if my "PyWarts" are troubling to some, i believe they are needed simply because they serve a greater purpose -- greater than even Rick himself! Because you cannot repair a problem if you are unaware that the problem exists. You see Terry, i'm just a soldier sacrificing myself on the alter of selflessness for the greater cause of this community. And whilst my vulgar display of bravado, and occasional diversions into hyperbole, can be upsetting to some, on the flip-side, my focused application of pure logical reasoning and my *unshakable* adherence to the fine principals of consistency can enlighten so many more! PS: Was this a private email sent to you or a thread started on the list? Because i don't see this thread anywhere -- unless I've gone blind??? From rosuav at gmail.com Wed Jun 12 21:38:26 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 11:38:26 +1000 Subject: Pywart: The problem with "Rick Johnson" In-Reply-To: <43fe08b8-6591-4f63-b8ec-f868f254f4f2@googlegroups.com> References: <1370403908.36210.YahooMailNeo@web162701.mail.bf1.yahoo.com> <43fe08b8-6591-4f63-b8ec-f868f254f4f2@googlegroups.com> Message-ID: On Thu, Jun 13, 2013 at 11:30 AM, Rick Johnson wrote: > PS: Was this a private email sent to you or a thread started on the list? Because i don't see this thread anywhere -- unless I've gone blind??? It was on-list, but there seems to be an issue with some posts - seems to be @yahoo.com addresses - getting delayed. May have something to do with the mail/news gateway, maybe a spam filter or something. I don't know. ChrisA From vinay_sajip at yahoo.co.uk Wed Jun 5 06:37:20 2013 From: vinay_sajip at yahoo.co.uk (Vinay Sajip) Date: Wed, 5 Jun 2013 03:37:20 -0700 (PDT) Subject: ANN: A new version (0.3.4) of the Python module which wraps GnuPG has been released. Message-ID: A new version of the Python module which wraps GnuPG has been released. What Changed? ============= This is a minor enhancement and bug-fix release. See the project website ( http://code.google.com/p/python-gnupg/ ) for more information. Summary: An encoding bug which caused an exception when getting the GPG version has been fixed. Recipients can be passed in a set or frozenset as well as in a list or tuple. The keyring argument now accepts a list of public keyring filenames as well as a single filename. A secret_keyring argument has been added which accepts either a single filename or a list of filenames for secret keyrings. The current version passes all tests on Windows (CPython 2.4, 2.5, 2.6, 2.7, 3.1 and Jython 2.5.1), Mac OS X (Python 2.5) and Ubuntu (CPython 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2). On Windows, GnuPG 1.4.11 has been used for the tests. What Does It Do? ================ The gnupg module allows Python programs to make use of the functionality provided by the Gnu Privacy Guard (abbreviated GPG or GnuPG). Using this module, Python programs can encrypt and decrypt data, digitally sign documents and verify digital signatures, manage (generate, list and delete) encryption keys, using proven Public Key Infrastructure (PKI) encryption technology based on OpenPGP. This module is expected to be used with Python versions >= 2.4, as it makes use of the subprocess module which appeared in that version of Python. This module is a newer version derived from earlier work by Andrew Kuchling, Richard Jones and Steve Traugott. A test suite using unittest is included with the source distribution. Simple usage: >>> import gnupg >>> gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory') >>> gpg.list_keys() [{ ... 'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2', 'keyid': '197D5DAC68F1AAB2', 'length': '1024', 'type': 'pub', 'uids': ['', 'Gary Gross (A test user) ']}, { ... 'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A', 'keyid': '0C5FEFA7A921FC4A', 'length': '1024', ... 'uids': ['', 'Danny Davis (A test user) ']}] >>> encrypted = gpg.encrypt("Hello, world!", ['0C5FEFA7A921FC4A']) >>> str(encrypted) '-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n\nhQIOA/6NHMDTXUwcEAf ... -----END PGP MESSAGE-----\n' >>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret') >>> str(decrypted) 'Hello, world!' >>> signed = gpg.sign("Goodbye, world!", passphrase='secret') >>> verified = gpg.verify(str(signed)) >>> print "Verified" if verified else "Not verified" 'Verified' For more information, visit http://code.google.com/p/python-gnupg/ - as always, your feedback is most welcome (especially bug reports, patches and suggestions for improvement). Enjoy! Cheers Vinay Sajip Red Dove Consultants Ltd. From nospam at nospam.com Wed Jun 5 09:08:54 2013 From: nospam at nospam.com (Gilles) Date: Wed, 05 Jun 2013 15:08:54 +0200 Subject: Source code to identify user through browser? Message-ID: Hello I was wondering if some Python module were available to identify a user through their browser, like it's done on the Panopticlick site: http://panopticlick.eff.org/ I'd like to ban abusive users, and it seems like a good solution, since few users will think of installing a different browser, and there are few mainstream browsers anyway. Thank you. From joel.goldstick at gmail.com Wed Jun 5 10:28:48 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Wed, 5 Jun 2013 10:28:48 -0400 Subject: Source code to identify user through browser? In-Reply-To: References: Message-ID: On Wed, Jun 5, 2013 at 9:08 AM, Gilles wrote: > Hello > > I was wondering if some Python module were available to identify a > user through their browser, like it's done on the Panopticlick site: > > http://panopticlick.eff.org/ > > I'd like to ban abusive users, and it seems like a good solution, > since few users will think of installing a different browser, and > there are few mainstream browsers anyway. > > Thank you. > -- > http://mail.python.org/mailman/listinfo/python-list > depending upon the server you are using, there is a request object that contains information about the user (ip address, and lots of other stuff). Maybe that will help you. -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosnepomuceno at outlook.com Wed Jun 5 11:10:41 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 18:10:41 +0300 Subject: Source code to identify user through browser? In-Reply-To: References: Message-ID: > From: nospam at nospam.com > Subject: Source code to identify user through browser? > Date: Wed, 5 Jun 2013 15:08:54 +0200 > To: python-list at python.org > > Hello > > I was wondering if some Python module were available to identify a > user through their browser, like it's done on the Panopticlick site: What do you mean by user? > http://panopticlick.eff.org/ > > I'd like to ban abusive users, and it seems like a good solution, > since few users will think of installing a different browser, and > there are few mainstream browsers anyway. > > Thank you. > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Wed Jun 5 11:18:56 2013 From: rustompmody at gmail.com (rusi) Date: Wed, 5 Jun 2013 08:18:56 -0700 (PDT) Subject: Source code to identify user through browser? References: Message-ID: <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> On Jun 5, 8:10?pm, Carlos Nepomuceno wrote: > > From: nos... at nospam.com > > Subject: Source code to identify user through browser? > > Date: Wed, 5 Jun 2013 15:08:54 +0200 > > To: python-l... at python.org > > > Hello > > > I was wondering if some Python module were available to identify a > > user through their browser, like it's done on the Panopticlick site: > > What do you mean by user? Ha! Nice question. Not in direct answer but here's E.W Dijkstra defining 'user': [from http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD618.html ] ---------------------------- The computer ?user? isn?t a real person of flesh and blood, with passions and brains. No, he is a mythical figure, and not a very pleasant one either. A kind of mongrel with money but without taste, an ugly caricature that is very uninspiring to work for. He is, as a matter of fact, such an uninspiring idiot that his stupidity alone is a sufficient explanation for the ugliness of most computer systems. And oh! Is he uneducated! That is perhaps his most depressing characteristic. He is equally education-resistant as another equally mythical bore, ?the average programmer?, whose solid stupidity is the greatest barrier to progress in programming. It is a sad thought that large sections of computing science are effectively paralyzed by the narrow-mindedness and other grotesque limitations with which a poor literature has endowed these influential mythical figures. (Computing science is not unique in inventing such paralyzing caricatures: universities all over the world are threatened by the invention of ?the average student?, scientific publishing is severely hampered by the invention of ?the innocent reader? and even ?the poor reader?!) From breamoreboy at yahoo.co.uk Wed Jun 5 11:31:46 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 16:31:46 +0100 Subject: Source code to identify user through browser? In-Reply-To: <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> References: <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> Message-ID: On 05/06/2013 16:18, rusi wrote: > On Jun 5, 8:10 pm, Carlos Nepomuceno > wrote: >>> From: nos... at nospam.com >>> Subject: Source code to identify user through browser? >>> Date: Wed, 5 Jun 2013 15:08:54 +0200 >>> To: python-l... at python.org >> >>> Hello >> >>> I was wondering if some Python module were available to identify a >>> user through their browser, like it's done on the Panopticlick site: >> >> What do you mean by user? > > Ha! Nice question. Not in direct answer but here's E.W Dijkstra > defining 'user': > > [from http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD618.html > ] > ---------------------------- > The computer ?user? isn?t a real person of flesh and blood, with > passions and brains. No, he is a mythical figure, and not a very > pleasant one either. A kind of mongrel with money but without taste, > an ugly caricature that is very uninspiring to work for. He is, as a > matter of fact, such an uninspiring idiot that his stupidity alone is > a sufficient explanation for the ugliness of most computer systems. > And oh! Is he uneducated! That is perhaps his most depressing > characteristic. He is equally education-resistant as another equally > mythical bore, ?the average programmer?, whose solid stupidity is the > greatest barrier to progress in programming. It is a sad thought that > large sections of computing science are effectively paralyzed by the > narrow-mindedness and other grotesque limitations with which a poor > literature has endowed these influential mythical figures. (Computing > science is not unique in inventing such paralyzing caricatures: > universities all over the world are threatened by the invention of > ?the average student?, scientific publishing is severely hampered by > the invention of ?the innocent reader? and even ?the poor reader?!) > Where does the Bastard Operator From Hell fit in this? :) -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From rustompmody at gmail.com Wed Jun 5 12:20:03 2013 From: rustompmody at gmail.com (rusi) Date: Wed, 5 Jun 2013 09:20:03 -0700 (PDT) Subject: Source code to identify user through browser? References: <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> Message-ID: <5f906c17-974b-49da-b68c-7c535cd1584b@a9g2000pbq.googlegroups.com> On Jun 5, 8:31?pm, Mark Lawrence wrote: > On 05/06/2013 16:18, rusi wrote: > > > > > > > > > > > On Jun 5, 8:10 pm, Carlos Nepomuceno > > wrote: > >>> From: nos... at nospam.com > >>> Subject: Source code to identify user through browser? > >>> Date: Wed, 5 Jun 2013 15:08:54 +0200 > >>> To: python-l... at python.org > > >>> Hello > > >>> I was wondering if some Python module were available to identify a > >>> user through their browser, like it's done on the Panopticlick site: > > >> What do you mean by user? > > > Ha! Nice question. ?Not in direct answer but here's E.W Dijkstra > > defining 'user': > > > [fromhttp://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD618.html > > ] > > ---------------------------- > > The computer ???user??? isn???t a real person of flesh and blood, with > > passions and brains. No, he is a mythical figure, and not a very > > pleasant one either. A kind of mongrel with money but without taste, > > an ugly caricature that is very uninspiring to work for. He is, as a > > matter of fact, such an uninspiring idiot that his stupidity alone is > > a sufficient explanation for the ugliness of most computer systems. > > And oh! Is he uneducated! That is perhaps his most depressing > > characteristic. He is equally education-resistant as another equally > > mythical bore, ???the average programmer???, whose solid stupidity is the > > greatest barrier to progress in programming. It is a sad thought that > > large sections of computing science are effectively paralyzed by the > > narrow-mindedness and other grotesque limitations with which a poor > > literature has endowed these influential mythical figures. (Computing > > science is not unique in inventing such paralyzing caricatures: > > universities all over the world are threatened by the invention of > > ???the average student???, scientific publishing is severely hampered by > > the invention of ???the innocent reader??? and even ???the poor reader???!) > > Where does the Bastard Operator From Hell fit in this? :) :-) Yes Dijkstra is quite a devil. Always thought-provoking and entertaining -- never to be taken too seriously! From carlosnepomuceno at outlook.com Wed Jun 5 18:07:07 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Thu, 6 Jun 2013 01:07:07 +0300 Subject: Source code to identify user through browser? In-Reply-To: <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> References: , , <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> Message-ID: > Date: Wed, 5 Jun 2013 08:18:56 -0700 > Subject: Re: Source code to identify user through browser? > From: rustompmody at gmail.com [...] > > What do you mean by user? > > Ha! Nice question. Not in direct answer but here's E.W Dijkstra > defining 'user': > > [from http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD618.html > ] > ---------------------------- > The computer ?user? isn?t a real person of flesh and blood, with > passions and brains. No, he is a mythical figure, and not a very > pleasant one either. A kind of mongrel with money but without taste, > an ugly caricature that is very uninspiring to work for. He is, as a > matter of fact, such an uninspiring idiot that his stupidity alone is > a sufficient explanation for the ugliness of most computer systems. > And oh! Is he uneducated! That is perhaps his most depressing > characteristic. He is equally education-resistant as another equally > mythical bore, ?the average programmer?, whose solid stupidity is the > greatest barrier to progress in programming. It is a sad thought that > large sections of computing science are effectively paralyzed by the > narrow-mindedness and other grotesque limitations with which a poor > literature has endowed these influential mythical figures. (Computing > science is not unique in inventing such paralyzing caricatures: > universities all over the world are threatened by the invention of > ?the average student?, scientific publishing is severely hampered by > the invention of ?the innocent reader? and even ?the poor reader?!) Didn't know he was such a humorist! lol Although I prefer when he's serious: http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1094.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Wed Jun 5 20:07:19 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Wed, 05 Jun 2013 20:07:19 -0400 Subject: Dijkstra (was Re: Source code to identify user through browser?) In-Reply-To: References: , , <53e74d68-7bd0-4ee6-bb6c-f3f7724c9342@qz2g2000pbb.googlegroups.com> Message-ID: On 6/5/2013 6:07 PM, Carlos Nepomuceno wrote: > Didn't know he was such a humorist! lol > > Although I prefer when he's serious: > > http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1094.html pythonic summary: Let S be an finite iterable of numbers (make it not an iterable if one interprets the conclusion as requiring reiteration) and let n = len(S) (or len(list(S)) if need be). The if n > 2 and len(set(S)) > 1, n * min(S) < sum(S) < max(S) # easily shown by induction on n If the n = 1 or the items in S are all the same, n*min == sum == n*max I might call this the 'Averages are not extreme' theorem. Corollary: if min(s) == 1 and sum(S) > n, then max(S) > 1 'Pigeonhole Principle' -- Terry Jan Reedy From armandomontesdeocaiii at gmail.com Wed Jun 5 10:40:52 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 07:40:52 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. Message-ID: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Traceback (most recent call last): File "Guessing_Game.py", line 32, in input (enter) File "", line 0 ^ SyntaxError: unexpected EOF while parsing ------------------ (program exited with code: 1) This is the only place a string is used: else: print "Sorry you loose the game." computernum = str(computernum) print " The computers number was!"+ computernum input (enter) sys.exit(0) Thank You, From carlosnepomuceno at outlook.com Wed Jun 5 11:07:21 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Wed, 5 Jun 2013 18:07:21 +0300 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: > Date: Wed, 5 Jun 2013 07:40:52 -0700 > Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. > From: armandomontesdeocaiii at gmail.com > To: python-list at python.org > > Traceback (most recent call last): > File "Guessing_Game.py", line 32, in > input (enter) > File "", line 0 > ^ > SyntaxError: unexpected EOF while parsing > ------------------ > (program exited with code: 1) > This is the only place a string is used: > else: > print "Sorry you loose the game." > computernum = str(computernum) > print " The computers number was!"+ computernum > input (enter) Did you declared an 'enter' variable? Because input() expects a string. > sys.exit(0) > Thank You, > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From alister.ware at ntlworld.com Wed Jun 5 11:11:16 2013 From: alister.ware at ntlworld.com (Alister) Date: Wed, 05 Jun 2013 15:11:16 GMT Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: On Wed, 05 Jun 2013 07:40:52 -0700, Armando Montes De Oca wrote: > Traceback (most recent call last): > File "Guessing_Game.py", line 32, in > input (enter) > File "", line 0 > ^ > SyntaxError: unexpected EOF while parsing ------------------ > (program exited with code: 1) > This is the only place a string is used: else: > print "Sorry you loose the game." > computernum = str(computernum) > print " The computers number was!"+ computernum input (enter) > sys.exit(0) > Thank You, You have made a mistake in your code without a clearer fault description no one here will be able to help. -- Whip it, whip it good! From armandomontesdeocaiii at gmail.com Wed Jun 5 11:14:25 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 08:14:25 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <5d967bc8-2ae4-4844-8e20-631364f75037@googlegroups.com> On Wednesday, June 5, 2013 10:40:52 AM UTC-4, Armando Montes De Oca wrote: > Traceback (most recent call last): > > File "Guessing_Game.py", line 32, in > > input (enter) > > File "", line 0 > > ^ > > SyntaxError: unexpected EOF while parsing > > ------------------ > > (program exited with code: 1) > > This is the only place a string is used: > > else: > > print "Sorry you loose the game." > > computernum = str(computernum) > > print " The computers number was!"+ computernum > > input (enter) > > sys.exit(0) > Yes I did declare and enter value it is: enter = "Please Press Enter To Continue..." > Thank You, From mail at timgolden.me.uk Wed Jun 5 11:23:36 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 05 Jun 2013 16:23:36 +0100 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <5d967bc8-2ae4-4844-8e20-631364f75037@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <5d967bc8-2ae4-4844-8e20-631364f75037@googlegroups.com> Message-ID: <51AF57F8.1010301@timgolden.me.uk> On 05/06/2013 16:14, Armando Montes De Oca wrote: > On Wednesday, June 5, 2013 10:40:52 AM UTC-4, Armando Montes De Oca wrote: >> Traceback (most recent call last): >> >> File "Guessing_Game.py", line 32, in >> >> input (enter) >> >> File "", line 0 >> >> ^ >> >> SyntaxError: unexpected EOF while parsing Armando. Try this at a Python prompt, and just press Enter without entering any text. input("Please enter something:") The trouble is that the beguilingly-named "input" function actually *evaluates* what you type, ie it's the same as doing this: eval("") which, as you can see, gives the same error message. You're clearly using Python 2.x as your prints are statements, so input has this characteristic. Instead you should use raw_input: raw_input(enter) TJG From zachary.ware+pylist at gmail.com Wed Jun 5 11:38:32 2013 From: zachary.ware+pylist at gmail.com (Zachary Ware) Date: Wed, 5 Jun 2013 10:38:32 -0500 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <5d967bc8-2ae4-4844-8e20-631364f75037@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <5d967bc8-2ae4-4844-8e20-631364f75037@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 10:14 AM, Armando Montes De Oca wrote: > On Wednesday, June 5, 2013 10:40:52 AM UTC-4, Armando Montes De Oca wrote: >> Traceback (most recent call last): >> >> File "Guessing_Game.py", line 32, in >> >> input (enter) >> >> File "", line 0 >> >> ^ >> >> SyntaxError: unexpected EOF while parsing >> >> ------------------ >> >> (program exited with code: 1) >> >> This is the only place a string is used: >> >> else: >> >> print "Sorry you loose the game." >> >> computernum = str(computernum) >> >> print " The computers number was!"+ computernum >> >> input (enter) >> >> sys.exit(0) >> Yes I did declare and enter value it is: > enter = "Please Press Enter To Continue..." >> Thank You, Hi Armando, There are a few problems with your question. To be able to help you, we really need to know your Python version, what OS you are using, how you are running your script, and at what point you get the error in question. Also, just a snippet of code from the middle of the script is useless to us, we need to see a complete, runnable program that shows your problem. In this particular case, though, I can deduce a few things and, I believe, answer your question. First, your Python version. Judging by your use of 'print' as a statement rather than a function, it looks like you're using Python 2, probably 2.7. This is a big factor in your problem. Second, when you get your error. I'm betting it's after you see "Please Press Enter To Continue..." and have pressed 'enter'. Now the kicker: I can reproduce your problem with the following complete program: # error_test.py input('Press enter') # end of error_test.py The problem here is that you are using 'input()' in Python 2. In Python 2, 'input()' is equivalent to 'eval(raw_input())', which means that anything you give to 'input' will be evaluated in the current scope, and this is a HUGE security hole. It can also cause serious issues, such as you are having with your program: when you press enter at the prompt, you pass '' (the empty string) to eval, which sees EOF before it can actually evaluate anything, and so it raises a SyntaxError. The simple fix here is to replace every occurance of 'input(' with 'raw_input(', or to make a step towards Python 3 compatibility, add this to the top of your program: try: input = raw_input except NameError: pass Hope this helps, Zach From armandomontesdeocaiii at gmail.com Wed Jun 5 11:16:34 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 08:16:34 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: import random import sys enter = "Please Press Enter To Continue..." print " Hello! Welcome to a Guessing game!" print " Please Guess a number between 1 - 100" computernum = random.randint (1, 100) Guess1 = input ( "My First Guess Is: ") if Guess1 == computernum: print "You Win !" input (enter) sys.exit(0) else: print "Sorry, Try Again!" print "You have Two guesses remaining!" Guess2 = input("My Second Guess Is: ") if Guess2 == computernum: print "Wow, Congradulations YOU WIN!" input (enter) sys.exit(0) else: print "Sorry One more try!" print "You have One final guess remaining!" Guess3 = input (" My final guess is ") if Guess3 == computernum: print "Congradulations shit head" input (enter) sys.exit (0) else: print "Sorry you loose the game." computernum = str(computernum) print "The computers number was!" + computernum input (enter) sys.exit(0) From armandomontesdeocaiii at gmail.com Wed Jun 5 11:18:07 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 08:18:07 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <3c07aa9f-99b7-41ec-951a-565265f664c9@googlegroups.com> I just post all my code I have for the guessing game. From breamoreboy at yahoo.co.uk Wed Jun 5 11:25:07 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 05 Jun 2013 16:25:07 +0100 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <3c07aa9f-99b7-41ec-951a-565265f664c9@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <3c07aa9f-99b7-41ec-951a-565265f664c9@googlegroups.com> Message-ID: On 05/06/2013 16:18, Armando Montes De Oca wrote: > I just post all my code I have for the guessing game. > Please post with some context so we don't have to go to other parts of the thread to find out what you're talking about, thanks. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From armandomontesdeocaiii at gmail.com Wed Jun 5 11:35:34 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 08:35:34 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> Thank You now the program exits with: (program exited with code: 0) Press return to continue Is there a way to get the line (program exited with code: 0) to say something like: "The game will end now" Press return to contine From zachary.ware+pylist at gmail.com Wed Jun 5 12:15:51 2013 From: zachary.ware+pylist at gmail.com (Zachary Ware) Date: Wed, 5 Jun 2013 11:15:51 -0500 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 10:35 AM, Armando Montes De Oca wrote: > Thank You now the program exits with: > (program exited with code: 0) > Press return to continue > > > Is there a way to get the line (program exited with code: 0) to say something > > like: "The game will end now" > > Press return to contine To whom are you replying? Please quote what (and who) you are replying to to provide context. As for how to change that line, it depends on how you're running the script. From joel.goldstick at gmail.com Wed Jun 5 12:30:23 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Wed, 5 Jun 2013 12:30:23 -0400 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 12:15 PM, Zachary Ware wrote: > On Wed, Jun 5, 2013 at 10:35 AM, Armando Montes De Oca > wrote: > > Thank You now the program exits with: > > (program exited with code: 0) > > Press return to continue > > > > > > Is there a way to get the line (program exited with code: 0) to say > something > > > > like: "The game will end now" > > > > Press return to contine > > To whom are you replying? Please quote what (and who) you are > replying to to provide context. > > As for how to change that line, it depends on how you're running the > script. > -- > http://mail.python.org/mailman/listinfo/python-list > The program exited with code: 0 is being provided by geany after your program has run. If instead you open up a terminal and type: python your_program.py You will run your program and get an error message from python. You can get rid of the error message by using try/except, but you may not have learned about that yet. good luck -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From armandomontesdeocaiii at gmail.com Wed Jun 5 15:59:39 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 12:59:39 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> Message-ID: <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> Well I am replying to To whom it may concern at this point I am a bit lost. I posted all my code. I am not taking classes on this nor do I have a book I followed a guy on You Tube. I am a student but I heard Python is a good language to learn in conjunction with C++ and Perl for example. I have taken Visual Basic 2010 last semester so keep thinking for me if you like if not when I can get a Python book or lesson. Joel Goldstick seems the more "professorly" so far by telling me the right thing of I have not learned something yet. Also with a name like Goldstick which seems Jewish to me. I would think as a Gentile Heathen Jesus save us this would project a need for a good sex life. From thomasmurphymusic at gmail.com Wed Jun 5 16:18:36 2013 From: thomasmurphymusic at gmail.com (Thomas Murphy) Date: Wed, 5 Jun 2013 16:18:36 -0400 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> Message-ID: Goldstick which seems Jewish to me. I would think as a Gentile Heathen Jesus save us this would project a need for a good sex life *WAT* * * * * Armando, are you understanding that input and raw_input make Python do very different things, and this is dependent of the version of Python you're using? Folks aren't being pedantic, it's critical to giving you a good answer. On Wed, Jun 5, 2013 at 3:59 PM, Armando Montes De Oca < armandomontesdeocaiii at gmail.com> wrote: > Well I am replying to To whom it may concern at this point I am a bit > lost. I posted all my code. I am not taking classes on this nor do I have a > book I followed a guy on You Tube. I am a student but I heard Python is a > good language to learn in conjunction with C++ and Perl for example. I have > taken Visual Basic 2010 last semester so keep thinking for me if you like > if not when I can get a Python book or lesson. Joel Goldstick seems the > more "professorly" so far by telling me the right thing of I have not > learned something yet. Also with a name like Goldstick which seems Jewish > to me. I would think as a Gentile Heathen Jesus save us this would project > a need for a good sex life. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Sincerely, Thomas Murphy Code Ninja 646.957.6115 -------------- next part -------------- An HTML attachment was scrubbed... URL: From joel.goldstick at gmail.com Wed Jun 5 16:32:08 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Wed, 5 Jun 2013 16:32:08 -0400 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> Message-ID: On Wed, Jun 5, 2013 at 4:18 PM, Thomas Murphy wrote: > Goldstick which seems Jewish to me. I would think as a Gentile Heathen > Jesus save us this would project a need for a good sex life > > *WAT* > * > * > I second the WAT. You are a strange person. I think you were being offensive. I can't help you with your sex life. Sorry kid. > ** > * > * > Armando, are you understanding that input and raw_input make Python do > very different things, and this is dependent of the version of Python > you're using? Folks aren't being pedantic, it's critical to giving you a > good answer. > > > So it seems you changed your input to raw_input and now your program works. But you don't like the final message. Do you know what this line does: sys.exit(0) If you don't, then you shouldn't have put it in your program. Google it "python sys.exit(0)". I imagine that is what is causing the message you are concerned with. Try removing that line (each place you have them) and see what happens. Also, there is a python-tutor list that may be a better place for you to post. Try being polite. You may be quite a bit more lost than you realize! > On Wed, Jun 5, 2013 at 3:59 PM, Armando Montes De Oca < > armandomontesdeocaiii at gmail.com> wrote: > >> Well I am replying to To whom it may concern at this point I am a bit >> lost. I posted all my code. I am not taking classes on this nor do I have a >> book I followed a guy on You Tube. I am a student but I heard Python is a >> good language to learn in conjunction with C++ and Perl for example. I have >> taken Visual Basic 2010 last semester so keep thinking for me if you like >> if not when I can get a Python book or lesson. Joel Goldstick seems the >> more "professorly" so far by telling me the right thing of I have not >> learned something yet. Also with a name like Goldstick which seems Jewish >> to me. I would think as a Gentile Heathen Jesus save us this would project >> a need for a good sex life. >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > > > -- > Sincerely, > Thomas Murphy > Code Ninja > 646.957.6115 > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Wed Jun 5 16:23:07 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 06:23:07 +1000 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <35ea9e7f-baa3-4bc8-899c-0a11b8106365@googlegroups.com> <622d0d3c-c2a2-4d24-80c3-3eb9d8da1364@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 5:59 AM, Armando Montes De Oca wrote: > Well I am replying to To whom it may concern at this point I am a bit lost. I posted all my code. I am not taking classes on this nor do I have a book I followed a guy on You Tube. I am a student but I heard Python is a good language to learn in conjunction with C++ and Perl for example. I have taken Visual Basic 2010 last semester so keep thinking for me if you like if not when I can get a Python book or lesson. Joel Goldstick seems the more "professorly" so far by telling me the right thing of I have not learned something yet. Also with a name like Goldstick which seems Jewish to me. I would think as a Gentile Heathen Jesus save us this would project a need for a good sex life. .... uhh... Have you been taking lessons from Dihedral? If not, let's leave out the personal remarks. I don't think they're helping, and they're certainly not making you any easier to comprehed. (I'm still not sure what your last sentence is saying.) As to context, though: It's conventional on mailing lists and newsgroups to retain some of the previous post's text to provide a hook as to what you're replying to. You'll find plenty of information about that on the internet; the general recommendation is to eyeball what you're sending and trim the text to just what it takes to provide context for your post. The quoted text goes first, and your text underneath (possibly interspersed, if appropriate). ChrisA From armandomontesdeocaiii at gmail.com Wed Jun 5 11:56:06 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 08:56:06 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <62f42468-c60d-4b36-be0f-6617be448d50@googlegroups.com> Thank You I will give it a try I am using Linux Mint 14 Nadia and my Python is with Geany 1.22 and I think it is python 2 From armandomontesdeocaiii at gmail.com Wed Jun 5 12:01:30 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 09:01:30 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: try: input = raw_input except NameError: pass This gave me the same output exited with code zero Same with or without. I am happy with the code 0 in it for now but if anyone knows with Geany in Linux Mint 14 Nadia what I can do to get it to say something nice and proper I would appreciate it for my next program. From armandomontesdeocaiii at gmail.com Wed Jun 5 17:02:22 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 14:02:22 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: Not to make excuses as to my forum etiquette I apologize. I am half Cuban and simple. I meant no disrespect I like Mr. Goldstick's name. Maybe I can find the answer somewhere else true. However a simple code to close the program like in Visual Basic "Me.close" seems like something that should come easy to a program environment. sys.exit(0) for python is logical. I just get the line: program exited with code (0). I will Google the line in any case. You know in school I did well in English writing if that helps. I also can take the line out sys.exit(0). So I need a different line of code to close or to do something to make that line not appear. I also understand that programming languages can be more complex to get somethings done. Thank You all for your time. apologies. From armandomontesdeocaiii at gmail.com Wed Jun 5 18:51:13 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Wed, 5 Jun 2013 15:51:13 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <2bfa51a5-1179-4d61-8ad6-bc36384c6724@googlegroups.com> Well I am sure this will end up a simple solution which is not solved by the geniuses with no sense of humor. Programmers are known for being odd nerds and I just got two of them. Goldstick Jesus what a couple of lazy minded nonsense. Your an ass hole. From breamoreboy at yahoo.co.uk Wed Jun 5 19:32:17 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Thu, 06 Jun 2013 00:32:17 +0100 Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <2bfa51a5-1179-4d61-8ad6-bc36384c6724@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> <2bfa51a5-1179-4d61-8ad6-bc36384c6724@googlegroups.com> Message-ID: On 05/06/2013 23:51, Armando Montes De Oca wrote: > Well I am sure this will end up a simple solution which is not solved by the geniuses with no sense of humor. Programmers are known for being odd nerds and I just got two of them. Goldstick Jesus what a couple of lazy minded nonsense. Your an ass hole. > So that's three people at least within the last couple of weeks who could have written "How to win friends and influence people". -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From steve+comp.lang.python at pearwood.info Wed Jun 5 22:08:05 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 02:08:05 GMT Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: <51afef05$0$29966$c3e8da3$5496439d@news.astraweb.com> On Wed, 05 Jun 2013 07:40:52 -0700, Armando Montes De Oca wrote: > Traceback (most recent call last): > File "Guessing_Game.py", line 32, in > input (enter) > File "", line 0 > ^ > SyntaxError: unexpected EOF while parsing Your problem is that you should not be using input(), but raw_input() instead. Replace every call to input() to raw_input() instead, and this specific problem will go away. It may reveal other bugs, but that's programming for you. -- Steven From armandomontesdeocaiii at gmail.com Thu Jun 6 10:49:05 2013 From: armandomontesdeocaiii at gmail.com (Armando Montes De Oca) Date: Thu, 6 Jun 2013 07:49:05 -0700 (PDT) Subject: I just wrote my first Python program a guessing game and it exits with an error I get this. In-Reply-To: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> References: <498fb115-8568-478d-8443-1be20dd5c335@googlegroups.com> Message-ID: Yes Steven a C book I am reading has a quote "Every programmer is fluent in swearing" After my blow ups and confusion I am happy with my program anyway. I will get better at it eventually. I did change things to "raw_input" and works fine. From tavares at fe.up.pt Wed Jun 5 13:46:49 2013 From: tavares at fe.up.pt (tavares at fe.up.pt) Date: Wed, 5 Jun 2013 10:46:49 -0700 (PDT) Subject: Announcement: MICCAI workshop on Bio- Imaging and Visualization for Patient-Customized Simulations 2013 Message-ID: <0a96fa6c-61ab-4112-8211-cdd6a94ad7be@googlegroups.com> MICCAI workshop on Bio- Imaging and Visualization for Patient-Customized Simulations 2013 September 26, 2013 Nagoya University, Nagoya, Japan http://sites.google.com/site/mwbivpcs Description Imaging and Visualization are among the most dynamic and innovative areas of research of the past few decades. Justification of this activity arises from the requirements of important practical applications such as the visualization of computational data, the processing of medical images for assisting medical diagnosis and intervention, and the 3D geometry reconstruction and processing for computer simulations. Currently, due to the development of more powerful hardware resources, mathematical and physical methods, investigators have been incorporating advanced computational techniques to derive sophisticated methodologies that can better enable the solution of the problems encountered. Consequent to these efforts any effective methodologies have been proposed, validated and some of them have already been integrated into commercial software for computer simulations. The main goal of this MICCAI workshop on Bio- Imaging and Visualization for Patient-Customized Simulations 2013 (http://sites.google.com/site/mwbivpcs) is to provide a platform for communications among specialists from complementary fields such as signal and image processing, mechanics, computational vision, mathematics, physics, informatics, computer graphics, bio-medical-practice, psychology and industry. Participants in this workshop are going to present and discuss their proposed techniques and methods in the corresponding fields that are related to the workshop topics and explore the translational potentials of these emerging technological fields. This workshop will be an excellent opportunity to refine ideas for future work and to establish constructive cooperation for new and improved solutions of imaging and visualization techniques and modelling methods towards more realistic and efficient computer simulations. Another important objective of the MICCAI workshop on Bio- Imaging and Visualization for Patient-Customized Simulations 2013 is to establish a viable connection between software developers, specialist researchers and applied end-users from diverse fields related to Signal Processing, Imaging, Visualization, Biomechanics and Simulation. Topics of interest include (but are not restricted to): - Image processing and Analysis for Patient-Customized Simulations; - Image Enhancement, Segmentation and Description in Patient-Customized Simulations; - Image based Tracking, Matching and Registration in Patient-Customized Simulations; - Computer Modelling for Patient-Customized Simulations - 3D Shape Reconstruction and Processing in Patient-Customized Simulations; - Medical Imaging for Patient-Customized Simulations; - Data Processing, Modelling and Analysis in Patient-Customized Simulations; - Scientific Visualization for Patient-Customized Simulations; - Enhanced Visualization in Patient-Customized Simulations; - Human-Computer Interaction in Patient-Customized Simulations; - Enhanced and Virtual Reality in Patient-Customized Simulations; - Software Development for Patient-Customized Simulations; - Grid Computing in Patient-Customized Simulations; - Applications of Patient-Customized Simulations. Publications - The best 6 papers presented in the workshop will be invited to be included as extended versions in a special issue of the Taylor and Francis group ?Computer Methods in Biomechanics and Biomedical Engineering: Imaging & Visualization? journal (http://www.tandfonline.com/tciv). - 15 papers presented in the workshop will be select to be include as extended versions in a book dedicated to ?Imaging and Visualization for Patient-Customized Simulations? to be published by SPRINGER under the ?Lecture Notes in Computational Vision and Biomechanics? book series (http://www.springer.com/series/8910). Award: A best paper prize will be given by the workshop organizers to the best paper presented in the workshop. Important Dates: Deadline for Submission: June 21, 2013 Notification of Acceptance: July 8, 2013 Camera-Ready Submission: July 12, 2013 Workshop Final Program: July 31, 2013 Workshop: September 26, 2013 Deadline for Submission to Journal Special Issue: Nov. 1, 2013 Deadline for Submission to Chapter Book: April 1, 2014 Program Committee: Alberto Santamaria-Pang, GE Global Research Center, USA Alexandre X. Falc?o, Universidade Estadual de Campinas, Brazil Aly Farag, Louisville University, USA Bernard Gosselin, University of Mons, Belgium Bego?a Calvo, University of Zaragoza, Spain Bin Gu, University of Western Ontario, Canada Christos E. Constantinou, Stanford University, USA Daniela Iacoviello, Universit? degli Studi di Roma "La Sapienza", Italy Eduardo Soudah, International Center for Numerical Methods in Engineering, Spain F. Xavier Roca, Universitat Aut?noma de Barcelona, Spain Francisco P.M. Oliveira, Universidade do Porto, Portugal Jo?o Paulo Papa, Universidade Estadual Paulista, Brazil Jorge Barbosa, Universidade do Porto, Portugal Jorge S. Marques, Instituto Superior T?cnico, Portugal Josef ?lapal, Brno University of Technology, Czech Republic Jack Yao, NIH, USA Jun Zhao, Shanghai Jiao Tong University, China Khan M Iftekharuddin, Old Dominion University, USA Linte, Cristian A., Mayo Clinic, USA M. Emre Celebi, Louisiana State University in Shreveport, USA Manuel Gonz?lez Hidalgo, Balearic Islands University, Spain Marc Thiriet, Universite Pierre et Marie Curie (Paris VI), France Paolo Di Giamberardino, Sapienza University of Rome, Italy Renato Natal Jorge, Universidade do Porto, Portugal Reneta Barneva, State University of New York Fredonia, USA Sanderson L. Gonzaga de Oliveira, Universidade Federal de Lavras, Brazil Sandra Rua Ventura, Instituto Polit?cnico do Porto, Portugal Victor Hugo C. de Albuquerque, Universidade de Fortaleza, Brazil Xiangrong Zhou, Gifu University, Japan Xinjian Chen, Soochow University, China Xiongbiao Luo, Nagoya University, Japan Yan Nei Law, Bioinformatics Institute, Singapore Yongjie Zhang, Carnegie Mellon University, USA Yubo Fan, Beihang University, China Zeyun Yu, University of Wisconsin at Milwaukee, USA Zhen Ma, Universidade do Porto, Portugal Zhijie Wang, University of Western Ontario, Canada Zhou Jiayin, Astar, Singapore Organizers Jo?o Manuel R. S. Tavares Faculty of Engineering of University of Porto, Porto, Portugal Email: tavares at fe.up.pt, url: www.fe.up.pt/~tavares Phone: +351-22-508-1487 Shuo Li University of Western Ontario, Canada Email: shuo.li at ge.com, url: http://dig.lhsc.on.ca/members/shuo.php Phone: 519-646-6000 (ext. 64624) From nikos.gr33k at gmail.com Wed Jun 5 15:54:45 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 12:54:45 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser Message-ID: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> Since the other thread gone into the wild, i choosed not to participate any longer and i state the question in this new thread. 'python files.py' interprets without an error. Problem is that when via browser - http://superhost.gr/cgi-bin/koukos.py i receive the following: ------------------------------- root at nikos [/home/nikos/www/cgi-bin]# ls ./ ../ convert.py* files.py* .htaccess koukos.py* metrites.py* pelatologio.py* root at nikos [/home/nikos/www/cgi-bin]# tail -F /usr/local/apache/logs/error_log & root at nikos [/home/nikos/www/cgi-bin]# [Wed Jun 05 22:47:43 2013] [error] [client 79.103.41.173] (2)No such file or directory: exec of '/home/nikos/public_html/c gi-bin/koukos.py' failed [Wed Jun 05 22:47:43 2013] [error] [client 79.103.41.173] Premature end of scrip t headers: koukos.py ---------------------------------- What file does the error complain it cannot find? I do not understand its message. Here is the code of koukos.py ----------------------------- #!/usr/bin/python # coding=utf-8 import cgitb; cgitb.enable() import cgi, os, sys, locale, codecs from http import cookies #needed line, script does *not* work without it sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach()) # initialize cookie cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) nikos = cookie.get('nikos') # if visitor cookie does exist if nikos: message = "??? ??? ??????? ???????? ??? ?? ?? ????????? ?? ????????? ?????????? ??? ???????!" cookie['nikos'] = 'admin' cookie['nikos']['path'] = '/' cookie['nikos']['expires'] = -1 #this cookie will expire now else: message = "??? ?? ??? ??? ???? ??? ?? ????, ??? ?? ????, ??? ?? ??????! ?? ????? ????? ? ??????? ??????????!!" cookie['nikos'] = 'admin' cookie['nikos']['path'] = '/' cookie['nikos']['expires'] = 60*60*24*30*12 #this cookie will expire in a year print( cookie, "Content-type: text/html; charset=utf-8\n", message ) sys.exit(0) --------------------------------- All it tries to do is to set a cookie. From rosuav at gmail.com Wed Jun 5 16:14:19 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 06:14:19 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 5:54 AM, ???????? ?????? wrote: > print( cookie, "Content-type: text/html; charset=utf-8\n", message ) > Do you know what this does? Try it at the console. See what it outputs. ChrisA From gordon at panix.com Wed Jun 5 16:13:37 2013 From: gordon at panix.com (John Gordon) Date: Wed, 5 Jun 2013 20:13:37 +0000 (UTC) Subject: Errin when executing a cgi script that sets a cookie in the browser References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> Message-ID: In <400ea041-adcf-4640-8872-f81808f7d402 at googlegroups.com> =?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?= writes: > 'python files.py' interprets without an error. > Problem is that when via browser - http://superhost.gr/cgi-bin/koukos.py > i receive the following: Why should 'files.py' have any relation to 'koukous.py'? > What file does the error complain it cannot find? I do not understand its > message. Here is the code of koukos.py > ----------------------------- > #!/usr/bin/python Does /usr/bin/python exist? Scripts can throw a 'No such file or directory' or 'Command not found' error if they begin with a shebang line which refers to a nonexistent program. -- John Gordon A is for Amy, who fell down the stairs gordon at panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" From rurpy at yahoo.com Wed Jun 5 16:56:03 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Wed, 5 Jun 2013 13:56:03 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> Message-ID: <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: >... > print( cookie, "Content-type: text/html; charset=utf-8\n", message ) >... If you look in the Apache error log file, you will see something like, [Wed Jun 05 16:39:14 2013] [error] [client 192.168.0.1] malformed header from script. Bad header= \xce\x91\xce\xa0\xce\x9f \xce\x94\xce\xa9 \xce\x9a\xce\x91\xce\x99 \xce\xa3\xce\xa4\xce\x9f \xce\x95\xce: koukos.py which is saying that the 'message' text is being interpreted as being part of the headers. You are missing a blank line between the header lines and the page text. That is, I think you want, print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) (ie, note the two \n's after the "utf-8" test.) From rosuav at gmail.com Wed Jun 5 17:03:29 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 07:03:29 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 6:56 AM, wrote: > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: >>... >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) >>... > > If you look in the Apache error log file, you will see something like, > > [Wed Jun 05 16:39:14 2013] [error] [client 192.168.0.1] malformed header from script. Bad header= \xce\x91\xce\xa0\xce\x9f \xce\x94\xce\xa9 \xce\x9a\xce\x91\xce\x99 \xce\xa3\xce\xa4\xce\x9f \xce\x95\xce: koukos.py > > which is saying that the 'message' text is being interpreted as > being part of the headers. > > You are missing a blank line between the header lines and the > page text. That is, I think you want, > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) > > (ie, note the two \n's after the "utf-8" test.) But that won't solve it either. The default separator for print is a space, so this will indent his Content-type line by one space. Nikos, do you know what effect that will have? If not, research HTTP. RFC 2616 is a good place to start. ChrisA From rurpy at yahoo.com Wed Jun 5 17:18:39 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Wed, 5 Jun 2013 14:18:39 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> Message-ID: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 6:56 AM, wrote: > > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: > >>... > >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) > >>... > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) > > (ie, note the two \n's after the "utf-8" test.) > > But that won't solve it either. The default separator for print is a > space, so this will indent his Content-type line by one space. Ah, quite right. Something like print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) then. From rosuav at gmail.com Wed Jun 5 18:21:08 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 08:21:08 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 7:18 AM, wrote: > On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: >> On Thu, Jun 6, 2013 at 6:56 AM, wrote: >> > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: >> >>... >> >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) >> >>... >> > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) >> > (ie, note the two \n's after the "utf-8" test.) >> >> But that won't solve it either. The default separator for print is a >> space, so this will indent his Content-type line by one space. > > Ah, quite right. Something like > > print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) > > then. Or change the sep, or concatenate with + instead of using , between them. Or put them on separate lines. Anything like that would work. And it's really easy to try things out interactively to see what they'll do... ChrisA From rurpy at yahoo.com Wed Jun 5 18:36:23 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Wed, 5 Jun 2013 15:36:23 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: On 06/05/2013 04:21 PM, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 7:18 AM, wrote: >> On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: ..[...] >> Ah, quite right. Something like >> >> print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) >> >> then. > > Or change the sep, or concatenate with + instead of using , between > them. Or put them on separate lines. Anything like that would work. Of course. > And it's really easy to try things out interactively to see what > they'll do... Sure, once one makes the connection between "Server Error" and missing "\n" which is where ???????? was stuck I'm guessing. From rosuav at gmail.com Wed Jun 5 21:37:25 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 6 Jun 2013 11:37:25 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: On Thu, Jun 6, 2013 at 8:36 AM, wrote: >> And it's really easy to try things out interactively to see what >> they'll do... > > Sure, once one makes the connection between "Server Error" and missing "\n" > which is where ???????? was stuck I'm guessing. I know that's a bit of a jump. That's why, right back when he first posted his problem, I quoted _that one line_ and pointed him to the interactive interpreter. I'm pretty sure he still isn't reading my posts... or, most likely, anyone's. ChrisA From nikos.gr33k at gmail.com Wed Jun 5 23:27:49 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 20:27:49 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: <17ed2c0c-5ebf-401a-a59a-9d270d0c43a8@googlegroups.com> ?? ??????, 6 ??????? 2013 1:21:08 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Thu, Jun 6, 2013 at 7:18 AM, wrote: > > > On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: > > >> On Thu, Jun 6, 2013 at 6:56 AM, wrote: > > >> > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: > > >> >>... > > >> >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) > > >> >>... > > >> > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) > > >> > (ie, note the two \n's after the "utf-8" test.) > > >> > > >> But that won't solve it either. The default separator for print is a > > >> space, so this will indent his Content-type line by one space. > > > > > > Ah, quite right. Something like > > > > > > print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) > > > > > > then. > > > > Or change the sep, or concatenate with + instead of using , between > > them. Or put them on separate lines. Anything like that would work. > > And it's really easy to try things out interactively to see what > > they'll do... > > > > ChrisA Thi is failing also with same error: print( cookie ) print( '''Content-type: text/html; charset=utf-8\n''' ) print( message ) From nikos.gr33k at gmail.com Thu Jun 6 02:25:14 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 23:25:14 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <17ed2c0c-5ebf-401a-a59a-9d270d0c43a8@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <17ed2c0c-5ebf-401a-a59a-9d270d0c43a8@googlegroups.com> Message-ID: <8ff3a8c7-3ca4-49e5-8153-042d535a792e@googlegroups.com> root at nikos [~]# chmod 755 /var/log root at nikos [~]# chmod 755 /var/log/httpd root at nikos [~]# chmod 666 /var/log/httpd/suexec.log root at nikos [~]# chmod 755 /usr/local/apache root at nikos [~]# chmod 755 /usr/local/apache/logs/ root at nikos [~]# chmod 666 /usr/local/apache/logs/error_log and then execute via browser: http://superhost.gr/cgi-bin/koukos.py still same error appearing: [Thu Jun 06 09:23:54 2013] [error] [client 79.103.41.173] suexec failure: could not open log file [Thu Jun 06 09:23:54 2013] [error] [client 79.103.41.173] fopen: Permission denied [Thu Jun 06 09:23:54 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py From cs at zip.com.au Wed Jun 5 20:32:37 2013 From: cs at zip.com.au (Cameron Simpson) Date: Thu, 6 Jun 2013 10:32:37 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> References: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: <20130606003237.GA66900@cskk.homeip.net> On 05Jun2013 14:18, rurpy at yahoo.com wrote: | On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: | > On Thu, Jun 6, 2013 at 6:56 AM, wrote: | > > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: | > >>... | > >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) | > >>... | > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) | > > (ie, note the two \n's after the "utf-8" test.) | > | > But that won't solve it either. The default separator for print is a | > space, so this will indent his Content-type line by one space. | | Ah, quite right. Something like | | print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) | | then. Unless "cookie" already has a newline. Then you'll end the headers there:-) A more robust approach might be to build a dict (or possibly better, list) of headers without newlines and then as a separate act to print them with newlines and add the spacer newline later, before writing the message body. Cheers, -- Cameron Simpson Drill for oil? You mean drill into the ground to try and find oil? You're crazy. --Drillers whom Edwin L. Drake tried to enlist to his project to drill for oil in 1859. From nikos.gr33k at gmail.com Wed Jun 5 23:23:42 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 5 Jun 2013 20:23:42 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: ?? ??????, 6 ??????? 2013 12:18:39 ?.?. UTC+3, ? ??????? ru... at yahoo.com ??????: > On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: > > > On Thu, Jun 6, 2013 at 6:56 AM, wrote: > > > > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, ???????? ?????? wrote: > > > >>... > > > >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) > > > >>... > > > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) > > > > (ie, note the two \n's after the "utf-8" test.) > > > > > > But that won't solve it either. The default separator for print is a > > > space, so this will indent his Content-type line by one space. > > > > Ah, quite right. Something like > > > > print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) > > > > then. print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) or by trying: print( cookie + "\nContent-type: text/html; charset=utf-8\n\n" + message ) the output is for both: nikos at superhost.gr [~]# tail -F /usr/local/apache/logs/error_log & nikos at superhost.gr [~]# [Thu Jun 06 06:20:11 2013] [error] [client 79.103.41.173] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Thu Jun 06 06:20:11 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py From nikos.gr33k at gmail.com Thu Jun 6 06:53:47 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 03:53:47 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: I have re-enabled 'suexec' and set cgi as default phphandler and then trying: print( cookie ) print( '''Content-type: text/html; charset=utf-8\n''' ) print( message ) --------------------------------- nikos at superhost.gr [~/www/data/apps]# [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] suexec failure: could not open log file [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] fopen: Permission denied [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py Even if dissable/enable suexec still this output error. From rurpy at yahoo.com Thu Jun 6 14:40:04 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Thu, 6 Jun 2013 11:40:04 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: <61b47852-9e34-4d9a-9ee3-9801f4cc3065@googlegroups.com> On 06/06/2013 04:53 AM, ???????? ?????? wrote:> I have re-enabled 'suexec' and set cgi as default phphandler and then trying: > > print( cookie ) > print( '''Content-type: text/html; charset=utf-8\n''' ) > print( message ) > > --------------------------------- > nikos at superhost.gr [~/www/data/apps]# [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] suexec failure: could not open log file > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] fopen: Permission denied > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py > > Even if dissable/enable suexec still this output error. This is only a guess but... The permissions on koukos.py have to be exactly right. Obviously if they are too restrictive Apache won't be able to read or execute it. But they can't be to open either -- in particular the file must have execute permission and must not have write permission for either group or others (write for user only). If the permissions are too open, Apache will try to write an error message to suexec.log. I suspect that your permissions (or file owner) is wrong on your suexec.log file (or containing directory) and that is the cause of the "could not open log file " message. So I think you have too problems: wrong permissions on koukos.py and wrong owner or permissions on suexec.log. For reference this is working here: -rw-r--r-- 1 apache apache 314 Jun 6 12:19 /var/log/httpd/suexec.log -rwxr-xr-x 1 me me 1113 Jun 5 14:40 koukos.py You'll need to adjust things for your particular Apache environment. As I said, this is only a guess. Hope it helps. From nikos.gr33k at gmail.com Thu Jun 6 15:01:29 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 12:01:29 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <61b47852-9e34-4d9a-9ee3-9801f4cc3065@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <61b47852-9e34-4d9a-9ee3-9801f4cc3065@googlegroups.com> Message-ID: <61f69d27-a041-48a3-99aa-be59ad817db9@googlegroups.com> ?? ??????, 6 ??????? 2013 9:40:04 ?.?. UTC+3, ? ??????? ru... at yahoo.com ??????: > On 06/06/2013 04:53 AM, ???????? ?????? wrote:> I have re-enabled 'suexec' and set cgi as default phphandler and then trying: > > > > > > print( cookie ) > > > print( '''Content-type: text/html; charset=utf-8\n''' ) > > > print( message ) > > > > > > --------------------------------- > > > nikos at superhost.gr [~/www/data/apps]# [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] suexec failure: could not open log file > > > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] fopen: Permission denied > > > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py > > > > > > Even if dissable/enable suexec still this output error. > > > > This is only a guess but... > > > > The permissions on koukos.py have to be exactly right. > > Obviously if they are too restrictive Apache won't be > > able to read or execute it. But they can't be to open > > either -- in particular the file must have execute > > permission and must not have write permission for either > > group or others (write for user only). > > > > If the permissions are too open, Apache will try to write > > an error message to suexec.log. I suspect that your > > permissions (or file owner) is wrong on your suexec.log > > file (or containing directory) and that is the cause of > > the "could not open log file " message. > > > > So I think you have too problems: wrong permissions on > > koukos.py and wrong owner or permissions on suexec.log. > > > > For reference this is working here: > > -rw-r--r-- 1 apache apache 314 Jun 6 12:19 /var/log/httpd/suexec.log > > > > -rwxr-xr-x 1 me me 1113 Jun 5 14:40 koukos.py > > > > You'll need to adjust things for your particular Apache > > environment. > > > > As I said, this is only a guess. Hope it helps. Hello! thanks for trying to help. Here they are: nikos at superhost.gr [~/www/cgi-bin]# ls -l koukos.py -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* nikos at superhost.gr [~/www/cgi-bin]# ls -l /var/log/httpd/suexec.log -rw-rw-rw- 1 root apache 0 Jun 1 02:52 /var/log/httpd/suexec.log nikos at superhost.gr [~/www/cgi-bin]# ls -l /usr/local/apache/logs/suexec_log -rw-rw-r-- 1 root apache 675097 Jun 6 21:43 /usr/local/apache/logs/suexec_log I have applied to them the group 'apache' so Apache User can utilize them. But its still a wonder to me why two different suexec logs exist. Please tell me wht else you want me to try. From nikos.gr33k at gmail.com Thu Jun 6 15:08:04 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 12:08:04 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <61f69d27-a041-48a3-99aa-be59ad817db9@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <61b47852-9e34-4d9a-9ee3-9801f4cc3065@googlegroups.com> <61f69d27-a041-48a3-99aa-be59ad817db9@googlegroups.com> Message-ID: <38f7bb64-4312-4ce1-9380-ee91065b3294@googlegroups.com> Since cPanel is in charge of apache i ahve even: chown nobody:nobody to both of the suexec logs. nikos at superhost.gr [~/www/cgi-bin]# ls -l /usr/local/apache/logs/suexec_log -rw-rw-r-- 1 nobody nobody 675389 Jun 6 22:05 /usr/local/apache/logs/suexec_log nikos at superhost.gr [~/www/cgi-bin]# ls -l /var/log/httpd/su* -rw-rw-rw- 1 nobody nobody 0 Jun 1 02:52 /var/log/httpd/suexec_log Still same error :( From lele at metapensiero.it Thu Jun 6 15:26:08 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 21:26:08 +0200 Subject: Errin when executing a cgi script that sets a cookie in the browser References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: <87obbj6nxr.fsf@nautilus.nautilus> ???????? ?????? writes: > I have re-enabled 'suexec' and set cgi as default phphandler and then trying: > > print( cookie ) > print( '''Content-type: text/html; charset=utf-8\n''' ) > print( message ) Did you tried running that by a standalone Python interpreter? Did you notice something strange, something like that an empty line is missing between headers and body? ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From skip at pobox.com Thu Jun 6 15:35:14 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 6 Jun 2013 14:35:14 -0500 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <87obbj6nxr.fsf@nautilus.nautilus> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> Message-ID: > Did you tried running that by a standalone Python interpreter? Did you > notice something strange, something like that an empty line is missing > between headers and body? He will get an extra blank line, since he added a newline character at the end of his Content-Type string. Skip From lele at metapensiero.it Thu Jun 6 16:28:13 2013 From: lele at metapensiero.it (Lele Gaifax) Date: Thu, 06 Jun 2013 22:28:13 +0200 Subject: Errin when executing a cgi script that sets a cookie in the browser References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> Message-ID: <87fvwv6l2a.fsf@nautilus.nautilus> Skip Montanaro writes: > He will get an extra blank line, since he added a newline character at > the end of his Content-Type string. Right, missed that, sorry for the noise. ciao, lele. -- nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. lele at metapensiero.it | -- Fortunato Depero, 1929. From nikos.gr33k at gmail.com Fri Jun 7 03:20:52 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 00:20:52 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> Message-ID: <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> Any other ideas guys? I can output for you any command you ask me too, so you have a better understanding about this suexec thing. I have checked the path to the error log file too, it's not just enough that the file is accessible for a user, the whole path to the file needs to have the right permissions. ls -ld /var/log/httpd ls -ld /var/log both of those needs to have xr for group and others (as far as i know x allows a user to get into the directory, r gives the user the ability to list files in the directory). So, --------------------------------------------------- nikos at superhost.gr [~]# ls -ld /var/log/ drwxr-xr-x 8 root root 4096 Jun 6 08:56 /var/log// root at nikos [~]# ls -ld /var/log/httpd/ drw-rw-rw- 2 root root 4096 Jun 6 22:03 /var/log/httpd// root at nikos [~]# chmod 666 /var/log/httpd/ root at nikos [~]# ls -l /var/log/httpd/ total 8 drw-rw-rw- 2 root root 4096 Jun 6 22:03 ./ drwxr-xr-x 8 root root 4096 Jun 7 10:02 ../ -rwxr-xr-x 1 nobody nobody 0 Apr 14 08:57 error_log* -rwxr-xr-x 1 nobody nobody 0 Jun 1 02:52 suexec_log* ---------------------------------------------------------- nikos at superhost.gr [~]# ls -ld /usr/local/apache/logs/ drwxr-xr-x 2 root root 4096 Jun 6 08:14 /usr/local/apache/logs// nikos at superhost.gr [~]# ls -ld /usr/local/apache/ drwxr-xr-x 17 root root 4096 May 16 22:46 /usr/local/apache// root at nikos [~]# chown nobody:nobody /usr/local/apache/logs/suexec_log root at nikos [~]# ls -l /usr/local/apache/logs/suexec_log -rw-rw-r-- 1 nobody nobody 678180 Jun 7 08:29 /usr/local/apache/logs/suexec_log root at nikos [~]# ---------------------------------------------------------- Because i'm a bit confused both 'suexec' files need to change? And what are the differences of them? Why two 'suexec' logs appear? httpd != Apache ? From nikos.gr33k at gmail.com Fri Jun 7 03:51:06 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 00:51:06 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> Message-ID: <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> Finally no suexec erros any more after chown all log files to nobody:nobody and thei corresponding paths. Now the error has been transformed to: [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] File does not exist: /home/nikos/public_html/500.shtml but from interpretor view: nikos at superhost.gr [~/www/cgi-bin]# python koukos.py Set-Cookie: nikos=admin; expires=Mon, 02 Jun 2014 07:50:18 GMT; Path=/ Content-type: text/html; charset=utf-8 ??? ?? ??? ??? ???? ??? ?? ????, ??? ?? ????, ??? ?? ??????! ?? ????? ????? ? ??????? ??????????!! (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed ???? Can find what? koukos.py is there inside the cg-bin dir with 755 perms. From python at mrabarnett.plus.com Fri Jun 7 10:32:09 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 15:32:09 +0100 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> Message-ID: <51B1EEE9.90605@mrabarnett.plus.com> On 07/06/2013 08:51, ???????? ?????? wrote: > Finally no suexec erros any more after chown all log files to nobody:nobody and thei corresponding paths. > > Now the error has been transformed to: > > > [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed > [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] Premature end of script headers: koukos.py > [Fri Jun 07 10:48:47 2013] [error] [client 79.103.41.173] File does not exist: /home/nikos/public_html/500.shtml > > > but from interpretor view: > > nikos at superhost.gr [~/www/cgi-bin]# python koukos.py > Set-Cookie: nikos=admin; expires=Mon, 02 Jun 2014 07:50:18 GMT; Path=/ > Content-type: text/html; charset=utf-8 > > ??? ?? ??? ??? ???? ??? ?? ????, ??? ?? ????, ??? ?? ??????! ?? ????? ????? ? ??????? ??????????!! > > > > (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed > > ???? Can find what? koukos.py is there inside the cg-bin dir with 755 perms. > It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in there? From nikos.gr33k at gmail.com Fri Jun 7 14:24:03 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 11:24:03 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> Message-ID: <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: >>Can find what? koukos.py is there inside the cg-bin dir with 755 perms. > It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. Its looking for its self?!?! > Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in > there? Yes it is. nikos at superhost.gr [~/www/cgi-bin]# ls -l total 56 drwxr-xr-x 2 nikos nikos 4096 Jun 6 20:29 ./ drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 ../ -rwxr-xr-x 1 nikos nikos 1199 Apr 25 15:33 convert.py* -rwxr-xr-x 1 nikos nikos 5434 Jun 7 14:51 files.py* -rw-r--r-- 1 nikos nikos 170 May 30 15:18 .htaccess -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* -rwxr-xr-x 1 nikos nikos 9356 Jun 6 09:13 metrites.py* -rwxr-xr-x 1 nikos nikos 13512 Jun 6 09:13 pelatologio.py* nikos at superhost.gr [~/www/cgi-bin]# From python at mrabarnett.plus.com Fri Jun 7 16:47:58 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 21:47:58 +0100 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> Message-ID: <51B246FE.8090701@mrabarnett.plus.com> On 07/06/2013 19:24, ???????? ?????? wrote: > ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: >>>Can find what? koukos.py is there inside the cg-bin dir with 755 perms. > >> It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. > > Its looking for its self?!?! > >> Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in >> there? > Yes it is. > > > nikos at superhost.gr [~/www/cgi-bin]# ls -l > total 56 > drwxr-xr-x 2 nikos nikos 4096 Jun 6 20:29 ./ > drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 ../ > -rwxr-xr-x 1 nikos nikos 1199 Apr 25 15:33 convert.py* > -rwxr-xr-x 1 nikos nikos 5434 Jun 7 14:51 files.py* > -rw-r--r-- 1 nikos nikos 170 May 30 15:18 .htaccess > -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* > -rwxr-xr-x 1 nikos nikos 9356 Jun 6 09:13 metrites.py* > -rwxr-xr-x 1 nikos nikos 13512 Jun 6 09:13 pelatologio.py* > nikos at superhost.gr [~/www/cgi-bin]# > The prompt says "~/www/cgi-bin". Is that the same as "/home/nikos/public_html/cgi-bin"? Try: ls -l /home/nikos/public_html/cgi-bin From nikos.gr33k at gmail.com Sat Jun 8 02:53:00 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Fri, 7 Jun 2013 23:53:00 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> Message-ID: ?? ?????????, 7 ??????? 2013 11:47:58 ?.?. UTC+3, ? ??????? MRAB ??????: > On 07/06/2013 19:24, ???????? ?????? wrote: > > > ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: > > >>>Can find what? koukos.py is there inside the cg-bin dir with 755 perms. > > > > > >> It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. > > > > > > Its looking for its self?!?! > > > > > >> Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in > > >> there? > > > Yes it is. > > > > > > > > > nikos at superhost.gr [~/www/cgi-bin]# ls -l > > > total 56 > > > drwxr-xr-x 2 nikos nikos 4096 Jun 6 20:29 ./ > > > drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 ../ > > > -rwxr-xr-x 1 nikos nikos 1199 Apr 25 15:33 convert.py* > > > -rwxr-xr-x 1 nikos nikos 5434 Jun 7 14:51 files.py* > > > -rw-r--r-- 1 nikos nikos 170 May 30 15:18 .htaccess > > > -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* > > > -rwxr-xr-x 1 nikos nikos 9356 Jun 6 09:13 metrites.py* > > > -rwxr-xr-x 1 nikos nikos 13512 Jun 6 09:13 pelatologio.py* > > > nikos at superhost.gr [~/www/cgi-bin]# > > > > > The prompt says "~/www/cgi-bin". > > > > Is that the same as "/home/nikos/public_html/cgi-bin"? > > > > Try: > > > > ls -l /home/nikos/public_html/cgi-bin Good day MRAB, yes '~/www' its a symlink to '~/public_html' nikos at superhost.gr [~/www/data/apps]# ls -ld /home/nikos/www/ drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 /home/nikos/www// nikos at superhost.gr [~/www/data/apps]# ls -ld /home/nikos/public_html/ drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 /home/nikos/public_html// nikos at superhost.gr [~/www/data/apps]# ls -l /home/nikos/public_html/cgi-bin total 56 drwxr-xr-x 2 nikos nikos 4096 Jun 6 20:29 ./ drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 ../ -rwxr-xr-x 1 nikos nikos 1199 Apr 25 15:33 convert.py* -rwxr-xr-x 1 nikos nikos 5793 Jun 8 09:39 files.py* -rw-r--r-- 1 nikos nikos 170 May 30 15:18 .htaccess -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* -rwxr-xr-x 1 nikos nikos 9356 Jun 6 09:13 metrites.py* -rwxr-xr-x 1 nikos nikos 13512 Jun 6 09:13 pelatologio.py* nikos at superhost.gr [~/www/data/apps]# ls -l /home/nikos/www/cgi-bin/ total 56 drwxr-xr-x 2 nikos nikos 4096 Jun 6 20:29 ./ drwxr-x--- 4 nikos nobody 4096 Jun 5 11:32 ../ -rwxr-xr-x 1 nikos nikos 1199 Apr 25 15:33 convert.py* -rwxr-xr-x 1 nikos nikos 5793 Jun 8 09:39 files.py* -rw-r--r-- 1 nikos nikos 170 May 30 15:18 .htaccess -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* -rwxr-xr-x 1 nikos nikos 9356 Jun 6 09:13 metrites.py* -rwxr-xr-x 1 nikos nikos 13512 Jun 6 09:13 pelatologio.py* nikos at superhost.gr [~/www/data/apps]# From rosuav at gmail.com Sat Jun 8 03:01:51 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 8 Jun 2013 17:01:51 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> Message-ID: On Sat, Jun 8, 2013 at 4:53 PM, ???????? ?????? wrote: > ?? ?????????, 7 ??????? 2013 11:47:58 ?.?. UTC+3, ? ??????? MRAB ??????: >> On 07/06/2013 19:24, ???????? ?????? wrote: \>> > ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: >> >> It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. >> >> Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in >> >> there? >> > Yes it is. >> > nikos at superhost.gr [~/www/cgi-bin]# ls -l >> > -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* >> The prompt says "~/www/cgi-bin". >> Is that the same as "/home/nikos/public_html/cgi-bin"? > Good day MRAB, yes '~/www' its a symlink to '~/public_html' More basics. When someone asks you to check something, check exactly that. It really does not help to check something unrelated. If you'd shown in your prompt ~/public_html/cgi-bin rather than your symlink of www, there would have been less confusion; putting the full path in as a parameter would eliminate all trouble. By using the symlink, you demand that we understand or assume something about your system, and that's unnecessary. ChrisA From nikos.gr33k at gmail.com Sat Jun 8 11:36:40 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 08:36:40 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> Message-ID: <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> ?? ???????, 8 ??????? 2013 10:01:51 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Sat, Jun 8, 2013 at 4:53 PM, ???????? ?????? wrote: > > > ?? ?????????, 7 ??????? 2013 11:47:58 ?.?. UTC+3, ? ??????? MRAB ??????: > > >> On 07/06/2013 19:24, ???????? ?????? wrote: > > \>> > ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: > > >> >> It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. > > >> >> Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in > > >> >> there? > > >> > Yes it is. > > >> > nikos at superhost.gr [~/www/cgi-bin]# ls -l > > >> > -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* > > >> The prompt says "~/www/cgi-bin". > > >> Is that the same as "/home/nikos/public_html/cgi-bin"? > > > Good day MRAB, yes '~/www' its a symlink to '~/public_html' > > > > More basics. When someone asks you to check something, check exactly > > that. It really does not help to check something unrelated. If you'd > > shown in your prompt ~/public_html/cgi-bin rather than your symlink of > > www, there would have been less confusion; putting the full path in as > > a parameter would eliminate all trouble. By using the symlink, you > > demand that we understand or assume something about your system, and > > that's unnecessary. Well, www as symlink to public_html is always a symlink to any system i have used so its something defaulted. From rosuav at gmail.com Sat Jun 8 12:03:57 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 02:03:57 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 1:36 AM, ???????? ?????? wrote: > ?? ???????, 8 ??????? 2013 10:01:51 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >> On Sat, Jun 8, 2013 at 4:53 PM, ???????? ?????? wrote: >> >> > ?? ?????????, 7 ??????? 2013 11:47:58 ?.?. UTC+3, ? ??????? MRAB ??????: >> >> >> On 07/06/2013 19:24, ???????? ?????? wrote: >> >> \>> > ?? ?????????, 7 ??????? 2013 5:32:09 ?.?. UTC+3, ? ??????? MRAB ??????: >> >> >> >> It's looking for '/home/nikos/public_html/cgi-bin/koukos.py'. >> >> >> >> Have a look in '/home/nikos/public_html/cgi-bin'. Is 'koukos.py' in >> >> >> >> there? >> >> >> > Yes it is. >> >> >> > nikos at superhost.gr [~/www/cgi-bin]# ls -l >> >> >> > -rwxr-xr-x 1 nikos nikos 1160 Jun 6 06:27 koukos.py* >> >> >> The prompt says "~/www/cgi-bin". >> >> >> Is that the same as "/home/nikos/public_html/cgi-bin"? >> >> > Good day MRAB, yes '~/www' its a symlink to '~/public_html' >> >> >> >> More basics. When someone asks you to check something, check exactly >> >> that. It really does not help to check something unrelated. If you'd >> >> shown in your prompt ~/public_html/cgi-bin rather than your symlink of >> >> www, there would have been less confusion; putting the full path in as >> >> a parameter would eliminate all trouble. By using the symlink, you >> >> demand that we understand or assume something about your system, and >> >> that's unnecessary. > > Well, www as symlink to public_html is always a symlink to any system i have used so its something defaulted. It's most certainly not the default, it's definitely not universal, and that has nothing to do with what I said. Use the exact same path, it reduces confusion. Also, I think it's time to mention again: Get yourself off Google Groups, or start trimming out the stupid double spacing! It's getting extremely annoying. ChrisA From nikos.gr33k at gmail.com Sat Jun 8 12:56:53 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 09:56:53 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> Message-ID: ?? ???????, 8 ??????? 2013 7:03:57 ?.?. UTC+3, ? ??????? Chris Angelico ??????: > On Sun, Jun 9, 2013 at 1:36 AM, ???????? ?????? wrote: > > Well, www as symlink to public_html is always a symlink to any system i > > have used so its something defaulted. > It's most certainly not the default, it's definitely not universal > and that has nothing to do with what I said. Use the exact same path, > it reduces confusion. Also, I think it's time to mention again: Get > yourself off Google Groups, or start trimming out the stupid double > spacing! It's getting extremely annoying. its very tedious to always triming everything for me and i know it is for you to ead it assuc. Damn google groups, why is it behaving as such? Dont the programmers know about it? Also everytime i post it always display to me different addresses to get responses back. Any way what did you say and i havent understand you correctly? What path do you want me to show to you? What does this error means anyway? From torriem at gmail.com Sat Jun 8 17:17:16 2013 From: torriem at gmail.com (Michael Torrie) Date: Sat, 08 Jun 2013 15:17:16 -0600 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> Message-ID: <51B39F5C.5040502@gmail.com> On 06/08/2013 10:56 AM, ???????? ?????? wrote: > its very tedious to always triming everything for me and i know it is > for you to ead it assuc. Damn google groups, why is it behaving as > such? Dont the programmers know about it? Most of us on the list don't use google groups. A number of us use plain old e-mail to post to the list. If you set up folders and rules in your e-mail client (or labels and filter in Gmail), then messages can go into their own folder. > Any way what did you say and i havent understand you correctly? What > path do you want me to show to you? He means that you should configure apache to use the real path on your file system, not the symlink. IE if www is just a symlink to public_html, reconfigure apache to not use www at all and use public_html. That way you can avoid these kinds of errors. > What does this error means anyway? It means that Apache is unable to find your cgi script. It's turning the url into a file path, but it can't find the file path. Sometimes Apache is configured to not follow symlinks. It's confusing too because you have two apaches installed. The system default one and the one that comes with cPanel. From nikos.gr33k at gmail.com Sat Jun 8 17:33:44 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sat, 8 Jun 2013 14:33:44 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> Message-ID: <4a5d3941-13ee-4172-8eaa-971b4c783bac@googlegroups.com> ?? ???????, 9 ??????? 2013 12:17:16 ?.?. UTC+3, ? ??????? Michael Torrie ??????: > > What does this error means anyway? > It means that Apache is unable to find your cgi script. It's turning > the url into a file path, but it can't find the file path. Sometimes > Apache is configured to not follow symlinks. Why every other python cgi script of mine that i run via browser doesnt produce this kind of error and only 'koukos.py' does? > It's confusing too because you have two apaches installed. The system > default one and the one that comes with cPanel. Hi Michael, indeed they are too. I wonder why cPanel deosnt use the default apache that came with the system and isntead complied its own. anyway httpd.conf seems correct ========== root at nikos [~]# cat /usr/local/apache/conf/httpd.conf | grep 'www' # system refer to the documentation at: http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html # # system refer to the documentation at: http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html # ServerAlias www.varsa.gr ServerAlias www.parking-byzantio.gr ServerAlias www.cafebar-idea.gr ServerAlias www.dauwin.gr ServerAlias www.leonidasgkelos.com ServerAlias www.mythosweb.gr ServerAlias www.superhost.gr ServerAlias www.panostech.gr ServerAlias www.pdimou.gr ServerAlias www.radio-klepsydra.com ServerAlias www.cravendot.gr ServerAlias www.ypsilandio.gr ServerAlias www.oliveoils.mythosweb.gr ServerAlias www.zimotirio.pdimou.gr root at nikos [~]# cat /usr/local/apache/conf/httpd.conf | grep 'public_html' UserDir public_html DocumentRoot /home/akis/public_html ScriptAlias /cgi-bin/ /home/akis/public_html/cgi-bin/ DocumentRoot /home/byzantio/public_html ScriptAlias /cgi-bin/ /home/byzantio/public_html/cgi-bin/ DocumentRoot /home/cafebar/public_html ScriptAlias /cgi-bin/ /home/cafebar/public_html/cgi-bin/ DocumentRoot /home/dauwin/public_html ScriptAlias /cgi-bin/ /home/dauwin/public_html/cgi-bin/ DocumentRoot /home/gkelos/public_html ScriptAlias /cgi-bin/ /home/gkelos/public_html/cgi-bin/ DocumentRoot /home/mythos/public_html ScriptAlias /cgi-bin/ /home/mythos/public_html/cgi-bin/ DocumentRoot /home/nikos/public_html ScriptAlias /cgi-bin/ /home/nikos/public_html/cgi-bin/ DocumentRoot /home/panos/public_html ScriptAlias /cgi-bin/ /home/panos/public_html/cgi-bin/ DocumentRoot /home/pdimou/public_html ScriptAlias /cgi-bin/ /home/pdimou/public_html/cgi-bin/ DocumentRoot /home/radio/public_html ScriptAlias /cgi-bin/ /home/radio/public_html/cgi-bin/ DocumentRoot /home/tasos/public_html ScriptAlias /cgi-bin/ /home/tasos/public_html/cgi-bin/ DocumentRoot /home/ypsiland/public_html ScriptAlias /cgi-bin/ /home/ypsiland/public_html/cgi-bin/ DocumentRoot /home/mythos/public_html/oliveoils ScriptAlias /cgi-bin/ /home/mythos/public_html/oliveoils/cgi-bin/ DocumentRoot /home/pdimou/public_html/zimotirio ScriptAlias /cgi-bin/ /home/pdimou/public_html/zimotirio/cgi-bin/ root at nikos [~]# ======================= Why every other python cgi script of mines doesnt prodice this error and only 'koukos.py' does? From nagia.retsina at gmail.com Sun Jun 9 01:27:53 2013 From: nagia.retsina at gmail.com (nagia.retsina at gmail.com) Date: Sat, 8 Jun 2013 22:27:53 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <4a5d3941-13ee-4172-8eaa-971b4c783bac@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> <4a5d3941-13ee-4172-8eaa-971b4c783bac@googlegroups.com> Message-ID: <219938b0-a869-4236-9d3c-934549f90231@googlegroups.com> Trying yum install dos2unix and root at nikos [/home/nikos/www/cgi-bin]# dos2unix koukos.py dos2unix: converting file koukos.py to UNIX format ... Then browsed to the page again in Chrome it worked as expected :-) From nikos.gr33k at gmail.com Sun Jun 9 06:42:14 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 03:42:14 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: <219938b0-a869-4236-9d3c-934549f90231@googlegroups.com> References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> <4a5d3941-13ee-4172-8eaa-971b4c783bac@googlegroups.com> <219938b0-a869-4236-9d3c-934549f90231@googlegroups.com> Message-ID: <4fcd0516-2e72-4283-a4c0-872bb9663a92@googlegroups.com> ?? ???????, 9 ??????? 2013 8:27:53 ?.?. UTC+3, ? ??????? nagia.... at gmail.com ??????: > Trying > > > > yum install dos2unix > > > > and > > > > root at nikos [/home/nikos/www/cgi-bin]# dos2unix koukos.py > > dos2unix: converting file koukos.py to UNIX format ... > > > > > > Then browsed to the page again in Chrome it worked as expected :-) So how from python koukos.py script was interpreting correctly and from browser it failed? From rosuav at gmail.com Sat Jun 8 18:21:25 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 08:21:25 +1000 Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> <32cb683f-cc4b-4c05-a158-137668debb1c@googlegroups.com> <9d6779ba-0810-4c48-8ba4-d997bbb16408@googlegroups.com> <4cb931e0-821a-4e91-9719-2ab346dc7b72@googlegroups.com> <38d5874e-4f4f-408a-8230-3aa8dae46fa8@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 2:56 AM, ???????? ?????? wrote: > ?? ???????, 8 ??????? 2013 7:03:57 ?.?. UTC+3, ? ??????? Chris Angelico ??????: >> On Sun, Jun 9, 2013 at 1:36 AM, ???????? ?????? wrote: > >> > Well, www as symlink to public_html is always a symlink to any system i >> > have used so its something defaulted. > >> It's most certainly not the default, it's definitely not universal >> and that has nothing to do with what I said. Use the exact same path, >> it reduces confusion. Also, I think it's time to mention again: Get >> yourself off Google Groups, or start trimming out the stupid double >> spacing! It's getting extremely annoying. > > its very tedious to always triming everything for me and i know it is for you to ead it assuc. Then get off Google Groups. There are alternatives. If you can't be bothered tidying up your posts before you click send, then get software that doesn't force you to. ChrisA From nikos.gr33k at gmail.com Thu Jun 6 16:07:37 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 13:07:37 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> <87obbj6nxr.fsf@nautilus.nautilus> Message-ID: Something else i need to try so for 'suexec' to be able to open its own lof file? What a weird error that is. An Apache's extension that can open its own log file..... From nikos.gr33k at gmail.com Thu Jun 6 15:30:59 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Thu, 6 Jun 2013 12:30:59 -0700 (PDT) Subject: Errin when executing a cgi script that sets a cookie in the browser In-Reply-To: References: <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com> <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> Message-ID: <0df486c5-5158-4b85-ad2c-1076367ee815@googlegroups.com> ?? ??????, 6 ??????? 2013 10:26:08 ?.?. UTC+3, ? ??????? Lele Gaifax ??????: > Did you tried running that by a standalone Python interpreter? Did you > notice something strange, something like that an empty line is missing > between headers and body? No, nothing at all. Two '/n/n' are not required. Months now the way i'm printing headers is by: print( '''Content-type: text/html; charset=utf-8\n''' ) and the scripts owrk correctly in browser and in python interpreter too. From sjo.india at gmail.com Wed Jun 5 21:07:44 2013 From: sjo.india at gmail.com (Sudheer Joseph) Date: Wed, 5 Jun 2013 18:07:44 -0700 (PDT) Subject: python netcdf Message-ID: Dear Members, Is there a way to get the time:origin attribute from a netcdf file as string using the Python netcdf? with best regards, Sudheer From jason.swails at gmail.com Wed Jun 5 21:33:36 2013 From: jason.swails at gmail.com (Jason Swails) Date: Wed, 5 Jun 2013 21:33:36 -0400 Subject: python netcdf In-Reply-To: References: Message-ID: On Wed, Jun 5, 2013 at 9:07 PM, Sudheer Joseph wrote: > Dear Members, > Is there a way to get the time:origin attribute from a > netcdf file as string using the Python netcdf? > Attributes of the NetCDF file and attributes of each of the variables can be accessed via the dot-operator, as per standard Python. For instance, suppose that your NetCDF file has a Conventions attribute, you can access it via: ncfile.Conventions Suppose that your variable, time, has an attribute "origin", you can get it via: ncfile.variables['time'].origin Of course there's the question of what NetCDF bindings you're going to use. The options that I'm familiar with are the ScientificPython's NetCDFFile class (Scientific.IO.NetCDF.NetCDFFile), pynetcdf (which is just the ScientificPython's class in a standalone format), and the netCDF4 package. Each option has a similar API with attributes accessed the same way. An example with netCDF4 (which is newer, has NetCDF 4 capabilities, and appears to be more supported): from netCDF4 import Dataset ncfile = Dataset('my_netcdf_file.nc', 'r') origin = ncfile.variables['time'].origin etc. etc. The variables and dimensions of a NetCDF file are stored in dictionaries, and the data from variables are accessible via slicing: time_data = ncfile.variables['time'][:] The slice returns a numpy ndarray. HTH, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjo.india at gmail.com Wed Jun 5 21:52:14 2013 From: sjo.india at gmail.com (Sudheer Joseph) Date: Thu, 6 Jun 2013 07:22:14 +0530 Subject: python netcdf In-Reply-To: References: Message-ID: Thank you very much Jason With best regards Sudheer On Thursday, June 6, 2013, Jason Swails wrote: > > > > On Wed, Jun 5, 2013 at 9:07 PM, Sudheer Joseph > > wrote: > >> Dear Members, >> Is there a way to get the time:origin attribute from a >> netcdf file as string using the Python netcdf? >> > > Attributes of the NetCDF file and attributes of each of the variables can > be accessed via the dot-operator, as per standard Python. > > For instance, suppose that your NetCDF file has a Conventions attribute, > you can access it via: > > ncfile.Conventions > > Suppose that your variable, time, has an attribute "origin", you can get > it via: > > ncfile.variables['time'].origin > > Of course there's the question of what NetCDF bindings you're going to > use. The options that I'm familiar with are the ScientificPython's > NetCDFFile class (Scientific.IO.NetCDF.NetCDFFile), pynetcdf (which is just > the ScientificPython's class in a standalone format), and the netCDF4 > package. Each option has a similar API with attributes accessed the same > way. > > An example with netCDF4 (which is newer, has NetCDF 4 capabilities, and > appears to be more supported): > > from netCDF4 import Dataset > > ncfile = Dataset('my_netcdf_file.nc', 'r') > > origin = ncfile.variables['time'].origin > > etc. etc. > > The variables and dimensions of a NetCDF file are stored in dictionaries, > and the data from variables are accessible via slicing: > > time_data = ncfile.variables['time'][:] > > The slice returns a numpy ndarray. > > HTH, > Jason > -- Sent from my iPad Mini -------------- next part -------------- An HTML attachment was scrubbed... URL: From biolord9 at gmail.com Wed Jun 5 21:52:28 2013 From: biolord9 at gmail.com (Thrinaxodon) Date: Wed, 5 Jun 2013 18:52:28 -0700 (PDT) Subject: THRINAXODON BEATS A HOMOSEXUAL, TO THE GROUND!! Message-ID: <18337499-9771-42e1-9d4b-c083a8916ea3@2g2000yqr.googlegroups.com> AS THRINAXODON VENTURED ACROSS THE WORLD, HE MET PROMINENT GAYS, "David Iain Greig" AND "Peter Nyikos", AS THRINAXODON CAUGHT THE TWO "GIVING LOVE," THRINAXODON BEATS THEM WITH HIS WOODEN STICK(S). AS HE CAUGHT ASSHAT, RUNNING WILD, TRYING TO GET OUT OF THEIR; THRINAXODON JUMPED AND PUNCHED, DROP-KICKED, NYIKOS, AS WELL AS RIP HIS LIMBS OFF. GREIG PUNCHES THRINAXODON, AND RUNS AWAY, BUT IN ANOTHER POST THRINAXODON WILL SHOW HOW HE KILLED GREIG. =========================================================================== = THE DARK NIGHTS ARE BACK. https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSjD2J4Gz25xDkgT... =========================================================================== = THRINAXODON HAS UPDATED HIS PROFILE PICTURE. http://thrinaxodon.wordpress.com/2013/06/01/thrinaxodons-new-profile-... =========================================================================== KILL THE RABBIT FAT-ASS. https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQYQMJp1kIuqs1dy... =========================================================================== THRINAXODON IS NOW ON TWITTER. From bv8bv8bv8 at gmail.com Thu Jun 6 03:56:44 2013 From: bv8bv8bv8 at gmail.com (BV BV) Date: Thu, 6 Jun 2013 00:56:44 -0700 (PDT) Subject: HOW DOES ISLAM DIFFER FROM OTHER FAITHS? (PART 1 OF 2) Message-ID: How Does Islam Differ from other Faiths? (part 1 of 2) Description: Some of the Unique Features of Islam not found in other belief systems and ways of life. B Simplicity, Rationality and Practicality Islam is a religion without any mythology. Its teachings are simple and intelligible. It is free from superstitions and irrational beliefs. The oneness of God, the prophethood of Muhammad, and the concept of life after death are the basic articles of its faith. They are based on reason and sound logic. All of the teachings of Islam flow from those basic beliefs and are simple and straightforward. There is no hierarchy of priests, no farfetched abstractions, no complicated rites or rituals. Everybody may approach the Quran directly and translate its dictates into practice. Islam awakens in man the faculty of reason and exhorts him to use his intellect. It enjoins him to see things in the light of reality. The Quran advises him to seek knowledge and invoke God to expand his awareness: Say ?O, my Lord! Advance me in knowledge. (Quran 20: 114) God also says: ?Are those who know equal with those who know not? But only men of understanding will pay heed.? (Quran 39: 9) It is reported that the Prophet, may the mercy and blessings of God be upon him, said that: ?He who leaves his home in search of knowledge (walks) in the path of God.? (At-Tirmidhi) and that, ?Seeking knowledge is obligatory upon every Muslim.? (Ibn Majah and al- Bayhaqi) This is how Islam brings man out of the world of superstition and darkness and initiates him into the world of knowledge and light. Again, Islam is a practical religion and does not allow indulgence in empty and futile theorizing. It says that faith is not a mere profession of beliefs, but rather that it is the very mainspring of life. Righteous conduct must follow belief in God. Religion is something to be practiced and not an object of mere lip service. The Quran says: ?Those who believe and act righteously, joy is for them, and a blissful home to return to.? (Quran 13: 29) The Prophet is also reported to have said: ?God does not accept belief if it is not expressed in deeds, and does not accept deeds if they do not conform to belief.? (At-Tabarani) Thus Islam?s simplicity, rationality and practicality are what characterize Islam as a unique and true religion. Unity of Matter and Spirit A unique feature of Islam is that it does not divide life into watertight compartments of matter and spirit. It stands not for denial of life but for the fulfillment of life. Islam does not believe in asceticism. It does not ask man to avoid material things. It holds that spiritual elevation is to be achieved by living piously in the rough and tumble of life, not by renouncing the world. The Quran advises us to pray as follows: ?Our Lord! Give us something fine in this world as well as something fine in the Hereafter.? (Quran 2:201) But in making use of life luxuries, Islam advises man to be moderate and keep away from extravagance, God says: ??and eat and drink and be not extravagant; surely He does not love the extravagant.? (Quran 7:31) On this aspect of moderation, the Prophet said: ?Observe fasting and break it (at the proper time) and stand in prayer and devotion (in the night) and have sleep, for your body has its right over you, and your eyes have rights over you, and your wife has a claim upon you, and the person who pays a visit to you has a claim upon you.? Thus, Islam does not admit any separation between ?material? and ?moral,? ?mundane? and ?spiritual? life, and enjoins man to devote all of his energies to the reconstruction of life on healthy moral foundations. It teaches him that moral and material powers must be welded together and that spiritual salvation can be achieved by using material resources for the good of man in the service of just ends and not by living a life of asceticism or by running away from the challenges of life. The world has suffered at the hands of the one-sidedness of many other religions and ideologies. Some have laid emphasis on the spiritual side of life but have ignored its material and mundane aspects. They have looked upon the world as an illusion, a deception, and a trap. On the other hand, materialistic ideologies have totally ignored the spiritual and moral side of life and have dismissed it as fictitious and imaginary. Both of these attitudes have resulted in disaster, for they have robbed mankind of peace, contentment, and tranquility. Even today, the imbalance is manifested in one or the other direction. The French scientist Dr. De Brogbi rightly says: ?The danger inherent in too intense a material civilization is to that civilization itself; it is the disequilibria which would result if a parallel development of the spiritual life were to fail to provide the needed balance.? Christianity erred on one extreme, whereas modern western civilization, in both of its variants of secular capitalistic democracy and Marxist socialism has erred on the other. According to Lord Snell: ?We have built a nobly-proportioned outer structure, but we have neglected the essential requirement of an inner order; we have carefully designed, decorated and made clean the outside of the cup; but the inside was full of extortion and excess; we used our increased knowledge and power to administer to the comforts of the body, but we left the spirit impoverished.? Islam seeks to establish equilibrium between these two aspects of life - the material and the spiritual. It says that everything in the world is for man, but man was created to serve a higher purpose: the establishment of a moral and just order that will fulfill the will of God. Its teachings cater for the spiritual as well as the temporal needs of man. Islam enjoins man to purify his soul and to reform his daily life - both individual and collective - and to establish the supremacy of right over might and of virtue over vice. Thus Islam stands for the middle path and the goal of producing a moral man in the service of a just society. Islam, a Complete Way of Life Islam is not a religion in the common and distorted sense, for it does not confine its scope to one?s private life. It is a complete way of life and is present in every field of human existence. Islam provides guidance for all aspects of life - individual and social, material and moral, economic and political, legal and cultural, and national and international. The Quran enjoins man to embrace Islam without any reservation and to follow God?s guidance in all areas of life. In fact, it was an unfortunate day when the scope of religion was confined to the private life of man and its social and cultural role was reduced to naught, as has happened in this century. No other factor, perhaps, has been more important in causing the decline of religion in the modern age than its retreat into the realm of private life. In the words of a modern philosopher: ?Religion asks us to separate things of God from those of Caesar. Such a judicial separation between the two means the degrading of both the secular and the sacred ... That religion is worth little if the conscience of its followers is not disturbed when war clouds are hanging over us all and industrial conflicts are threatening social peace. Religion has weakened man?s social conscience and moral sensitivity by separating the things of God from those of Caesar.? Islam totally denounces this concept of religion and clearly states that its objectives are the purification of the soul and the reform and reconstruction of society. As we read in the Quran: ?We verily sent Our messengers with clear proofs, and revealed with them the Scripture and the Balance, that mankind may observe right measure; and He revealed iron, wherein is mighty power and (many) uses for mankind, and that God may know him who helpeth Him and His messengers, though unseen. Lo! God is Strong, Almighty.? (Quran 57: 25) God also says: ?The decision rests with God only, Who hath commanded you that ye worship none save Him. This is the right religion, but most men know not.? (Quran 12: 40) Thus even a cursory study of the teachings of Islam shows that it is an all-embracing way of life and does not leave out any field of human existence to become a playground for the forces of evil. Next: How Does Islam Differ from other Faiths? (part 2 of 2) http://www.islamreligion.com/articles/643/ thank you From steve+comp.lang.python at pearwood.info Thu Jun 6 05:32:41 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 06 Jun 2013 09:32:41 GMT Subject: Speeding up Python Message-ID: <51b05739$0$11118$c3e8da3@news.astraweb.com> Comparing CPython, PyPy, SciPy, Parakeet and Numba for writing image filters: http://www.phi-node.com/2013/06/faster-morphological-image-filters-in.html -- Steven From m2cl3k at gmail.com Thu Jun 6 05:55:14 2013 From: m2cl3k at gmail.com (m2cl3k at gmail.com) Date: Thu, 6 Jun 2013 02:55:14 -0700 (PDT) Subject: "The system cannot find the path specified[...]" wxPython strange bug Message-ID: <70522202-8f78-4c60-858e-7c9b8cffaee5@googlegroups.com> Hi, I'm developing plugin for sublime text 2. I'm importing wxPython module and sometimes I get following error: [code] Reloading plugin C:\Users\User\AppData\Roaming\Sublime Text 2\Packages\User\my_plugin.py Traceback (most recent call last): File ".\sublime_plugin.py", line 62, in reload_plugin File ".\my_plugin.py", line 10, in import wx File "", line 9, in __init__ WindowsError: [Error 3] The system cannot find the path specified: u'/C/Users/User/AppData/Roaming/Sublime Text 2/Packages/User/wx_distr/wx/tools/Editra/plugins' [/code] But after some time, if I reload my plugin few times(it's random), it launches properly. It seems very strange to me, anyone have any ideas? Thanks, Maciej. From m2cl3k at gmail.com Thu Jun 6 07:05:14 2013 From: m2cl3k at gmail.com (Jeicam) Date: Thu, 6 Jun 2013 04:05:14 -0700 (PDT) Subject: "The system cannot find the path specified[...]" wxPython strange bug In-Reply-To: <70522202-8f78-4c60-858e-7c9b8cffaee5@googlegroups.com> References: <70522202-8f78-4c60-858e-7c9b8cffaee5@googlegroups.com> Message-ID: It seems like it constructs path wrongly(as I have seen before), but why sometimes it works and sometimes doesn't(so maybe sometimes it generates path correctly)? From avnesh.nitk at gmail.com Thu Jun 6 06:50:36 2013 From: avnesh.nitk at gmail.com (Avnesh Shakya) Date: Thu, 6 Jun 2013 03:50:36 -0700 (PDT) Subject: How to store a variable when a script is executing for next time execution? Message-ID: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> hi, I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1...... my code is- i = 0 for i in range(1000): try: with open('filename%d.%d.%d.json'%(0,0,i,)): pass continue except IOError: dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+') break But It will take more time after creating many files, So i want to store value of last var "i" in a variable so that when i run my script again then I can use it. for example- my last created file is filename0.0.27 then it should store 27 in a variable and when i run again then new file should be created 0.0.28 according to last value "27", so that i could save time and it can create file fast.. Please give me suggestion for it.. How is it possible? Thanks From cs at zip.com.au Thu Jun 6 07:19:04 2013 From: cs at zip.com.au (Cameron Simpson) Date: Thu, 6 Jun 2013 21:19:04 +1000 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> Message-ID: <20130606111904.GA29595@cskk.homeip.net> On 06Jun2013 03:50, Avnesh Shakya wrote: | hi, | I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1...... my code is- | | i = 0 | for i in range(1000): | try: | with open('filename%d.%d.%d.json'%(0,0,i,)): pass | continue | except IOError: | dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+') | break | But It will take more time after creating many files, So i want to store value of last var "i" in a variable so that when i run my script again then I can use it. for example- | my last created file is filename0.0.27 then it should store 27 in a variable and when i run again then new file should be created 0.0.28 according to last value "27", so that i could save time and it can create file fast.. | | Please give me suggestion for it.. How is it possible? Write it to a file? Read the file next time the script runs? BTW, trying to open zillions of files is slow. But using listdir to read the directory you can see all the names. Pick the next free one (and then test anyway). -- Cameron Simpson The mark must be robust enough to survive MP3 transmission over the Internet, but remain inaudible when played on the yet to be launched DVD-Audio players. - the SDMI audio watermarkers literally ask for the impossible, since all audio compressors aim to pass _only_ human perceptible data http://www.newscientist.com/news/news.jsp?id=ns224836 From avnesh.nitk at gmail.com Thu Jun 6 08:06:22 2013 From: avnesh.nitk at gmail.com (Avnesh Shakya) Date: Thu, 6 Jun 2013 17:36:22 +0530 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: <20130606111904.GA29595@cskk.homeip.net> References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <20130606111904.GA29595@cskk.homeip.net> Message-ID: Thanks. On Thu, Jun 6, 2013 at 4:49 PM, Cameron Simpson wrote: > On 06Jun2013 03:50, Avnesh Shakya wrote: > | hi, > | I am running a python script and it will create a file name like > filename0.0.0 and If I run it again then new file will create one more like > filename0.0.1...... my code is- > | > | i = 0 > | for i in range(1000): > | try: > | with open('filename%d.%d.%d.json'%(0,0,i,)): pass > | continue > | except IOError: > | dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+') > | break > | But It will take more time after creating many files, So i want to store > value of last var "i" in a variable so that when i run my script again then > I can use it. for example- > | my last created file is filename0.0.27 then it should > store 27 in a variable and when i run again then new file should be created > 0.0.28 according to last value "27", so that i could save time and it can > create file fast.. > | > | Please give me suggestion for it.. How is it possible? > > Write it to a file? Read the file next time the script runs? > > BTW, trying to open zillions of files is slow. > But using listdir to read the directory you can see all the names. > Pick the next free one (and then test anyway). > -- > Cameron Simpson > > The mark must be robust enough to survive MP3 transmission over the > Internet, > but remain inaudible when played on the yet to be launched DVD-Audio > players. > - the SDMI audio watermarkers literally ask for the impossible, since all > audio compressors aim to pass _only_ human perceptible data > http://www.newscientist.com/news/news.jsp?id=ns224836 > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davea at davea.name Thu Jun 6 08:14:33 2013 From: davea at davea.name (Dave Angel) Date: Thu, 06 Jun 2013 08:14:33 -0400 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> Message-ID: <51B07D29.404@davea.name> On 06/06/2013 06:50 AM, Avnesh Shakya wrote: > hi, > I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1...... my code is- > > i = 0 Redundant initialization of i. > for i in range(1000): > try: > with open('filename%d.%d.%d.json'%(0,0,i,)): pass > continue > except IOError: > dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+') > break > But It will take more time after creating many files, So i want to store value of last var "i" in a variable There are no variables once the program ends. You mean you want to store it in the file. That's known as persistent storage, and in the general case you could use pickle or something like that. But in your simple case, the easiest thing would be to simply write the last value of i out to a file in the same directory. Then when your program starts, it opens that extra file and reads in the value of i. And uses that for the starting value in the loop. so that when i run my script again then I can use it. for example- > my last created file is filename0.0.27 then it should store 27 in a variable and when i run again then new file should be created 0.0.28 according to last value "27", so that i could save time and it can create file fast.. > > Please give me suggestion for it.. How is it possible? > Thanks > Incidentally, instead of opening each one, why not check its existence? Should be quicker, and definitely clearer. Entirely separate suggestion, since I dislike having extra housekeeping files that aren't logically necessary, and that might become out of synch : If you're planning on having the files densely populated (meaning no gaps in the numbering), then you could use a binary search to find the last one. Standard algorithm would converge with 10 existence checks if you have a limit of 1000 files. -- DaveA From rosuav at gmail.com Thu Jun 6 11:37:16 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 01:37:16 +1000 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: <51B07D29.404@davea.name> References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <51B07D29.404@davea.name> Message-ID: On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel wrote: > If you're planning on having the files densely populated (meaning no gaps in > the numbering), then you could use a binary search to find the last one. > Standard algorithm would converge with 10 existence checks if you have a > limit of 1000 files. Or, if you can dedicate a directory to those files, you could go even simpler: dataFile = open('filename0.0.%d.json'%len(os.listdir()), 'w') The number of files currently existing equals the number of the next file. ChrisA From python at mrabarnett.plus.com Thu Jun 6 11:54:13 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 06 Jun 2013 16:54:13 +0100 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <51B07D29.404@davea.name> Message-ID: <51B0B0A5.4050707@mrabarnett.plus.com> On 06/06/2013 16:37, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel wrote: >> If you're planning on having the files densely populated (meaning no gaps in >> the numbering), then you could use a binary search to find the last one. >> Standard algorithm would converge with 10 existence checks if you have a >> limit of 1000 files. > > Or, if you can dedicate a directory to those files, you could go even simpler: > > dataFile = open('filename0.0.%d.json'%len(os.listdir()), 'w') > > The number of files currently existing equals the number of the next file. > Assuming no gaps. From rosuav at gmail.com Thu Jun 6 11:56:52 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 7 Jun 2013 01:56:52 +1000 Subject: How to store a variable when a script is executing for next time execution? In-Reply-To: <51B0B0A5.4050707@mrabarnett.plus.com> References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <51B07D29.404@davea.name> <51B0B0A5.4050707@mrabarnett.plus.com> Message-ID: On Fri, Jun 7, 2013 at 1:54 AM, MRAB wrote: > On 06/06/2013 16:37, Chris Angelico wrote: >> >> On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel wrote: >>> >>> If you're planning on having the files densely populated (meaning no gaps >>> in >>> the numbering), then you could use a binary search to find the last one. >>> Standard algorithm would converge with 10 existence checks if you have a >>> limit of 1000 files. >> >> >> Or, if you can dedicate a directory to those files, you could go even >> simpler: >> >> dataFile = open('filename0.0.%d.json'%len(os.listdir()), 'w') >> >> The number of files currently existing equals the number of the next file. >> > Assuming no gaps. Which is also a stated assumption of the binary search. The only additional assumption of the file-count method is that there be no other files in that directory. ChrisA From jpiitula at ling.helsinki.fi Thu Jun 6 08:46:06 2013 From: jpiitula at ling.helsinki.fi (Jussi Piitulainen) Date: 06 Jun 2013 15:46:06 +0300 Subject: How to store a variable when a script is executing for next time execution? References: <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> Message-ID: Avnesh Shakya writes: > I am running a python script and it will create a file name like > filename0.0.0 and If I run it again then new file will create one > more like filename0.0.1...... my code is- > > i = 0 > for i in range(1000): > try: > with open('filename%d.%d.%d.json'%(0,0,i,)): pass > continue > except IOError: > dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+') > break > > But It will take more time after creating many files, So i want to > store value of last var "i" in a variable so that when i run my > script again then I can use it. for example- my last created file is > filename0.0.27 then it should store 27 in a variable and when i run > again then new file should be created 0.0.28 according to last value > "27", so that i could save time and it can create file fast.. You could get a list of all filenames that match the pattern. Extract the last components as numbers, and add 1 to the maximum. i = 1 + max(int(name.split('.')[-1]) for name in glob.glob('filename.0.0.*)) That assumes that there already is at least one such file and all such files have a last component that can be parsed as an int. Take an appropriate amount of care. Or you could also create a file, say lastname.0.0.31, to track the name, and when you find it there, create filename.0.0.32 and replace lastname.0.0.32; panic if there is more than one lastname.0.0.*, or fewer than one. Or as above but track with nextname.0.0.31 to create filename.0.0.31 and replace the tracking name with nextname.0.0.32 for the next file. Or save the number somewhere else. From negaipub at gmail.com Thu Jun 6 08:01:11 2013 From: negaipub at gmail.com (Paul Volkov) Date: Thu, 6 Jun 2013 16:01:11 +0400 Subject: Mistakes in documentation Message-ID: Where can I submit little mistakes in Python documantation? I found one while browsing tutorial.pdf (Python 3.3.2): Section 3.1 says (on page 12): >>> word[2:5] # characters from position 2 (included) to 4 (excluded) ?tho? Shouldn't the comment say "5 (excluded)" or "4 (included)" instead? -------------- next part -------------- An HTML attachment was scrubbed... URL: From storchaka at gmail.com Thu Jun 6 08:24:00 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Thu, 06 Jun 2013 15:24:00 +0300 Subject: Mistakes in documentation In-Reply-To: References: Message-ID: 06.06.13 15:01, Paul Volkov ???????(??): > Where can I submit little mistakes in Python documantation? http://bugs.python.org/ From tjreedy at udel.edu Thu Jun 6 10:08:10 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Thu, 06 Jun 2013 10:08:10 -0400 Subject: Mistakes in documentation In-Reply-To: References: Message-ID: On 6/6/2013 8:01 AM, Paul Volkov wrote: > Where can I submit little mistakes in Python documantation? > I found one while browsing tutorial.pdf (Python 3.3.2): > > Section 3.1 says (on page 12): > >>> word[2:5] # characters from position 2 (included) to 4 (excluded) > ?tho? > > Shouldn't the comment say "5 (excluded)" or "4 (included)" instead? At the bottom of the index page, in the Meta information section, is an entry for the Reporting bugs doc. It says to email docs at python.org or to use the tracker for a persistent record. This is followed by an explanation of using the tracker. Terry From mw at d3i.com Thu Jun 6 12:48:18 2013 From: mw at d3i.com (Michael) Date: Thu, 6 Jun 2013 09:48:18 -0700 (PDT) Subject: Thread-safe way to prevent decorator from being nested Message-ID: <21b0b719-cdf9-4475-81ac-a429a1e65907@googlegroups.com> I'm writing a decorator that I never want to be nested. Following from the answer on my StackOverflow question (http://stackoverflow.com/a/16905779/106244), I've adapted it to the following. Can anyone spot any issues with this? It'll be run in a multi-threaded environment serving Django requests and also be a part of Celery tasks. import threading from contextlib import contextmanager from functools import wraps thread_safe_globals = threading.local() @contextmanager def flag(): thread_safe_globals._within_special_context = True try: yield finally: thread_safe_globals._within_special_context = False def within_special_wrapper(): try: return thread_safe_globals._within_special_context except AttributeError: return False def my_special_wrapper(f): @wraps(f) def internal(*args, **kwargs): if not within_special_wrapper(): with flag(): f(*args, **kwargs) else: raise Exception("No nested calls!") return internal @my_special_wrapper def foo(): print(within_special_wrapper()) bar() print('Success!') @my_special_wrapper def bar(): pass foo() From __peter__ at web.de Fri Jun 7 05:07:14 2013 From: __peter__ at web.de (Peter Otten) Date: Fri, 07 Jun 2013 11:07:14 +0200 Subject: Thread-safe way to prevent decorator from being nested References: <21b0b719-cdf9-4475-81ac-a429a1e65907@googlegroups.com> Message-ID: Michael wrote: > I'm writing a decorator that I never want to be nested. Following from the > answer on my StackOverflow question > (http://stackoverflow.com/a/16905779/106244), I've adapted it to the > following. > > Can anyone spot any issues with this? It'll be run in a multi-threaded > environment serving Django requests and also be a part of Celery tasks. I'm not sure I understand what you are trying to do, but this > if not within_special_wrapper(): > with flag(): looks suspiciously like race condition. > thread_safe_globals = threading.local() I'm not an expert in the area, but I think you need a lock, something like class NestingError(Exception): pass nest_lock = threading.Lock() def my_special_wrapper(f): @wraps(f) def internal(*args, **kwargs): if nest_lock.acquire(False): # non-blocking try: f(*args, **kwargs) finally: nest_lock.release() else: raise NestingError return internal From patrick.waldo at gmail.com Thu Jun 6 15:06:15 2013 From: patrick.waldo at gmail.com (Patrick Waldo) Date: Thu, 6 Jun 2013 15:06:15 -0400 Subject: [JOB] Look for a Full Time Plone Developer Message-ID: Hi All, Please take a look at a new job opportunity for Python/Plone developers. Patrick Waldo, Project Manager Decernis *Job Description: Full Time Python/Plone Developer* We are looking for a highly motivated and self-reliant developer to work on systems built with Plone in a small, but lively team. Our ideal candidate is not afraid to roll up their sleeves to tackle complex problems with their code as well as offer innovative solutions at the planning and design stages. The position also calls for both rapid prototyping for client meetings, maintaining current systems and fulfilling other tasks as necessary. This position requires experience in Plone administration, setting up backup and failover instances, optimizing the ZODB, testing and documentation. The job also entails creating clean user interfaces, building forms and integrating with Oracle. The position will begin with a six-month trial period at which point full-time employment will be re-evaluated based on performance. The candidate will be able to choose hours and work remotely, but must meet deadlines and report progress effectively. *Key Skills* ? At least 3 years of Plone and Python development ? At least 3 years web development (HTML, CSS, jQuery, etc.) ? Server administration (Apache) ? Oracle integration (cx_Oracle, SQLAlchemy, etc.) ? Task oriented and solid project management skills ? Data mining and data visualization experience is a plus ? Java or Perl experience is a plus ? Proficient English ? Effective communication *About Decernis* Decernis is a global information systems company that works with industry leaders and government agencies to meet complex regulatory compliance and risk management needs in the areas of food, consumer products and industrial goods. We hold ourselves to high standards to meet the technically challenging areas that our clients face to ensure comprehensive, current and global solutions. Decernis has offices in Rockville, MD and Frankfurt, Germany as well as teams located around the world. For more information, please visit our website: http://www.decernis.com. *Contact* Please send resume, portfolio and cover letter to Cynthia Gamboa, * cgamboa at decernis.com*. Decernis is an equal opportunity employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbc at unc.edu Thu Jun 6 15:14:57 2013 From: cbc at unc.edu (Calloway, Chris) Date: Thu, 6 Jun 2013 19:14:57 +0000 Subject: Python Community Training Events Message-ID: Here are some upcoming Python community training events organized by the Triangle Python Users Group: PyOhio PyCamp 2013 offered July 22-26, 2013 at Ohio State University in conjunction with the PyOhio 2013 regional Python conference: http://trizpug.org/boot-camp/pyohio13/ Python Network and Web Programming Workshop offered August 5-9, 2013 at the University of North Carolina: http://trizpug.org/boot-camp/pywebpw13/ Toronto PyCamp 2013 offered August 12-16, 2013 at the University of Toronto in conjunction with the PyCon Canada 2013 national Python conference: http://trizpug.org/boot-camp/torpy13/ Seattle PyCamp 2013 offered September 9-13, 2013 at the University of Washington's Paul G. Allen Center for Computer Science and Engineering: http://trizpug.org/boot-camp/seapy13/ -- Sincerely, Chris Calloway UNC-CH Department of Marine Sciences 3313 Venable Hall CB 3300 Chapel Hill, NC 27599-3300 (919) 599-3530 From ron.eggler at gmail.com Thu Jun 6 20:03:25 2013 From: ron.eggler at gmail.com (cerr) Date: Thu, 6 Jun 2013 17:03:25 -0700 (PDT) Subject: trigger at TDM/2 only Message-ID: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> Hi, I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if minute % TDM/2 is 0 but not if minute % TDM is 0: min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min while not (min%tdm_timeslot != 0 ^ min%(int(tdm_timeslot/2)) != 0): time.sleep(10) logger.debug("WAIT "+str(datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min)) logger.debug(str(min%(int(tdm_timeslot/2)))+" - "+str(min%tdm_timeslot)) min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min logger.debug("RUN UPDATE CHECK...") But weird enough, the output I get is something like this: I would expect my while to exit the loop as soon as the minute turns 1435... why is it staying in? What am I doing wrong here? WAIT 1434 3 - 3 WAIT 1434 4 - 4 WAIT 1434 4 - 4 WAIT 1434 4 - 4 WAIT 1434 4 - 4 WAIT 1434 4 - 4 WAIT 1435 4 - 4 WAIT 1435 0 - 5 WAIT 1435 0 - 5 WAIT 1435 0 - 5 WAIT 1435 0 - 5 WAIT 1435 0 - 5 WAIT 1436 0 - 5 RUN UPDATE CHECK... Thank you for any assistance! Ron From davea at davea.name Thu Jun 6 20:43:11 2013 From: davea at davea.name (Dave Angel) Date: Thu, 06 Jun 2013 20:43:11 -0400 Subject: trigger at TDM/2 only In-Reply-To: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> References: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> Message-ID: <51B12C9F.2090504@davea.name> On 06/06/2013 08:03 PM, cerr wrote: > Hi, > > I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if minute % TDM/2 is 0 but not if minute % TDM is 0: > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > while not (min%tdm_timeslot != 0 ^ min%(int(tdm_timeslot/2)) != 0): You might have spent three minutes and simplified this for us. And in the process discovered the problem. (BTW, min() is a builtin function, so it's not really a good idea to be shadowing it.) You didn't give python version, so my sample is assuming Python 2.7 For your code it shouldn't matter. tdm = 10 tdm2 = 5 y = min(3,4) print y for now in range(10,32): print now, now%tdm, now%tdm2, print not(now % tdm !=0 ^ now%tdm2 !=0) #bad print not((now % tdm !=0) ^ (now%tdm2 !=0)) #good Your problem is one of operator precedence. Notice that ^ has a higher precedence than != operator, so you need the parentheses I added in the following line. What I don't understand is why you used this convoluted approach. Why not print now%tdm != tdm2 For precedence rules, see: http://docs.python.org/2/reference/expressions.html#operator-precedence -- DaveA From python at mrabarnett.plus.com Thu Jun 6 20:49:55 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 07 Jun 2013 01:49:55 +0100 Subject: trigger at TDM/2 only In-Reply-To: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> References: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> Message-ID: <51B12E33.6060806@mrabarnett.plus.com> On 07/06/2013 01:03, cerr wrote: > Hi, > > I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if minute % TDM/2 is 0 but not if minute % TDM is 0: > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > while not (min%tdm_timeslot != 0 ^ min%(int(tdm_timeslot/2)) != 0): > time.sleep(10) > logger.debug("WAIT "+str(datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min)) > logger.debug(str(min%(int(tdm_timeslot/2)))+" - "+str(min%tdm_timeslot)) > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > logger.debug("RUN UPDATE CHECK...") > > But weird enough, the output I get is something like this: > I would expect my while to exit the loop as soon as the minute turns 1435... why is it staying in? What am I doing wrong here? > > WAIT 1434 > 3 - 3 > WAIT 1434 > 4 - 4 > WAIT 1434 > 4 - 4 > WAIT 1434 > 4 - 4 > WAIT 1434 > 4 - 4 > WAIT 1434 > 4 - 4 > WAIT 1435 > 4 - 4 > WAIT 1435 > 0 - 5 > WAIT 1435 > 0 - 5 > WAIT 1435 > 0 - 5 > WAIT 1435 > 0 - 5 > WAIT 1435 > 0 - 5 > WAIT 1436 > 0 - 5 > RUN UPDATE CHECK... > Possibly it's due to operator precedence. The bitwise operators &, | and ^ have a higher precedence than comparisons such as !=. A better condition might be: min % tdm_timeslot != tdm_timeslot // 2 or, better yet, work out how long before the next trigger time and then sleep until then. From ron.eggler at gmail.com Fri Jun 7 12:35:50 2013 From: ron.eggler at gmail.com (cerr) Date: Fri, 7 Jun 2013 09:35:50 -0700 (PDT) Subject: trigger at TDM/2 only In-Reply-To: References: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> Message-ID: <4e5c610f-0242-48eb-8502-3fa00d53d137@googlegroups.com> DaveA, Yep, that seems to just be about it! Much easier! Thanks for the hint! Much appreciated!!!! :) Ron On Thursday, June 6, 2013 5:43:11 PM UTC-7, Dave Angel wrote: > On 06/06/2013 08:03 PM, cerr wrote: > > > Hi, > > > > > > I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if minute % TDM/2 is 0 but not if minute % TDM is 0: > > > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > > > while not (min%tdm_timeslot != 0 ^ min%(int(tdm_timeslot/2)) != 0): > > > > You might have spent three minutes and simplified this for us. And in > > the process discovered the problem. > > > > (BTW, min() is a builtin function, so it's not really a good idea to be > > shadowing it.) > > > > You didn't give python version, so my sample is assuming Python 2.7 > > For your code it shouldn't matter. > > > > tdm = 10 > > tdm2 = 5 > > > > y = min(3,4) > > print y > > > > for now in range(10,32): > > print now, now%tdm, now%tdm2, > > print not(now % tdm !=0 ^ now%tdm2 !=0) #bad > > print not((now % tdm !=0) ^ (now%tdm2 !=0)) #good > > > > > > Your problem is one of operator precedence. Notice that ^ has a higher > > precedence than != operator, so you need the parentheses I added in the > > following line. > > > > What I don't understand is why you used this convoluted approach. Why not > > > > print now%tdm != tdm2 > > > > For precedence rules, see: > > http://docs.python.org/2/reference/expressions.html#operator-precedence > > > > > > > > > > -- > > DaveA From ron.eggler at gmail.com Fri Jun 7 12:38:21 2013 From: ron.eggler at gmail.com (cerr) Date: Fri, 7 Jun 2013 09:38:21 -0700 (PDT) Subject: trigger at TDM/2 only In-Reply-To: References: <46d8c42f-fdfd-49a5-96e8-ec53d5e599d5@googlegroups.com> Message-ID: <2824bb86-2013-4560-a78e-ee4cc7fa4792@googlegroups.com> MRAB, Thanks for the hint! Yep, that's much easier! Thanks! :) Ron On Thursday, June 6, 2013 5:49:55 PM UTC-7, MRAB wrote: > On 07/06/2013 01:03, cerr wrote: > > > Hi, > > > > > > I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if minute % TDM/2 is 0 but not if minute % TDM is 0: > > > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > > > while not (min%tdm_timeslot != 0 ^ min%(int(tdm_timeslot/2)) != 0): > > > time.sleep(10) > > > logger.debug("WAIT "+str(datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min)) > > > logger.debug(str(min%(int(tdm_timeslot/2)))+" - "+str(min%tdm_timeslot)) > > > min = datetime.datetime.now().timetuple().tm_hour*60 + datetime.datetime.now().timetuple().tm_min > > > logger.debug("RUN UPDATE CHECK...") > > > > > > But weird enough, the output I get is something like this: > > > I would expect my while to exit the loop as soon as the minute turns 1435... why is it staying in? What am I doing wrong here? > > > > > > WAIT 1434 > > > 3 - 3 > > > WAIT 1434 > > > 4 - 4 > > > WAIT 1434 > > > 4 - 4 > > > WAIT 1434 > > > 4 - 4 > > > WAIT 1434 > > > 4 - 4 > > > WAIT 1434 > > > 4 - 4 > > > WAIT 1435 > > > 4 - 4 > > > WAIT 1435 > > > 0 - 5 > > > WAIT 1435 > > > 0 - 5 > > > WAIT 1435 > > > 0 - 5 > > > WAIT 1435 > > > 0 - 5 > > > WAIT 1435 > > > 0 - 5 > > > WAIT 1436 > > > 0 - 5 > > > RUN UPDATE CHECK... > > > > > Possibly it's due to operator precedence. The bitwise operators &, | > > and ^ have a higher precedence than comparisons such as !=. > > > > A better condition might be: > > > > min % tdm_timeslot != tdm_timeslot // 2 > > > > or, better yet, work out how long before the next trigger time and then > > sleep until then. From rama29065 at gmail.com Fri Jun 7 09:21:36 2013 From: rama29065 at gmail.com (DRJ Reddy) Date: Fri, 7 Jun 2013 06:21:36 -0700 (PDT) Subject: Contents of python magazine Message-ID: <4fdb6427-5fc8-4d99-88eb-f1a2a3e3c225@googlegroups.com> Hello pythonistas, ? Some application made of python(command line program or a GUI program) that we make using a python module(planning to cover as many modules as possible) ie; of included batteries of python. ? Python in Security ie; Some scripts that we can write in python like a dictionary attack tool ? One for covering Tkinter. ? One small Game using python. ? Python Facts,Python Quotes, Python PersonalitY (a python personnel bio or an interview), Python video(about a python video from Python Conferences) ? Python articles Guest as well as our own. ? Python Tutorials. ? Python Place( A place where python is being used for production). ? If we are not overloading magazine we would also cover about Python tools like say Ninja-IDE(an IDE for Python extensively written in Python). After a few days we are planning to cover ? Python in cloud.(Open Stack) ? Network Programming.(probably Twisted framework) ? Database programming with SQLite. ? Python Puzzles(some programming Questions). ? Python Webframework probably Django. We welcome further suggestions from the community. Regards, DRJ and Team. From mal at egenix.com Fri Jun 7 09:50:48 2013 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 07 Jun 2013 15:50:48 +0200 Subject: EuroPython 2014/2015 Conference Team - Reminder: Call for Proposals Message-ID: <51B1E538.9080908@egenix.com> This is a reminder to all teams who want to submit a proposal for running the next EuroPython in 2014 and 2015. Proposals must be sent in before Friday, June 14th, i.e. in less than one week. If you have questions, please feel free to contact the EuroPython Society board at board at europython.eu. We're looking forward to hearing from you :-) Here's a copy of the original announcement email with the link to the CFP document: """ The EuroPython Society (EPS) is happy to announce the Call for Proposals for the EuroPython Conference in 2014 and 2015. This Call for Proposals is meant to collect proposals from teams that volunteer for organizing the EuroPython conference in 2014-2015. The Call for Proposals document containing all the details and information about the proposals and selection process can be found here: https://docs.google.com/file/d/0B8YBdLoQM_6fbVpuM2ZWUGp3Slk/edit?usp=sharing If you are part of a great team organizing amazing Python events you could be the team organizing the next EuroPython! Please also forward this Call for Proposals to anyone that you feel may be interested. The Call for Proposals will run until Friday, June 14th. Proposals must be submitted to europython-contact at python.org before that day, and must adhere the requirements specified in the CFP document. """ Regards, -- Marc-Andre Lemburg Director EuroPython Society http://www.europython.eu/ From letsplaysforu at gmail.com Fri Jun 7 11:53:03 2013 From: letsplaysforu at gmail.com (letsplaysforu at gmail.com) Date: Fri, 7 Jun 2013 08:53:03 -0700 (PDT) Subject: Python Game Development? Message-ID: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: ??Pygame - As far as I know it's dead and has been for almost a year ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) ??Cocos2D - Won't install and cant find any support ??PyCap - Can't find any documentation ? Panda3D - Dead since 2011 + overkill for what I need ??PyOpenGL - Overkill Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! From ian.g.kelly at gmail.com Fri Jun 7 12:21:36 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 7 Jun 2013 10:21:36 -0600 Subject: Python Game Development? In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 9:53 AM, wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > ? Pygame - As far as I know it's dead and has been for almost a year > ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > ? Cocos2D - Won't install and cant find any support > ? PyCap - Can't find any documentation > ? Panda3D - Dead since 2011 + overkill for what I need > ? PyOpenGL - Overkill > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! Pygame is still quite commonly used, and the most recent commit was in April, so I think it's too early to pronounce it dead (although pgreloaded, which at one point was intended to be a successor to pygame, is looking a bit dormant now). A lot of folks also like pyglet, but I've never used it myself. I suspect it might also be overkill for you. And yes, it's definitely possible to make games in Python. Go to pyweek.org and check out many of the awesome games that have been developed in Python in only one week. From letsplaysforu at gmail.com Fri Jun 7 12:28:09 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Fri, 7 Jun 2013 09:28:09 -0700 (PDT) Subject: Python Game Development? In-Reply-To: References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> On Friday, June 7, 2013 5:21:36 PM UTC+1, Ian wrote: > On Fri, Jun 7, 2013 at 9:53 AM, wrote: > > > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > > > > > ? Pygame - As far as I know it's dead and has been for almost a year > > > ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > > > ? Cocos2D - Won't install and cant find any support > > > ? PyCap - Can't find any documentation > > > ? Panda3D - Dead since 2011 + overkill for what I need > > > ? PyOpenGL - Overkill > > > > > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! > > > > Pygame is still quite commonly used, and the most recent commit was in > > April, so I think it's too early to pronounce it dead (although > > pgreloaded, which at one point was intended to be a successor to > > pygame, is looking a bit dormant now). > > > > A lot of folks also like pyglet, but I've never used it myself. I > > suspect it might also be overkill for you. > > > > And yes, it's definitely possible to make games in Python. Go to > > pyweek.org and check out many of the awesome games that have been > > developed in Python in only one week. Do you know of any tutorial for PyGame? Preferably a video tutorial but any tutorial at all is fine! I can't seem to find any, even on pygame.org!!! From ian.g.kelly at gmail.com Fri Jun 7 12:35:25 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 7 Jun 2013 10:35:25 -0600 Subject: Python Game Development? In-Reply-To: <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: > Do you know of any tutorial for PyGame? Preferably a video tutorial but any tutorial at all is fine! I can't seem to find any, even on pygame.org!!! I'd start here: http://www.pygame.org/wiki/tutorials From ian.g.kelly at gmail.com Fri Jun 7 12:36:27 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 7 Jun 2013 10:36:27 -0600 Subject: Python Game Development? In-Reply-To: References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 10:35 AM, Ian Kelly wrote: > On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: >> Do you know of any tutorial for PyGame? Preferably a video tutorial but any tutorial at all is fine! I can't seem to find any, even on pygame.org!!! > > I'd start here: http://www.pygame.org/wiki/tutorials Also the section under the "Tutorials" heading at http://www.pygame.org/docs/ From steve+comp.lang.python at pearwood.info Fri Jun 7 12:39:56 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 07 Jun 2013 16:39:56 GMT Subject: Python Game Development? References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> Message-ID: <51b20cdc$0$29966$c3e8da3$5496439d@news.astraweb.com> On Fri, 07 Jun 2013 09:28:09 -0700, Eam onn wrote: > Do you know of any tutorial for PyGame? Preferably a video tutorial but > any tutorial at all is fine! I can't seem to find any, even on > pygame.org!!! https://duckduckgo.com/html/?q=pygame+tutorial -- Steven From orgnut at yahoo.com Sat Jun 8 01:04:25 2013 From: orgnut at yahoo.com (Larry Hudson) Date: Fri, 07 Jun 2013 22:04:25 -0700 Subject: Python Game Development? In-Reply-To: <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> <0de65ebd-2141-4dd3-b091-88ef972a6db8@googlegroups.com> Message-ID: On 06/07/2013 09:28 AM, Eam onn wrote: > On Friday, June 7, 2013 5:21:36 PM UTC+1, Ian wrote: >> On Fri, Jun 7, 2013 at 9:53 AM, wrote: > Do you know of any tutorial for PyGame? Preferably a video tutorial but any tutorial at all is fine! I can't seem to find any, even on pygame.org!!! > Check out: http://inventwithpython.com/pygame/ for the book "Making Games with Python & Pygame" You can buy it, read it on-line for free, or download the pdf or eReader versions for free. (Totally irrelevant side-comment: PyGame and all the games from this book come pre-loaded on the Raspberry Pi.) -=- Larry -=- From letsplaysforu at gmail.com Fri Jun 7 13:53:20 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Fri, 7 Jun 2013 10:53:20 -0700 (PDT) Subject: Python Game Development? In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: On Friday, June 7, 2013 4:53:03 PM UTC+1, Eam onn wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > > > ??Pygame - As far as I know it's dead and has been for almost a year > > ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > > ??Cocos2D - Won't install and cant find any support > > ??PyCap - Can't find any documentation > > ? Panda3D - Dead since 2011 + overkill for what I need > > ??PyOpenGL - Overkill > > > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! Pygame isn't too good. You still need a lot of other libraries from what I understand(like for physics). Is there any alternative for 2D? From msarro at gmail.com Fri Jun 7 14:00:16 2013 From: msarro at gmail.com (Matty Sarro) Date: Fri, 7 Jun 2013 14:00:16 -0400 Subject: Python Game Development? In-Reply-To: References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: You could make a fantastic turtle based game with pyturtle! On Fri, Jun 7, 2013 at 1:53 PM, Eam onn wrote: > On Friday, June 7, 2013 4:53:03 PM UTC+1, Eam onn wrote: > > I was planning on making a small 2D game in Python. Are there any > libraries for this? I know of: > > > > > > > > ? Pygame - As far as I know it's dead and has been for almost a year > > > > ? PyOgre - Linux and Windows only(I do have those, but I want > multi-platform) > > > > ? Cocos2D - Won't install and cant find any support > > > > ? PyCap - Can't find any documentation > > > > ? Panda3D - Dead since 2011 + overkill for what I need > > > > ? PyOpenGL - Overkill > > > > > > > > Any help on what to do with this would be appreciated. I am making games > mainly in Lua but I'd like to make one in Python for fun. I also understand > that Python isn't exactly the *BEST* choice programming a game, but I have > heard it is possible. Tell me if it's true. Thanks! > > Pygame isn't too good. You still need a lot of other libraries from what I > understand(like for physics). Is there any alternative for 2D? > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.g.kelly at gmail.com Fri Jun 7 14:42:06 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 7 Jun 2013 12:42:06 -0600 Subject: Python Game Development? In-Reply-To: References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 11:53 AM, Eam onn wrote: > Pygame isn't too good. You still need a lot of other libraries from what I understand(like for physics). Is there any alternative for 2D? I don't know of any Python libraries that provide both a rendering engine and a physics engine. I'm not sure why you say pyame "isn't too good". A library that only does one thing shouldn't be considered a bad library if it does it well. I hear that pygame doesn't scale very well to large games, and it certainly wouldn't be my first choice for a 3D game, but I've never had any major issues with it myself. There's a largish list of alternative libraries that you might consider here: http://wiki.python.org/moin/PythonGameLibraries From drsalists at gmail.com Fri Jun 7 17:50:31 2013 From: drsalists at gmail.com (Dan Stromberg) Date: Fri, 7 Jun 2013 14:50:31 -0700 Subject: Python Game Development? In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: On Fri, Jun 7, 2013 at 8:53 AM, wrote: > I also understand that Python isn't exactly the *BEST* choice programming > a game, but I have heard it is possible. Tell me if it's true. Thanks! > One of the Blizzard people told me that it's very common to program game logic in Python, with the 3D stuff done in C wrapped up to be callable from Python. But I've since heard that Blizzard mostly uses Lua, from someone who doesn't work at Blizzard. Maybe Blizzard use both Python and Lua, or maybe they changed, I don't know. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian at feete.org Sat Jun 8 02:30:51 2013 From: ian at feete.org (Ian Foote) Date: Sat, 08 Jun 2013 07:30:51 +0100 Subject: Python Game Development? In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: <51B2CF9B.3060907@feete.org> On 07/06/13 16:53, letsplaysforu at gmail.com wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > ? Pygame - As far as I know it's dead and has been for almost a year > ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > ? Cocos2D - Won't install and cant find any support > ? PyCap - Can't find any documentation > ? Panda3D - Dead since 2011 + overkill for what I need > ? PyOpenGL - Overkill > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! > You might also wish to consider Kivy (kivy.org). Regards, Ian F From janpeterr at freenet.de Sat Jun 8 07:52:53 2013 From: janpeterr at freenet.de (Jan Riechers) Date: Sat, 08 Jun 2013 14:52:53 +0300 Subject: Python Game Development? In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: <51B31B15.8090504@freenet.de> On 07.06.2013 18:53, letsplaysforu at gmail.com wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > ? Pygame - As far as I know it's dead and has been for almost a year > ? PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > ? Cocos2D - Won't install and cant find any support > ? PyCap - Can't find any documentation > ? Panda3D - Dead since 2011 + overkill for what I need > ? PyOpenGL - Overkill > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! > Hi, I only have looked closer in pygame. But before asking for an general overview of possible gaming libraries, I would start to answer the question of what kind of game you want to make and what features do you really need. For some space game for example it is most unlikely that you will face the requirement of having a bleeding edge physics engine. Especially if you make use of 2d objects versus 3d models of any type. I guess you can expand the latter to any extend here. Also it is a common thing I might guess bravely, that the basics of game programming are done similar in all game engines. - Setting up a game loop - Calculation present and future ob objects - Handling user input by using events - Redraw the screen And this is in pygame quite simply, but I also had trouble finding the right entrance to it, as you have to read a bit up on how components fit together in that library. An example basic setup looks like (with classing), I remove my code and limited it to basic event/input handling and also the drawing of a screen object in which you can add images and stuff. Sorry for the formatting, I copied from idle and formatted in my email client. #---------------------------------------- class gameApp: def __init__(self): pygame.init() self.clock = pygame.time.Clock() self.screen = pygame.display.set_mode( (640, 480), DOUBLEBUF|SRCALPHA ) self.run() def run(self): while not self.close_app: self.clock.tick(60) for event in pygame.event.get(): #print event if event.type == KEYUP: # Press tab for player info if event.key == 9: pass # Do something in tab key elif event.type == MOUSEBUTTONDOWN: if event.button == 1: pass # Left click, mouse button is pressend elif event.type == MOUSEMOTION: mx = event.rel[0] my = event.rel[1] continue elif event.type == QUIT: self.close_app = True self.screen.fill( (0,0,0) ) # Self interaction is a screen drawing object self.screen.blit(self.interactions, (0,0), special_flags=BLEND_RGBA_ADD) pygame.display.flip() pygame.quit() if __name__ == '__main__': import pygame from pygame.locals import * gameApp() #---------------------------------------- Regards Jan From nobody at nowhere.com Sat Jun 8 10:17:14 2013 From: nobody at nowhere.com (Nobody) Date: Sat, 08 Jun 2013 15:17:14 +0100 Subject: Python Game Development? References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: On Fri, 07 Jun 2013 08:53:03 -0700, letsplaysforu wrote: > I was planning on making a small 2D game in Python. Are there any > libraries for this? I know of: [snip] There's also Pyglet. From fabiosantosart at gmail.com Sat Jun 8 12:01:37 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sat, 8 Jun 2013 17:01:37 +0100 Subject: Python Game Development? In-Reply-To: References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: > On Fri, 07 Jun 2013 08:53:03 -0700, letsplaysforu wrote: > > > I was planning on making a small 2D game in Python. Are there any > > libraries for this? I know of: It wasn't your question, but I was happy to find out that box2d exists for python. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wuwei23 at gmail.com Tue Jun 11 22:27:25 2013 From: wuwei23 at gmail.com (alex23) Date: Tue, 11 Jun 2013 19:27:25 -0700 (PDT) Subject: Python Game Development? References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Message-ID: <62d820ad-75e0-4005-82a7-a1d65e5ba75a@v10g2000pbv.googlegroups.com> On Jun 8, 1:53?am, letsplaysf... at gmail.com wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > ??Cocos2D - Won't install and cant find any support Cocos2D is what I tend to recommend. What issues did you have with installing it? For support, you can try their Google group, which is active: https://groups.google.com/group/cocos-discuss From ethereal_robe at hotmail.com Fri Jun 7 13:44:59 2013 From: ethereal_robe at hotmail.com (ethereal_robe at hotmail.com) Date: Fri, 7 Jun 2013 10:44:59 -0700 (PDT) Subject: Trying to work with data from a query using Python. Message-ID: <3f8d60b3-6b92-4670-ac99-28ec6fee580b@googlegroups.com> Hello, I'm working with PostgreSQL and Python to obtain 2 columns froma database and need to print it in a specific format. Here is my current code. #!/usr/bin/python # -*- coding: utf-8 -*- import psycopg2 import sys con = None try: con = psycopg2.connect(database='DB', user='ME', password='1234') cur = con.cursor() cur.execute(" select Account_Invoice.amount_untaxed, right (Res_Partner.vat,length(Res_Partner.vat)-2) as RFC from Account_Invoice inner join Res_Partner on Account_Invoice.partner_id = Res_Partner.id inner join Account_Invoice_Tax on Account_Invoice.id = Account_Invoice_Tax.invoice_id where account_invoice.journal_id=2 and account_invoice.date_invoice >= '2013-01-01' and account_invoice.date_invoice <= '2013-02-01' and account_invoice.reconciled is TRUE and account_invoice_tax.account_id = 3237 and account_invoice.amount_tax >= 0;") rows = cur.fetchall() for row in rows: print row except psycopg2.DatabaseError, e: print 'Error %s' % e sys.exit(1) finally: if con: con.close() Now assume that fetchall would print the following: LOEL910624ND5 from the column vat as RFC. 227 from the column amount_untaxed. Now I would need to print that in the following format. 04|85|LOEL910624ND5|||||227||||||||||||||| 04 always goes in the first column and 85 always goes in the second, vat goes in the third and the amount_untaxed goes in the eight column but we still need to have 22 columns in total. From davea at davea.name Fri Jun 7 14:24:30 2013 From: davea at davea.name (Dave Angel) Date: Fri, 07 Jun 2013 14:24:30 -0400 Subject: Trying to work with data from a query using Python. In-Reply-To: <3f8d60b3-6b92-4670-ac99-28ec6fee580b@googlegroups.com> References: <3f8d60b3-6b92-4670-ac99-28ec6fee580b@googlegroups.com> Message-ID: <51B2255E.3040204@davea.name> On 06/07/2013 01:44 PM, ethereal_robe at hotmail.com wrote: > > > rows = cur.fetchall() > > for row in rows: > print row > > > > > Now assume that fetchall would print the following: I doubt if fetchall() prints anything. presumably it returns something, extracted from the db. > > LOEL910624ND5 from the column vat as RFC. > 227 from the column amount_untaxed. > > > Now I would need to print that in the following format. > > 04|85|LOEL910624ND5|||||227||||||||||||||| > > 04 always goes in the first column and 85 always goes in the second, vat goes in the third and the amount_untaxed goes in the eight column but we still need to have 22 columns in total. > > I don't use psycopg2, and I'd suggest few others here do either. Since the problem has nothing to do with psycopg2, could you simplify the problem? Whatever fetchall() returns, it's presumably either a dict or list. Or is it a list of lists? Find out what kind of data it is, and stub it with something like: rows = ["ab", "127"] Then if you define what the items in that list (or whatever) are supposed to mean, we can tell you how to stick all those pipe-symbols between. One likely answer would be the csv module. -- DaveA From __peter__ at web.de Fri Jun 7 14:59:00 2013 From: __peter__ at web.de (Peter Otten) Date: Fri, 07 Jun 2013 20:59 +0200 Subject: Trying to work with data from a query using Python. References: <3f8d60b3-6b92-4670-ac99-28ec6fee580b@googlegroups.com> Message-ID: ethereal_robe at hotmail.com wrote: > Hello, I'm working with PostgreSQL and Python to obtain 2 columns froma > database and need to print it in a specific format. > > Here is my current code. > > > > #!/usr/bin/python > # -*- coding: utf-8 -*- > > import psycopg2 > import sys > > con = None > > try: > > con = psycopg2.connect(database='DB', user='ME', password='1234') > > cur = con.cursor() > cur.execute(" select Account_Invoice.amount_untaxed, right > (Res_Partner.vat,length(Res_Partner.vat)-2) as RFC from > Account_Invoice inner join Res_Partner on Account_Invoice.partner_id = > Res_Partner.id inner join Account_Invoice_Tax on Account_Invoice.id = > Account_Invoice_Tax.invoice_id where account_invoice.journal_id=2 and > account_invoice.date_invoice >= '2013-01-01' and > account_invoice.date_invoice <= '2013-02-01' and > account_invoice.reconciled is TRUE and account_invoice_tax.account_id > = 3237 and account_invoice.amount_tax >= 0;") > > rows = cur.fetchall() > > for row in rows: > print row > > > except psycopg2.DatabaseError, e: > print 'Error %s' % e > sys.exit(1) > > > finally: > > if con: > con.close() > > > > > Now assume that fetchall would print the following: > > LOEL910624ND5 from the column vat as RFC. > 227 from the column amount_untaxed. > > > Now I would need to print that in the following format. > > 04|85|LOEL910624ND5|||||227||||||||||||||| > > 04 always goes in the first column and 85 always goes in the second, vat > goes in the third and the amount_untaxed goes in the eight column but we > still need to have 22 columns in total. Keep it simple: COLUMN_COUNT = 22 TEMPLATE = "04|85|{0}|||||{1}|||||||||||||||" assert TEMPLATE.count("|") == COLUMN_COUNT -1, "You cannot count ;)" for row in cur.fetchall(): print TEMPLATE.format(*row) A bit more general: fill_rows(rows): out_row = [""] * 22 out_row[0] = "04" out_row[1] = "85" for row in rows: out_row[2], out_row[7] = row # copying not necessary here, but let's play it safe yield out_row[:] writer = csv.writer(sys.stdout, delimiter="|") writer.writerows(fill_rows(cur.fetchall())) All untested code. From walterhurry at lavabit.com Fri Jun 7 17:59:58 2013 From: walterhurry at lavabit.com (Walter Hurry) Date: Fri, 7 Jun 2013 21:59:58 +0000 (UTC) Subject: Trying to work with data from a query using Python. References: <3f8d60b3-6b92-4670-ac99-28ec6fee580b@googlegroups.com> Message-ID: On Fri, 07 Jun 2013 14:24:30 -0400, Dave Angel wrote: > On 06/07/2013 01:44 PM, ethereal_robe at hotmail.com wrote: >> > >> >> rows = cur.fetchall() >> >> for row in rows: >> print row >> >> >> >> >> Now assume that fetchall would print the following: > > I doubt if fetchall() prints anything. presumably it returns something, > extracted from the db. > > >> LOEL910624ND5 from the column vat as RFC. >> 227 from the column amount_untaxed. >> >> >> Now I would need to print that in the following format. >> >> 04|85|LOEL910624ND5|||||227||||||||||||||| >> >> 04 always goes in the first column and 85 always goes in the second, >> vat goes in the third and the amount_untaxed goes in the eight column >> but we still need to have 22 columns in total. >> >> >> > > I don't use psycopg2, and I'd suggest few others here do either. > > Since the problem has nothing to do with psycopg2, could you simplify > the problem? Whatever fetchall() returns, it's presumably either a dict > or list. Or is it a list of lists? > It actually returns a list of tuples. From zughumancapital at yahoo.com.br Fri Jun 7 16:00:13 2013 From: zughumancapital at yahoo.com.br (zughumancapital) Date: Fri, 07 Jun 2013 20:00:13 -0000 Subject: Oportunidade: Desenvolvedor Python Message-ID: Fabrica de software localizada na Barra da Tijuca contrata: Desenvolvedor Python Objetivo geral da Posi??o: Desenvolvimento de sistemas Web com Python/Django, HTML5, Javascript e CSS. Pr??requisitos: Experi?ncia com Python/Django ou outro framework MVC. Familiarizado com desenvolvimento front?end: padr?es Web, (X)HTML, HTML5, CSS, javas (jQuery). Conhecimentos de linguagem SQL e Stored Procedures Conhecimentos de bancos de dados MySQL / Postgresql Conhecimentos de padr?es de projeto (design patterns) Interessante como diferenciais: Computer Vision (OpenCV) Outras linguagens: PHP, C/C++ Desenvolvimento para smartphones: iOS e Android TDD ? Agile development (Scrum, XP, etc.) SO Linux/Unix like ? Desenvolvimento para Android e iOS Bancos de dados NoSQL (ex: MongoDB) API do Facebook / Twitter Forma??o: Nenhuma forma??o espec?fica ? obrigat?ria, entretanto podem ser considerado um diferencial. Deveres: Desenvolver seguindo o padr?o de qualidade esperado, manter sincronia com a equipe, estima cumprir prazos de entregas. A empresa oferece sal?rio compat?vel com o mercado + Benef?cios (Assist?ncia M?dica + Assist?ncia Odontol?gica + B?nus por Resultado + Vale Transporte). Os interessados dever?o enviar o CV para kgarcia at zug.com.br , mencionando no assunto Desenvolvedor Python. From ralf at systemexit.de Fri Jun 7 16:47:14 2013 From: ralf at systemexit.de (Ralf Schmitt) Date: Fri, 07 Jun 2013 22:47:14 +0200 Subject: [ANNOUNCE] greenlet 0.4.1 Message-ID: <87sj0tsl65.fsf@myhost.lan> Hi, I have uploaded greenlet 0.4.1 to PyPI: https://pypi.python.org/pypi/greenlet What is it? ----------- The greenlet module provides coroutines for python. coroutines allow suspending and resuming execution at certain locations. concurrence[1], eventlet[2] and gevent[3] use the greenlet module in order to implement concurrent network applications. Documentation can be found here: http://greenlet.readthedocs.org The code is hosted on github: https://github.com/python-greenlet/greenlet Changes in version 0.4.1 ------------------------ The NEWS file lists these changes for release 0.4.1: * fix segfaults when using gcc 4.8 on amd64/x86 unix * try to disable certain gcc 4.8 optimizations that make greenlet crash * Fix greenlet on aarch64 with gcc 4.8 * workaround segfault on SunOS/sun4v * Add support for Aarch64 * Add support for x32 psABI on x86_64 * Changed memory constraints for assembly macro for PPC Linux platforms. Many thanks to all contributors! [1] http://opensource.hyves.org/concurrence/ [2] http://eventlet.net/ [3] http://www.gevent.org/ -- Cheers Ralf Schmitt From roy at panix.com Fri Jun 7 20:46:49 2013 From: roy at panix.com (Roy Smith) Date: Fri, 07 Jun 2013 20:46:49 -0400 Subject: [ANNOUNCE] greenlet 0.4.1 References: Message-ID: In article , Ralf Schmitt wrote: > Hi, > > I have uploaded greenlet 0.4.1 to PyPI: > https://pypi.python.org/pypi/greenlet > > What is it? > ----------- > The greenlet module provides coroutines for python. coroutines allow > suspending and resuming execution at certain locations. > > concurrence[1], eventlet[2] and gevent[3] use the greenlet module in > order to implement concurrent network applications. We use gevent at Songza. It's very cool. We went from 50 gunicorn workers per server to 8 when we switched to gevent. From python.list at tim.thechases.com Fri Jun 7 22:32:39 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Fri, 7 Jun 2013 21:32:39 -0500 Subject: Idiomatic Python for incrementing pairs Message-ID: <20130607213239.3e39a448@bigbox.christie.dr> Playing around, I've been trying to figure out the most pythonic way of incrementing multiple values based on the return of a function. Something like def calculate(params): a = b = 0 if some_calculation(params): a += 1 if other_calculation(params): b += 1 return (a, b) alpha = beta = 0 temp_a, temp_b = calculate(...) alpha += temp_a beta += temp_b Is there a better way to do this without holding each temporary result before using it to increment? -tkc From jason.swails at gmail.com Fri Jun 7 23:46:22 2013 From: jason.swails at gmail.com (Jason Swails) Date: Fri, 7 Jun 2013 23:46:22 -0400 Subject: Idiomatic Python for incrementing pairs In-Reply-To: <20130607213239.3e39a448@bigbox.christie.dr> References: <20130607213239.3e39a448@bigbox.christie.dr> Message-ID: On Fri, Jun 7, 2013 at 10:32 PM, Tim Chase wrote: > Playing around, I've been trying to figure out the most pythonic way > of incrementing multiple values based on the return of a function. > Something like > > def calculate(params): > a = b = 0 > if some_calculation(params): > a += 1 > if other_calculation(params): > b += 1 > return (a, b) > > alpha = beta = 0 > temp_a, temp_b = calculate(...) > alpha += temp_a > beta += temp_b > > Is there a better way to do this without holding each temporary > result before using it to increment? > alpha = beta = 0 alpha, beta = (sum(x) for x in zip( (alpha, beta), calculate(...) ) ) It saves a couple lines of code, but at the expense of readability IMO. If I was reading the first, I'd know exactly what was happening immediately. If I was reading the second, it would take a bit to decipher. In this example, I don't see a better solution to what you're doing. All the best, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From python.list at tim.thechases.com Sat Jun 8 00:10:15 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Fri, 7 Jun 2013 23:10:15 -0500 Subject: Idiomatic Python for incrementing pairs In-Reply-To: References: <20130607213239.3e39a448@bigbox.christie.dr> Message-ID: <20130607231015.515b3105@bigbox.christie.dr> On 2013-06-07 23:46, Jason Swails wrote: > On Fri, Jun 7, 2013 at 10:32 PM, Tim Chase > > def calculate(params): > > a = b = 0 > > if some_calculation(params): > > a += 1 > > if other_calculation(params): > > b += 1 > > return (a, b) > > > > alpha = beta = 0 > > temp_a, temp_b = calculate(...) > > alpha += temp_a > > beta += temp_b > > > > Is there a better way to do this without holding each temporary > > result before using it to increment? > > alpha = beta = 0 > alpha, beta = (sum(x) for x in zip( (alpha, beta), > calculate(...) ) ) Yeah, I came up with something similar, but it was so opaque I fell back to the more readable version I had above. With only the two variables to increment in this case, the overhead of duplicating code doesn't seem as worth it as it might be if there were umpteen counters being returned as a tuple and umpteen corresponding variables being updated (at which point, it might make more sense to switch to another data structure like a dict). Ah well. Glad to see at least I'm not the only one stymied by trying to make it more pythonic while at least keeping it readable. -tkc From __peter__ at web.de Sat Jun 8 02:47:43 2013 From: __peter__ at web.de (Peter Otten) Date: Sat, 08 Jun 2013 08:47:43 +0200 Subject: Idiomatic Python for incrementing pairs References: <20130607213239.3e39a448@bigbox.christie.dr> <20130607231015.515b3105@bigbox.christie.dr> Message-ID: Tim Chase wrote: > On 2013-06-07 23:46, Jason Swails wrote: >> On Fri, Jun 7, 2013 at 10:32 PM, Tim Chase >> > def calculate(params): >> > a = b = 0 >> > if some_calculation(params): >> > a += 1 >> > if other_calculation(params): >> > b += 1 >> > return (a, b) >> > >> > alpha = beta = 0 >> > temp_a, temp_b = calculate(...) >> > alpha += temp_a >> > beta += temp_b >> > >> > Is there a better way to do this without holding each temporary >> > result before using it to increment? >> >> alpha = beta = 0 >> alpha, beta = (sum(x) for x in zip( (alpha, beta), >> calculate(...) ) ) > > Yeah, I came up with something similar, but it was so opaque I fell > back to the more readable version I had above. With only the two > variables to increment in this case, the overhead of duplicating code > doesn't seem as worth it as it might be if there were umpteen > counters being returned as a tuple and umpteen corresponding > variables being updated (at which point, it might make more sense to > switch to another data structure like a dict). Ah well. Glad to see > at least I'm not the only one stymied by trying to make it more > pythonic while at least keeping it readable. > > -tkc You can hide the complexity in a custom class: >>> class T(tuple): ... def __add__(self, other): ... return T((a+b) for a, b in zip(self, other)) ... >>> t = T((0, 0)) >>> for pair in [(1, 10), (2, 20), (3, 30)]: ... t += pair ... >>> t (6, 60) (If you are already using numpy you can do the above with a numpy.array instead of writing your own T.) From jason.swails at gmail.com Sat Jun 8 07:37:25 2013 From: jason.swails at gmail.com (Jason Swails) Date: Sat, 8 Jun 2013 07:37:25 -0400 Subject: Idiomatic Python for incrementing pairs In-Reply-To: References: <20130607213239.3e39a448@bigbox.christie.dr> <20130607231015.515b3105@bigbox.christie.dr> Message-ID: On Sat, Jun 8, 2013 at 2:47 AM, Peter Otten <__peter__ at web.de> wrote: > > You can hide the complexity in a custom class: > > >>> class T(tuple): > ... def __add__(self, other): > ... return T((a+b) for a, b in zip(self, other)) > ... > >>> t = T((0, 0)) > >>> for pair in [(1, 10), (2, 20), (3, 30)]: > ... t += pair > ... > >>> t > (6, 60) > > (If you are already using numpy you can do the above with a numpy.array > instead of writing your own T.) > I do this frequently when I want data structures that behave like vectors but don't want to impose the numpy dependency on users. (Although I usually inherit from a mutable sequence so I can override __iadd__ and __isub__). It seemed overkill for the provided example, though... All the best, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From rosuav at gmail.com Fri Jun 7 23:59:01 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 8 Jun 2013 13:59:01 +1000 Subject: Idiomatic Python for incrementing pairs In-Reply-To: <20130607213239.3e39a448@bigbox.christie.dr> References: <20130607213239.3e39a448@bigbox.christie.dr> Message-ID: On Sat, Jun 8, 2013 at 12:32 PM, Tim Chase wrote: > def calculate(params): > a = b = 0 > if some_calculation(params): > a += 1 > if other_calculation(params): > b += 1 > return (a, b) > > alpha = beta = 0 > temp_a, temp_b = calculate(...) > alpha += temp_a > beta += temp_b > > Is there a better way to do this without holding each temporary > result before using it to increment? Can you pass the function a list with the appropriate values in them, and have it return them via that? def calculate(params, sums): if some_calculation(params): sums[0] += 1 if other_calculation(params): sums[1] += 1 sums = [0, 0] calculate(..., sums) Or use a dictionary if you'd rather they have names, either way. ChrisA From carlosnepomuceno at outlook.com Sat Jun 8 00:04:21 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sat, 8 Jun 2013 07:04:21 +0300 Subject: Idiomatic Python for incrementing pairs In-Reply-To: <20130607213239.3e39a448@bigbox.christie.dr> References: <20130607213239.3e39a448@bigbox.christie.dr> Message-ID: alpha, beta = (1 if some_calculation(params) else 0, 1 if other_calculation(params) else 0) > Date: Fri, 7 Jun 2013 21:32:39 -0500 > From: python.list at tim.thechases.com > To: python-list at python.org > Subject: Idiomatic Python for incrementing pairs > > Playing around, I've been trying to figure out the most pythonic way > of incrementing multiple values based on the return of a function. > Something like > > def calculate(params): > a = b = 0 > if some_calculation(params): > a += 1 > if other_calculation(params): > b += 1 > return (a, b) > > alpha = beta = 0 > temp_a, temp_b = calculate(...) > alpha += temp_a > beta += temp_b > > Is there a better way to do this without holding each temporary > result before using it to increment? > > -tkc > > > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From python.list at tim.thechases.com Sat Jun 8 00:16:22 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Fri, 7 Jun 2013 23:16:22 -0500 Subject: Idiomatic Python for incrementing pairs In-Reply-To: References: <20130607213239.3e39a448@bigbox.christie.dr> Message-ID: <20130607231622.31cb120b@bigbox.christie.dr> On 2013-06-08 07:04, Carlos Nepomuceno wrote: > alpha, beta = (1 if some_calculation(params) else 0, 1 if > other_calculation(params) else 0) This one sets them to absolute values, rather than the incrementing functionality in question: > > alpha += temp_a > > beta += temp_b The actual code in question does the initialization outside a loop: alphas_updated = betas_updated = 0 for thing in bunch_of_things: a, b = process(thing) alphas_updated += a betas_updated += b and it just bugs me as being a little warty for having temp variables when Python does things like tuple-unpacking so elegantly. That said, as mentioned in a contemporaneous reply to Jason, I haven't found anything better that is still readable. -tkc From carlosnepomuceno at outlook.com Sat Jun 8 00:16:58 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sat, 8 Jun 2013 07:16:58 +0300 Subject: Idiomatic Python for incrementing pairs In-Reply-To: <20130607231622.31cb120b@bigbox.christie.dr> References: <20130607213239.3e39a448@bigbox.christie.dr>, , <20130607231622.31cb120b@bigbox.christie.dr> Message-ID: Oh! I really though you were just adding 1 or 0 to those variables. In clude the loop next time! ;) You can accumulate the values by doing this instead: alpha, beta = (alpha + (1 if some_calculation(params) else 0), beta + (1 if other_calculation(params) else 0)) > Date: Fri, 7 Jun 2013 23:16:22 -0500 > From: python.list at tim.thechases.com > To: carlosnepomuceno at outlook.com > CC: python-list at python.org > Subject: Re: Idiomatic Python for incrementing pairs > > On 2013-06-08 07:04, Carlos Nepomuceno wrote: > > alpha, beta = (1 if some_calculation(params) else 0, 1 if > > other_calculation(params) else 0) > > This one sets them to absolute values, rather than the incrementing > functionality in question: > > > > alpha += temp_a > > > beta += temp_b > > The actual code in question does the initialization outside a loop: > > alphas_updated = betas_updated = 0 > for thing in bunch_of_things: > a, b = process(thing) > alphas_updated += a > betas_updated += b > > and it just bugs me as being a little warty for having temp > variables when Python does things like tuple-unpacking so elegantly. > That said, as mentioned in a contemporaneous reply to Jason, I haven't > found anything better that is still readable. > > -tkc > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Sat Jun 8 13:29:21 2013 From: tjreedy at udel.edu (Terry Jan Reedy) Date: Sat, 08 Jun 2013 13:29:21 -0400 Subject: Idiomatic Python for incrementing pairs In-Reply-To: <20130607231622.31cb120b@bigbox.christie.dr> References: <20130607213239.3e39a448@bigbox.christie.dr> <20130607231622.31cb120b@bigbox.christie.dr> Message-ID: On 6/8/2013 12:16 AM, Tim Chase wrote: > On 2013-06-08 07:04, Carlos Nepomuceno wrote: >> alpha, beta = (1 if some_calculation(params) else 0, 1 if >> other_calculation(params) else 0) > > This one sets them to absolute values, rather than the incrementing > functionality in question: > >>> alpha += temp_a >>> beta += temp_b > > The actual code in question does the initialization outside a loop: > > alphas_updated = betas_updated = 0 > for thing in bunch_of_things: > a, b = process(thing) > alphas_updated += a > betas_updated += b I am pretty sure that this is the faster way to get the result. > and it just bugs me as being a little warty for having temp > variables when Python does things like tuple-unpacking so elegantly. So use it ;-). > That said, as mentioned in a contemporaneous reply to Jason, I haven't > found anything better that is still readable. The generalization of what you want is a mutable vector with an in-place augmented assignment version of element by element addition. That probably has been written. Nnmpy arrays do vector addition and maybe do it in-place also (I just do ot know). But here is a custom class for the problem you presented. def process(val): return val, 2*val class Pair(list): def __init__(self, a, b): self.append(a) self.append(b) def inc(self, a, b): self[0] += a self[1] += b pair = Pair(0, 0) for val in [1,2,3]: pair.inc(*process(val)) print(pair) >>> [6, 12] This is cleaner but a bit slower than your in-lined version. I did not use __iadd__ and += because unpacking 'other' (here the process return) in the call does the error checking ('exactly two values') for 'free'. -- Terry Jan Reedy From steve+comp.lang.python at pearwood.info Sat Jun 8 02:39:46 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 08 Jun 2013 06:39:46 GMT Subject: Idiomatic Python for incrementing pairs References: Message-ID: <51b2d1b2$0$29966$c3e8da3$5496439d@news.astraweb.com> On Fri, 07 Jun 2013 21:32:39 -0500, Tim Chase wrote: > Playing around, I've been trying to figure out the most pythonic way of > incrementing multiple values based on the return of a function. > Something like [...skip misleading and irrelevant calculate() function...] > alpha = beta = 0 > temp_a, temp_b = calculate(...) > alpha += temp_a > beta += temp_b > > Is there a better way to do this without holding each temporary result > before using it to increment? Not really. The above idiom is not really terribly Pythonic. It's more like the sort of old-fashioned procedural code I'd write in Pascal or COBOL or similar. For just two variables, it's not so bad, although I'd probably save a line and a temporary variable and write it as this: alpha = beta = 0 tmp = calculate(...) alpha, beta = alpha+tmp[0], beta+tmp[1] But if you have many such values, that's a sign that you're doing it wrong. Do it like this instead: values = [0]*17 # or however many variables you have increments = calculate(...) values = [a+b for a,b in zip(values, increments)] Or define a helper function: add(v1, v2): """Vector addition. >>> add([1, 2], [4, 5]) [5, 7] """ return [a+b for a,b in zip(v1, v2)] values = [0]*17 increments = calculate(...) values = add(values, increments) Much nicer! And finally, if speed is absolutely critical, this scales to using fast vector libraries like numpy. Just use numpy arrays instead of lists, and + instead of the add helper function, and Bob's yer uncle. -- Steven From vasudevram at gmail.com Sat Jun 8 11:02:06 2013 From: vasudevram at gmail.com (vasudevram) Date: Sat, 8 Jun 2013 08:02:06 -0700 (PDT) Subject: Riemann and Bernhard, a distributed systems monitor and Python client Message-ID: <29980b38-9f67-414c-9958-2c845ccaf556@googlegroups.com> This may be of interest to the group: Riemann and Bernhard, a distributed systems monitor and Python client http://jugad2.blogspot.in/2013/06/riemann-and-bernhard-distributed.html - Vasudev Ram dancingbison.com Python training and consulting From letsplaysforu at gmail.com Sat Jun 8 12:07:44 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Sat, 8 Jun 2013 09:07:44 -0700 (PDT) Subject: Installing PyGame? Message-ID: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> Perhaps this isn't the right place to post this, but it's the only place I could find. I asked yesterday or the day before about Python Game Development, and have found a few tutorials on PyGame. Now I have a bigger problem: HOW THE HECK DO I INSTALL PYGAME!?!?! System Details: ??Mac OS X 10.8.4 Mountain Lion ??4GB DDR3 RAM I do have Window's installed, as well as Ubuntu 11.04 but I would like to use Mac OS X if possible. I've tried using MacPorts, Fink, the Mac DMG, source installing, installing NumPY, just about every way possible. I can't seem to get it working, I keep getting an error in all my versions of IDLE. I've tried: ??IDLE 2.5 ??IDLE 2.7.2 ??IDLE 2.7.3 ??IDLE 3.1 ? IDLE 3.3.1 None of the versions work. I'm using PyGame 1.9.1. Thanks! Any help is appreciated! From fabiosantosart at gmail.com Sat Jun 8 12:41:40 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sat, 8 Jun 2013 17:41:40 +0100 Subject: Installing PyGame? In-Reply-To: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> Message-ID: On 8 Jun 2013 17:17, "Eam onn" wrote: > I keep getting an error in all my versions of IDLE. What error is that? Show us. Errors carry strong hints. Also, are you following an install guide/tutorial? Which one? Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From letsplaysforu at gmail.com Sat Jun 8 13:07:42 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Sat, 8 Jun 2013 10:07:42 -0700 (PDT) Subject: Installing PyGame? In-Reply-To: References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> Message-ID: <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> On Saturday, June 8, 2013 5:41:40 PM UTC+1, F?bio Santos wrote: > On 8 Jun 2013 17:17, "Eam onn" wrote: > > > I keep getting an error in all my versions of IDLE. > > What error is that? Show us. Errors carry strong hints. > > Also, are you following an install guide/tutorial? Which one? > > Cheers I'm not following a guide, but I have followed about 20 - No exaggeration. Here's the error I am getting: ERROR 1: Terminal -------- COMMAND: import pygame File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in from pygame.base import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper ERROR 2: IDLE (all versions) -------- COMMAND: import pygame Traceback (most recent call last): File "", line 1, in import pygame ImportError: No module named 'pygame' Any idea as to what is going on? Terminal is V2.7.3 of Python. From cclauss at bluewin.ch Sat Jun 8 13:58:53 2013 From: cclauss at bluewin.ch (cclauss at bluewin.ch) Date: Sat, 8 Jun 2013 10:58:53 -0700 (PDT) Subject: Installing PyGame? In-Reply-To: <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> Message-ID: At the Terminal prompt type: python -c "help('modules')" If Pygame is not somewhere in the output then Pygame is not yet installed. If it is not installed then type: pip install --upgrade pygame From letsplaysforu at gmail.com Sat Jun 8 14:05:49 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Sat, 8 Jun 2013 11:05:49 -0700 (PDT) Subject: Installing PyGame? In-Reply-To: References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> Message-ID: On Saturday, June 8, 2013 6:58:53 PM UTC+1, ccl... at bluewin.ch wrote: > At the Terminal prompt type: python -c "help('modules')" > > > > If Pygame is not somewhere in the output then Pygame is not yet installed. > > > > If it is not installed then type: pip install --upgrade pygame python -c "help('modules')" made an error. pip install --upgrade pygame made an error too. From letsplaysforu at gmail.com Sat Jun 8 14:07:56 2013 From: letsplaysforu at gmail.com (Eam onn) Date: Sat, 8 Jun 2013 11:07:56 -0700 (PDT) Subject: Installing PyGame? In-Reply-To: References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> Message-ID: <0cbb0cd2-b3dc-44a8-a232-a6f797057f5d@googlegroups.com> On Saturday, June 8, 2013 7:05:49 PM UTC+1, Eam onn wrote: > On Saturday, June 8, 2013 6:58:53 PM UTC+1, ccl... at bluewin.ch wrote: > > > At the Terminal prompt type: python -c "help('modules')" > > > > > > > > > > > > If Pygame is not somewhere in the output then Pygame is not yet installed. > > > > > > > > > > > > If it is not installed then type: pip install --upgrade pygame > > > > python -c "help('modules')" made an error. pip install --upgrade pygame made an error too. Wait, the python -c "help('modules')" worked after spamming it a few times. Pygame was listed but it won't do anything when I type in 'import pygame' I still get the error :( From fabiosantosart at gmail.com Sat Jun 8 15:12:33 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sat, 8 Jun 2013 20:12:33 +0100 Subject: Installing PyGame? In-Reply-To: <0cbb0cd2-b3dc-44a8-a232-a6f797057f5d@googlegroups.com> References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> <0cbb0cd2-b3dc-44a8-a232-a6f797057f5d@googlegroups.com> Message-ID: On 8 Jun 2013 19:19, "Eam onn" wrote: > Wait, the python -c "help('modules')" worked after spamming it a few times. Pygame was listed but it won't do anything when I type in 'import pygame' I still get the error :( Try to always say what your error was. Do you have pip installed? Pygame AFAIK is a c extension so it requires a working compiler. I think you need to have one. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cclauss at bluewin.ch Sat Jun 8 15:23:14 2013 From: cclauss at bluewin.ch (cclauss at bluewin.ch) Date: Sat, 8 Jun 2013 12:23:14 -0700 (PDT) Subject: Installing PyGame? In-Reply-To: <0cbb0cd2-b3dc-44a8-a232-a6f797057f5d@googlegroups.com> References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> <0cbb0cd2-b3dc-44a8-a232-a6f797057f5d@googlegroups.com> Message-ID: Type: python -V (That was a capitol V) What version of python is running? Type: python3 -V (That was a capitol V) What version of python is running? Type: python -c 'import pygame' What is the exact error message? Type: python Your prompt should change to something like: >>> Type: import pygame What is the exact error message? From nhodgson at iinet.net.au Sat Jun 8 18:51:40 2013 From: nhodgson at iinet.net.au (Neil Hodgson) Date: Sun, 09 Jun 2013 08:51:40 +1000 Subject: Installing PyGame? In-Reply-To: <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> References: <5c069831-8cab-43da-a4f9-ccec68cdc101@googlegroups.com> <44636430-af69-4162-adab-8f595da3cdd7@googlegroups.com> Message-ID: <51B3B57C.4020208@iinet.net.au> Eam onn: > ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find: > /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper This is saying that the version of Python you are using is a different architecture to the installed pygame library. This could be because you are using a 64-bit version of Python with a 32-bit library or vice-versa. Or you have a PowerPC library and Python is compiled for Intel processors. In Terminal, you can find the architecture of files with "otool -vh" followed by the file name. So try (on one line) otool -vh /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so And the same with Python, first finding where Python is with whereis python Then post all of the output text, not just your interpretation. Neil From malte.forkel at berlin.de Sat Jun 8 17:31:10 2013 From: malte.forkel at berlin.de (Malte Forkel) Date: Sat, 08 Jun 2013 23:31:10 +0200 Subject: Re-using copyrighted code Message-ID: Hello, I have written a small utility to locate errors in regular expressions that I want to upload to PyPI. Before I do that, I would like to learn a litte more about the legal aspects of open-source software. What would be a good introductory reading? Plus, I have one very specific question: In my package, I use modified code from sre_parse.py, which is part of the Python release. That file has the following header: # # Secret Labs' Regular Expression Engine # # convert re-style regular expression to sre pattern # # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # # See the sre.py file for information on usage and redistribution. # The referenced information is missing in the version of sre.py that comes with current versions of Python, but I found it in the archive http://effbot.org/media/downloads/sre-2.2.1.zip. It reads: # # Secret Labs' Regular Expression Engine # # re-compatible interface for the sre matching engine # # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # # This version of the SRE library can be redistributed under CNRI's # Python 1.6 license. For any other use, please contact Secret Labs # AB (info at pythonware.com). # # Portions of this engine have been developed in cooperation with # CNRI. Hewlett-Packard provided funding for 1.6 integration and # other compatibility work. # Now, how am I supposed to deal with that? Ask Secret Labs for some kind of permission? Leave it as it is and add my own copyright line? Malte From robotsondrugs at gmail.com Sat Jun 8 17:42:24 2013 From: robotsondrugs at gmail.com (Andrew Berg) Date: Sat, 08 Jun 2013 16:42:24 -0500 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: <51B3A540.4040600@gmail.com> On 2013.06.08 16:31, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory reading? The exact license terms. We might be able to help if you tell us which part(s) of the license you don't understand. There are some nice articles on many of the more common licenses on Wikipedia as well if you want a broader understanding. "Open-source" only implies that the source code is available. What one is allowed to actually do with the code will vary by project/author. > Now, how am I supposed to deal with that? Ask Secret Labs for some kind > of permission? Leave it as it is and add my own copyright line? If you can't find the license, I'd suggest sending an email to that address asking for a copy. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 From benjamin.kaplan at case.edu Sat Jun 8 18:09:53 2013 From: benjamin.kaplan at case.edu (Benjamin Kaplan) Date: Sat, 8 Jun 2013 15:09:53 -0700 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory reading? > > Plus, I have one very specific question: In my package, I use modified > code from sre_parse.py, which is part of the Python release. That file > has the following header: > > # > # Secret Labs' Regular Expression Engine > # > # convert re-style regular expression to sre pattern > # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. > # > # See the sre.py file for information on usage and redistribution. > # > > The referenced information is missing in the version of sre.py that > comes with current versions of Python, but I found it in the archive > http://effbot.org/media/downloads/sre-2.2.1.zip. It reads: > > # > # Secret Labs' Regular Expression Engine > # > # re-compatible interface for the sre matching engine > # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. > # > # This version of the SRE library can be redistributed under CNRI's > # Python 1.6 license. For any other use, please contact Secret Labs > # AB (info at pythonware.com). > # > # Portions of this engine have been developed in cooperation with > # CNRI. Hewlett-Packard provided funding for 1.6 integration and > # other compatibility work. > # > > Now, how am I supposed to deal with that? Ask Secret Labs for some kind > of permission? Leave it as it is and add my own copyright line? > > Malte > You can find the license terms for all versions of Python at http://docs.python.org/3/license.html I'm not a lawyer, but it looks like you just need to include the copyright statement. I'm not sure why the sre stuff is still licensed under the 1.6 license. Did no one get permission to distribute it under the PSF license, or did no one bother to rewrite the comment in the file? From robotsondrugs at gmail.com Sat Jun 8 18:36:08 2013 From: robotsondrugs at gmail.com (Andrew Berg) Date: Sat, 08 Jun 2013 17:36:08 -0500 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: <51B3B1D8.9000802@gmail.com> On 2013.06.08 17:09, Benjamin Kaplan wrote: > On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: >> # This version of the SRE library can be redistributed under CNRI's >> # Python 1.6 license. For any other use, please contact Secret Labs >> # AB (info at pythonware.com). >> # >> # Portions of this engine have been developed in cooperation with >> # CNRI. Hewlett-Packard provided funding for 1.6 integration and >> # other compatibility work. >> # >> >> Now, how am I supposed to deal with that? Ask Secret Labs for some kind >> of permission? Leave it as it is and add my own copyright line? >> >> Malte >> > > You can find the license terms for all versions of Python at > http://docs.python.org/3/license.html > I'm not a lawyer, but it looks like you just need to include the > copyright statement. I misread that bit, having forgotten that Python was not always under the PSF. To the OP: this is a pretty permissive license, but, as noted in the FAQ that Chris linked, there could be a problem if you wish to license your work under the GPL since the CNRI license specifies a jurisdiction. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 From rosuav at gmail.com Sat Jun 8 18:18:47 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 08:18:47 +1000 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Sun, Jun 9, 2013 at 7:31 AM, Malte Forkel wrote: > # This version of the SRE library can be redistributed under CNRI's > # Python 1.6 license. For any other use, please contact Secret Labs > # AB (info at pythonware.com). I presume that's referring to this: http://www.handle.net/python_licenses/python1.6_9-5-00.html http://www.python.org/download/releases/1.6/license_faq/ This is looking like a hairy mess. I would recommend seeking an alternative to this code that's under a simpler license. One unfortunate consequence of license proliferation is that it's harder for code to be reused. For your own code, please use one of the better-known licenses - MIT, GPL, etc - as it will make life ever so much easier for the next person! Alternatively, since this is something that's still in current Python releases (at least, that's how I understand your opening paragraphs), this could be something to take up with the Python dev/legal team. You may be able to use it under the terms of the modern Python license: http://docs.python.org/3.3/license.html But before you publish, I'd look for an authoritative answer from someone in the PSF (which may involve a source-file edit to update the license annotation). ChrisA From dreamingforward at gmail.com Sat Jun 8 19:11:56 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sat, 8 Jun 2013 16:11:56 -0700 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: I can't tell you as a lawyer, but I can tell you that regarding code for non-commercial use, the only supportable case is requiring fair-credit assignment. If reading the original license (which you are obligated to do if you re-use and re-distribute the code), it stipulates that you must re-share accordingly, then you should, otherwise there's very little case that could be brought about if the code was put into a published, "open-source" project, whatever the license. mark On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory reading? > > Plus, I have one very specific question: In my package, I use modified > code from sre_parse.py, which is part of the Python release. That file > has the following header: > > # > # Secret Labs' Regular Expression Engine > # > # convert re-style regular expression to sre pattern > # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. > # > # See the sre.py file for information on usage and redistribution. > # > > The referenced information is missing in the version of sre.py that > comes with current versions of Python, but I found it in the archive > http://effbot.org/media/downloads/sre-2.2.1.zip. It reads: > > # > # Secret Labs' Regular Expression Engine > # > # re-compatible interface for the sre matching engine > # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. > # > # This version of the SRE library can be redistributed under CNRI's > # Python 1.6 license. For any other use, please contact Secret Labs > # AB (info at pythonware.com). > # > # Portions of this engine have been developed in cooperation with > # CNRI. Hewlett-Packard provided funding for 1.6 integration and > # other compatibility work. > # > > Now, how am I supposed to deal with that? Ask Secret Labs for some kind > of permission? Leave it as it is and add my own copyright line? > > Malte > > -- > http://mail.python.org/mailman/listinfo/python-list -- MarkJ Tacoma, Washington From steve+comp.lang.python at pearwood.info Sun Jun 9 00:25:47 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 04:25:47 GMT Subject: Re-using copyrighted code References: Message-ID: <51b403ca$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sat, 08 Jun 2013 23:31:10 +0200, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory reading? *shrug* I don't know of any good introductory reading for software licences. But have you tried googling for information about open source software licences, copyright, infringement, fair use, etc.? You can also start here: http://opensource.org/licenses/ http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq http://shop.oreilly.com/product/9780596005818.do > Plus, I have one very specific question: In my package, I use modified > code from sre_parse.py, which is part of the Python release. That file > has the following header: > > # > # Secret Labs' Regular Expression Engine # > # convert re-style regular expression to sre pattern # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # > # See the sre.py file for information on usage and redistribution. # > > The referenced information is missing in the version of sre.py that > comes with current versions of Python, That's a bug then. It should be reported to the bug tracker. > but I found it in the archive > http://effbot.org/media/downloads/sre-2.2.1.zip. It reads: > > # > # Secret Labs' Regular Expression Engine # > # re-compatible interface for the sre matching engine # > # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # > # This version of the SRE library can be redistributed under CNRI's # > Python 1.6 license. For any other use, please contact Secret Labs # AB > (info at pythonware.com). > # > # Portions of this engine have been developed in cooperation with # > CNRI. Hewlett-Packard provided funding for 1.6 integration and # other > compatibility work. > # > > Now, how am I supposed to deal with that? Ask Secret Labs for some kind > of permission? Leave it as it is and add my own copyright line? Does Secret Labs even still exist? Try contacting them and see if they respond. I am not a lawyer, and I don't mean to imply that you should ignore or pay no attention to the existing licence, but I wouldn't sweat this too much. I expect that since the code is published under an open source licence, the intent is to allow you to re-use the code (provided you too use a compatible open source licence). That being the case, so long as you too keep the same intent, you won't get into trouble for minor licencing errors. The worst that may happen is that you'll be told to change your licence to match what it should be. (That's the beauty of the FOSS community -- so long as everyone works in good faith, minor errors in licencing are treated as bugs to be fixed, not infringements to pursue for profit.) Give credit to where you are copying the code from, and use a licence that is compatible. Don't try to give away rights that they don't give away, don't try to hold rights that they give away, and you're already 90% of the way there. And of course, it goes without saying, if in doubt, consult a lawyer with experience in software licensing and copyright, especially open source licensing. -- Steven From kw at codebykevin.com Sun Jun 9 09:32:10 2013 From: kw at codebykevin.com (Kevin Walzer) Date: Sun, 09 Jun 2013 09:32:10 -0400 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On 6/8/13 5:31 PM, Malte Forkel wrote: > Now, how am I supposed to deal with that? Ask Secret Labs for some kind > of permission? Leave it as it is and add my own copyright line? Secret Labs AB is Frederic Lundh, author of the Python Image Library and many bits included in Python's stdlib. Here is info about him: http://effbot.org/zone/about.htm His contact info is listed here: http://www.pythonware.com/company/contact.htm I have trouble believing there would be any issue with you re-using the code, especially since it is included with Python's stdlib. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com From malte.forkel at berlin.de Sun Jun 9 09:21:43 2013 From: malte.forkel at berlin.de (Malte Forkel) Date: Sun, 09 Jun 2013 15:21:43 +0200 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: I have asked the PSF for help regarding the implications of the license status of code from sre_parse.py and the missing license statement in sre.py. I'll happily report their answer to the list I they don't reply in this thread. At least partially, my confusion seems to be caused by the dichotomy of the concepts of copyright and license. How do these relate to each other? I understand that I have to pick a license for my package. And may be I'm not free to pick any open source license due the license used by Secret Labs AB. But how does that relate to the copyright statements? Should I put my own copyright line in every source file in the package? How about the file that re-uses portions of sre_parse.py? Can there or should there be two copyright lines in that file, one from Secret Labs, one my own? Malte From rosuav at gmail.com Sun Jun 9 09:43:54 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 9 Jun 2013 23:43:54 +1000 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Sun, Jun 9, 2013 at 11:21 PM, Malte Forkel wrote: > At least partially, my confusion seems to be caused by the dichotomy of > the concepts of copyright and license. How do these relate to each other? Ah, that one's easy enough to answer! When you create something, you own it. That is what copyright supports. A copyright line is a declaration "Hi, I created this, it's mine". (Copyright can be transferred, so the "I created this" part isn't always true, but the "it's mine" part is the point here.) Now, just as with anything else you own, you have the right to choose who uses it. I might say "This is my car, but I'll let you drive it on condition you return it with a full tank of fuel". I'm not allowed to put that sort of restriction on something that isn't mine, but because it's mine, I can. The same applies to copyright; "This is my software, but you're allowed to use it as long as you keep it free" (that's the gist of the GPL) or "This is my software; go ahead, use it, do what you like with it, only don't sue me" (the MIT license) are both granting permissions on the basis of ownership. Effectively, copyright is a declaration of a closed door, and the license specifically opens it again. With something that's completely unowned (aka "public domain"), nobody can place any restrictions on it; otherwise, it's up to the owner to set the rules. Fortunately for the open source world, lots and LOTS of owners are prepared to give fairly generous rules regarding the use of their material! When you make a significant change to something, you have copyright in the changes. Otherwise, copyright remains with the original holder, and you should acknowledge that. So if you take one entire source file and make little or no changes to it, and then you link that with source files of your own creation, your files would have your copyright notice, and sre_parse.py would have the original copyright notice (with an annotation indicating your changes, if you've made any - see clause 3 of the original license). Things are a little messier if it's hard to distinguish your code from the rest, but sometimes you'll see copyright/license blocks saying things like "This incorporates code from X and from Y and from Z", then follows up with their original copyright lines and license texts. tl;dr version: Copyright says "This is mine". License says "This is how you may use my stuff". ChrisA From rantingrickjohnson at gmail.com Sun Jun 9 11:10:13 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 9 Jun 2013 08:10:13 -0700 (PDT) Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Sunday, June 9, 2013 8:21:43 AM UTC-5, Malte Forkel wrote: > I have asked the PSF for help regarding the implications of the license > status of code from sre_parse.py and the missing license statement in > sre.py. I'll happily report their answer to the list I they don't reply > in this thread. HaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHa (deep breath...) HaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHa I can't say much with great certainty about the leadership of this community, but what i can say for sure is they are NOT going to waste one second of their so-called "precious" time responding to legitimate questions (like yours). The Secret Labs license is very explicit: "All rights reserved". That line means you can't touch it under pain of lawsuit. From rosuav at gmail.com Sun Jun 9 11:17:21 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 10 Jun 2013 01:17:21 +1000 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Mon, Jun 10, 2013 at 1:10 AM, Rick Johnson wrote: > On Sunday, June 9, 2013 8:21:43 AM UTC-5, Malte Forkel wrote: >> I have asked the PSF for help regarding the implications of the license >> status of code from sre_parse.py and the missing license statement in >> sre.py. I'll happily report their answer to the list I they don't reply >> in this thread. > > HaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHa (deep breath...) > > HaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHa > > I can't say much with great certainty about the leadership of this community, but what i can say for sure is they are NOT going to waste one second of their so-called "precious" time responding to legitimate questions (like yours). > > The Secret Labs license is very explicit: "All rights reserved". That line means you can't touch it under pain of lawsuit. Fortunately for all of us, Rick is a troll and not a lawyer. ChrisA From steve+comp.lang.python at pearwood.info Sun Jun 9 11:27:30 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 09 Jun 2013 15:27:30 GMT Subject: Re-using copyrighted code References: Message-ID: <51b49ee1$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 08:10:13 -0700, Rick Johnson wrote: > The Secret Labs license is very explicit: "All rights reserved". That > line means you can't touch it under pain of lawsuit. It's also very explicit that the code can be redistributed. However, there is no explicit rights to modification granted. -- Steven From dreamingforward at gmail.com Sun Jun 9 11:39:50 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 08:39:50 -0700 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: > The Secret Labs license is very explicit: "All rights reserved". That line means you can't touch it under pain of lawsuit. That's not true. It means whatever rights they do have, they are stating, in effect, that they have not given them away. But this is a difficult legal point, because by open sourcing their IP, they've already given away from of their rights. -- MarkJ Tacoma, Washington From rosuav at gmail.com Sun Jun 9 11:43:32 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 10 Jun 2013 01:43:32 +1000 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On Mon, Jun 10, 2013 at 1:39 AM, Mark Janssen wrote: >> The Secret Labs license is very explicit: "All rights reserved". That line means you can't touch it under pain of lawsuit. > > That's not true. It means whatever rights they do have, they are > stating, in effect, that they have not given them away. But this is a > difficult legal point, because by open sourcing their IP, they've > already given away from of their rights. They start by reserving all rights. Then they say "And you may use this, on these conditions". This is the normal order of things. The words "All rights reserved" don't actually add anything, now. (I'm given to understand they used to have significance, at least in some jurisdictions, but not any more.) So just "Copyright " is sufficient. ChrisA From dreamingforward at gmail.com Sun Jun 9 13:18:41 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 10:18:41 -0700 Subject: Re-using copyrighted code In-Reply-To: <51B450C1.5030506@berlin.de> References: <51B450C1.5030506@berlin.de> Message-ID: > At least partially, my confusion seems to be caused by the dichotomy of > the concepts of copyright and license. How do these relate to each other? A license emerges out of the commercial domain is purely about commercial protections. A copyright comes from the "academic" domain is pure about protecting your "intellectual property", or non-physical creations (most from encroachment of the commercial domain, by the way). They are on opposite ends of the spectrum, but because of our bi-polar system the terms get used as synonyms . In a way they are not related and it all depends on what court would listen to the case. In a German court, you would almost certainly be tried under the commercial framework, In the US, in theory (and this is where it must be pushed to enforce the people), it *should* be the opposite if the court is doing its job of upholding the Constitution. You use a license when you want to authorize use of something you own in a commercial setting. You use copyright when you're protecting authorship of something and have not given it away (something you never really want to do anyway). > I understand that I have to pick a license for my package. You actually do not. Attaching a legal document is purely a secondary protection from those who would take away right already granted by US copyright. > And may be > I'm not free to pick any open source license due the license used by > Secret Labs AB. But how does that relate to the copyright statements? The thing, like I noted, is that they've already released the code into the public eye. Now you must only do your due diligence to honor the *spirit* of their intent. And that spirit, regardless of whether they made it explicit, is almost certainly for non-commercial (non-profit) use. > Should I put my own copyright line in every source file in the package? I would put it as a separate file in the package as well as a comment line in each file referring to your file. > How about the file that re-uses portions of sre_parse.py? Can there or > should there be two copyright lines in that file, one from Secret Labs, > one my own? Show (c) YourName, Secret Labs and carry-forward any additional usage terms from them. -- MarkJ Tacoma, Washington From dreamingforward at gmail.com Sun Jun 9 13:22:40 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 10:22:40 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> Message-ID: >> At least partially, my confusion seems to be caused by the dichotomy of >> the concepts of copyright and license. How do these relate to each other? > > A license emerges out of the commercial domain is purely about > commercial protections. I should clarify, that "commercial protections" here means *money*, not other potentially legal assets. As soon as money is exchange you entangle yourself with their domain. Otherwise, as long as you give credit, you're really quite safe, from a Constitutional perspective. -- MarkJ Tacoma, Washington From rosuav at gmail.com Wed Jun 12 16:38:50 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 06:38:50 +1000 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> Message-ID: On Mon, Jun 10, 2013 at 3:22 AM, Mark Janssen wrote: >>> At least partially, my confusion seems to be caused by the dichotomy of >>> the concepts of copyright and license. How do these relate to each other? >> >> A license emerges out of the commercial domain is purely about >> commercial protections. > > I should clarify, that "commercial protections" here means *money*, > not other potentially legal assets. As soon as money is exchange you > entangle yourself with their domain. Otherwise, as long as you give > credit, you're really quite safe, from a Constitutional perspective. Can you quote something regarding this? Also, preferably, can you quote something international? Because this is an international list, and an international problem. There is nothing America-specific about it. ChrisA From torriem at gmail.com Sun Jun 9 15:50:58 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 09 Jun 2013 13:50:58 -0600 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> Message-ID: <51B4DCA2.9000903@gmail.com> On 06/09/2013 11:18 AM, Mark Janssen wrote: >> I understand that I have to pick a license for my package. > > You actually do not. Attaching a legal document is purely a secondary > protection from those who would take away right already granted by US > copyright. You are correct, except that the OP has already stated he wishes to have his code distributed. Without granting a license, the code cannot be distributed beyond the people he personally gives the code too. PyPi cannot legally allow others to download it without a license. Here's how the GPL puts it, and of course this applies to any and all licenses, even proprietary ones: "However, nothing else [besides the License] grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying..." From dreamingforward at gmail.com Sun Jun 9 16:32:00 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 13:32:00 -0700 Subject: Re-using copyrighted code In-Reply-To: <51B4DCA2.9000903@gmail.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: > On 06/09/2013 11:18 AM, Mark Janssen wrote: >> You actually do not. Attaching a legal document is purely a secondary >> protection from those who would take away right already granted by US >> copyright. > > You are correct, except that the OP has already stated he wishes to have > his code distributed. Without granting a license, the code cannot be > distributed beyond the people he personally gives the code too. PyPi > cannot legally allow others to download it without a license. That's not entirely correct. If he *publishes* his code (I'm using this term "publish" technically to mean "put forth in a way where anyone of the general public can or is encouraged to view"), then he is *tacitly* giving up protections that secrecy (or *not* disclosing it) would *automatically* grant. The only preserved right is authorship after that. So it can be re-distributed freely, if authorship is preserved. The only issue after that is "fair use" and that includes running the program (not merely copying the source). Re-selling for money violates fair-use, as does redistribution without preserving credit assignment (unless they've naively waived those rights away). I will have to take a look at PyPi. But if you are *publishing*, there's no court which can protect your IP afterwards from redistribution, unless you explicitly *restrict* it. In which case, if you restrict terms of re-use, you're putting the court in jeopardy because you making two actions opposed to one another. The only thing the court can easily uphold is your authorship and non-exploitation from a violation of fair-use (note again the key word is "use", nor merely copying the code). But then if you waive *that* right away, you put the court in jeopardy again. > Here's how the GPL puts it, and of course this applies to any and all > licenses, even proprietary ones: > > "However, nothing else [besides the License] grants you permission to > modify or distribute the Program or its derivative works. These actions > are prohibited by law if you do not accept this License. Therefore, by > modifying or distributing the Program (or any work based on the > Program), you indicate your acceptance of this License to do so, and all > its terms and conditions for copying..." Well this is where one must make a distinction with fair-use -- if I re-publish my modifications then the code is still subject to the terms by the original author. If I make a copy for myself and run the problem for personal, non-commercial use, then I am in the domain of fair use and have no other obligations. -- MarkJ Tacoma, Washington From fabiosantosart at gmail.com Sun Jun 9 16:43:09 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sun, 9 Jun 2013 21:43:09 +0100 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: On 9 Jun 2013 21:39, "Mark Janssen" wrote: > > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: > > On 06/09/2013 11:18 AM, Mark Janssen wrote: > >> You actually do not. Attaching a legal document is purely a secondary > >> protection from those who would take away right already granted by US > >> copyright. > > > > You are correct, except that the OP has already stated he wishes to have > > his code distributed. Without granting a license, the code cannot be > > distributed beyond the people he personally gives the code too. PyPi > > cannot legally allow others to download it without a license. > > That's not entirely correct. If he *publishes* his code (I'm using > this term "publish" technically to mean "put forth in a way where > anyone of the general public can or is encouraged to view"), then he > is *tacitly* giving up protections that secrecy (or *not* disclosing > it) would *automatically* grant. The only preserved right is > authorship after that. So it can be re-distributed freely, if > authorship is preserved. The only issue after that is "fair use" and > that includes running the program (not merely copying the source). > > Re-selling for money violates fair-use, as does redistribution without > preserving credit assignment (unless they've naively waived those > rights away). I will have to take a look at PyPi. But if you are > *publishing*, there's no court which can protect your IP afterwards > from redistribution, unless you explicitly *restrict* it. In which > case, if you restrict terms of re-use, you're putting the court in > jeopardy because you making two actions opposed to one another. The > only thing the court can easily uphold is your authorship and > non-exploitation from a violation of fair-use (note again the key word > is "use", nor merely copying the code). But then if you waive *that* > right away, you put the court in jeopardy again. > > > Here's how the GPL puts it, and of course this applies to any and all > > licenses, even proprietary ones: > > > > "However, nothing else [besides the License] grants you permission to > > modify or distribute the Program or its derivative works. These actions > > are prohibited by law if you do not accept this License. Therefore, by > > modifying or distributing the Program (or any work based on the > > Program), you indicate your acceptance of this License to do so, and all > > its terms and conditions for copying..." > > Well this is where one must make a distinction with fair-use -- if I > re-publish my modifications then the code is still subject to the > terms by the original author. If I make a copy for myself and run the > problem for personal, non-commercial use, then I am in the domain of > fair use and have no other obligations. > This sort of complicated stuff is why I love the wtfpl. If it's free software, it's free to use, distribute and modify, not free under a huge amount of terms. -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin.kaplan at case.edu Sun Jun 9 16:48:57 2013 From: benjamin.kaplan at case.edu (Benjamin Kaplan) Date: Sun, 9 Jun 2013 13:48:57 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: On Sun, Jun 9, 2013 at 1:32 PM, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already granted by US >>> copyright. >> >> You are correct, except that the OP has already stated he wishes to have >> his code distributed. Without granting a license, the code cannot be >> distributed beyond the people he personally gives the code too. PyPi >> cannot legally allow others to download it without a license. > > That's not entirely correct. If he *publishes* his code (I'm using > this term "publish" technically to mean "put forth in a way where > anyone of the general public can or is encouraged to view"), then he > is *tacitly* giving up protections that secrecy (or *not* disclosing > it) would *automatically* grant. The only preserved right is > authorship after that. So it can be re-distributed freely, if > authorship is preserved. The only issue after that is "fair use" and > that includes running the program (not merely copying the source). > No, the original author retains all rights except those explicitly granted. The same way that obtaining the "source" to a song does not give you the right to redistribute the song all you want. > Re-selling for money violates fair-use, as does redistribution without > preserving credit assignment (unless they've naively waived those > rights away). I will have to take a look at PyPi. But if you are > *publishing*, there's no court which can protect your IP afterwards > from redistribution, unless you explicitly *restrict* it. In which > case, if you restrict terms of re-use, you're putting the court in > jeopardy because you making two actions opposed to one another. The > only thing the court can easily uphold is your authorship and > non-exploitation from a violation of fair-use (note again the key word > is "use", nor merely copying the code). But then if you waive *that* > right away, you put the court in jeopardy again. > Fair use has nothing to do with money. It depends on how the work is used and how you've changed it. Weird Al's song parodies are fair use, even though he sells them. You distributing copies of a commercial software to everyone is not fair use, even though you aren't making money. >> Here's how the GPL puts it, and of course this applies to any and all >> licenses, even proprietary ones: >> >> "However, nothing else [besides the License] grants you permission to >> modify or distribute the Program or its derivative works. These actions >> are prohibited by law if you do not accept this License. Therefore, by >> modifying or distributing the Program (or any work based on the >> Program), you indicate your acceptance of this License to do so, and all >> its terms and conditions for copying..." > > Well this is where one must make a distinction with fair-use -- if I > re-publish my modifications then the code is still subject to the > terms by the original author. If I make a copy for myself and run the > problem for personal, non-commercial use, then I am in the domain of > fair use and have no other obligations. > Again, no. The GPL does not restrict your rights when running on machines you control, but that's just because of the terms of the license. Most commercial licenses include terms like "no reverse engineering the software" that have nothing to do with distribution. From dreamingforward at gmail.com Sun Jun 9 17:08:54 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 14:08:54 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: >> That's not entirely correct. If he *publishes* his code (I'm using >> this term "publish" technically to mean "put forth in a way where >> anyone of the general public can or is encouraged to view"), then he >> is *tacitly* giving up protections that secrecy (or *not* disclosing >> it) would *automatically* grant. The only preserved right is >> authorship after that. So it can be re-distributed freely, if >> authorship is preserved. The only issue after that is "fair use" and >> that includes running the program (not merely copying the source). > > No, the original author retains all rights except those explicitly > granted. The same way that obtaining the "source" to a song does not > give you the right to redistribute the song all you want. No, you are right only by the *word* of the law, but you have not included the authors *actions*. A court has to include both. He explicitly did not *retain* his rights when he *published* his code. There is not word of law that is necessary when his actions have already done the deed (unless under coercion, of course). > Fair use has nothing to do with money. It depends on how the work is > used and how you've changed it. Weird Al's song parodies are fair use, > even though he sells them. That can't really be claimed without a case being brought against him. Michael Jackson, for example, probably could have made a case against WierdAl, but did not -- that does not automatically mean that WierdAl's use was fair-use in the slightest. In fact, it probably was not, but MJ made enough money that he probably also didn't want to the PR loss. > You distributing copies of a commercial > software to everyone is not fair use, even though you aren't making > money. It *is* absolutely fair use, if that commercial software *published* their code (in the definition I gave earlier). If you stole the code off their protected servers, it is not fair use. >> Well this is where one must make a distinction with fair-use -- if I >> re-publish my modifications then the code is still subject to the >> terms by the original author. If I make a copy for myself and run the >> problem for personal, non-commercial use, then I am in the domain of >> fair use and have no other obligations. > > Again, no. The GPL does not restrict your rights when running on > machines you control, but that's just because of the terms of the > license. Most commercial licenses include terms like "no reverse > engineering the software" that have nothing to do with distribution. Close-source software could automatically be considered "protected", but that is only out of kindness. Publishing software, even closed-source software opens a company to some level reverse-engineering by the nature of computers and by the fact that the techniques of turning machine code into assembly are well known. So they explicitly state that they do not give permission to do so, yet this is not worth much of anything except for the fact that most people are intimidated to go against a large software company to argue their rights. Apparently these companies have already seen this loophole and have made things like DRM to put a legalistic container around what would otherwise be de facto published (machine) code. But this is not a legit workaround either and companies have essentially stealing from the intellectual and creative communities. There is no legitimate argument against a personal user figuring out how software works for personal use. If they don't want people to "figure it out", they'll have to open stores where people can run their special software on machines that are under their control. I'm sorry, this is just the way it is -- everyone's just gone along with the program tacitly because they get intimidated by the legal system. But the law is for people, not for lawyers. -- MarkJ Tacoma, Washington From rantingrickjohnson at gmail.com Sun Jun 9 21:17:27 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 9 Jun 2013 18:17:27 -0700 (PDT) Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <89e9d149-ca89-47d2-bf5d-40489d48b781@googlegroups.com> On Sunday, June 9, 2013 4:08:54 PM UTC-5, zipher wrote: > >> That's not entirely correct. If he *publishes* his code (I'm using > > >> this term "publish" technically to mean "put forth in a way where > > >> anyone of the general public can or is encouraged to view"), then he > > >> is *tacitly* giving up protections that secrecy (or *not* disclosing > > >> it) would *automatically* grant. The only preserved right is > > >> authorship after that. So it can be re-distributed freely, if > > >> authorship is preserved. The only issue after that is "fair use" and > > >> that includes running the program (not merely copying the source). > > > > > > No, the original author retains all rights except those explicitly > > > granted. The same way that obtaining the "source" to a song does not > > > give you the right to redistribute the song all you want. > > > > No, you are right only by the *word* of the law, but you have not > > included the authors *actions*. A court has to include both. > > > > He explicitly did not *retain* his rights when he *published* his > > code. There is not word of law that is necessary when his actions > > have already done the deed (unless under coercion, of course). > > > > > Fair use has nothing to do with money. It depends on how the work is > > > used and how you've changed it. Weird Al's song parodies are fair use, > > > even though he sells them. > > > > That can't really be claimed without a case being brought against him. > > Michael Jackson, for example, probably could have made a case against > > WierdAl, but did not -- that does not automatically mean that > > WierdAl's use was fair-use in the slightest. In fact, it probably was > > not, but MJ made enough money that he probably also didn't want to the > > PR loss. > > > > > You distributing copies of a commercial > > > software to everyone is not fair use, even though you aren't making > > > money. > > > > It *is* absolutely fair use, if that commercial software *published* > > their code (in the definition I gave earlier). If you stole the code > > off their protected servers, it is not fair use. > > > > >> Well this is where one must make a distinction with fair-use -- if I > > >> re-publish my modifications then the code is still subject to the > > >> terms by the original author. If I make a copy for myself and run the > > >> problem for personal, non-commercial use, then I am in the domain of > > >> fair use and have no other obligations. > > > > > > Again, no. The GPL does not restrict your rights when running on > > > machines you control, but that's just because of the terms of the > > > license. Most commercial licenses include terms like "no reverse > > > engineering the software" that have nothing to do with distribution. > > > > Close-source software could automatically be considered "protected", > > but that is only out of kindness. Publishing software, even > > closed-source software opens a company to some level > > reverse-engineering by the nature of computers and by the fact that > > the techniques of turning machine code into assembly are well known. > > So they explicitly state that they do not give permission to do so, > > yet this is not worth much of anything except for the fact that most > > people are intimidated to go against a large software company to argue > > their rights. > > > > Apparently these companies have already seen this loophole and have > > made things like DRM to put a legalistic container around what would > > otherwise be de facto published (machine) code. But this is not a > > legit workaround either and companies have essentially stealing from > > the intellectual and creative communities. > > > > There is no legitimate argument against a personal user figuring out > > how software works for personal use. If they don't want people to > > "figure it out", they'll have to open stores where people can run > > their special software on machines that are under their control. > > > > I'm sorry, this is just the way it is -- everyone's just gone along > > with the program tacitly because they get intimidated by the legal > > system. But the law is for people, not for lawyers. Preach on my brother, Preach on! It's amazing how much control you can leverage on the populace of lemmings from a few well placed tv ads and some OP-ED propaganda. From steve+comp.lang.python at pearwood.info Mon Jun 10 01:31:43 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 10 Jun 2013 05:31:43 GMT Subject: Re-using copyrighted code References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <51b564be$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 14:08:54 -0700, Mark Janssen wrote: > I'm sorry, this is just the way it is -- everyone's just gone along with > the program tacitly because they get intimidated by the legal system. Your definition of "just the way it is" does not agree with mine. You're describing how you *want* copyright law to be, rather than how it actually is. I've noticed something abut the difference between progressives and liberals, compared to a particular type of American conservative. You know the ones -- they're big on states rights, "Don't Tread On Me" bravado, repealing income tax, guns, god, and the right to refuse service to anyone they like. (And they never, ever, not in a million years, imagine *themselves* as the one being discriminated against.) When progressives and liberals find a law they don't like, they invariable argue that the law is unjust or unfair, or even illegal, and that it should be repealed or fixed. They say things like "repeatedly extending copyright terms retroactively goes against the stated purpose of copyright, it is harmful to society as a whole, and we should stop doing it every time Mickey Mouse is about to enter the public domain". Or they say, "Fair use is important, and the courts ought to strengthen it rather than continuing to weaken it as they have been." In other words, they distinguish between how things *are* and how they *should be*. This particular subset of American conservatives, on the other hand, argue differently when they find a law they don't like. Rather than say that copyright terms *ought to be* for 28 years, like in the good old days before Disney bought the United States Congress, they say things like "copyright lasts for 28 years, don't let the courts intimidate you into believing differently". Rather than say that fair use *should* allow you to make a copy for personal use, they say things like "fair use lets you make a copy of anything for personal use, that's just the way it is, if you think different you've been intimidated". It's a fascinating difference. On the one hand, their recognition that ultimately all laws and rights boil down to the question of who is best at imposing their will via the application of force is refreshingly realistic; on the other hand their need to explicitly refer to it as often as they do is rather worrying. So, coming back to reality, copyright law, as it is enforced (when you come down to it) by men and women with big guns, does not allow you to make personal copies of anything you like as "fair use". The precise details of fair use differ from country to country, but generally fair use allows you to make a copy of a *small* portion of a work, for the purposes of (e.g.) academic commentary, reviews, parody or criticism. Transformative fair use (e.g. remixing and sampling) is often right on the edge, and therefore legally risky. E.g. even if taking a small sample of a song and inserting it into your own music falls under fair use, in practice the courts usually side with whoever brings the most lawyers, so it is cheaper to just pay a licence fee up front. Personally, I think that's terrible, but that's the way it is at this moment in history. Of course, in practice copyright law is not always enforced. Many people have created mix tapes of songs recorded from the radio, which is as clear a case of copyright infringement as there is, but very few of them have been sued. The internet is full of people torrenting movies and TV shows, and only a tiny proportion have been sued, but those that have often lose an exorbitant amount compared to the actual economic harm committed. Ripping a CD to your iPod is strictly illegal in most countries, but unlikely to be pursued; ripping a CD and then selling copies of the mp3 over the Internet will likely have the police come knocking unless you're in a part of the world that doesn't recognise or enforce copyright. So there is often a difference between what the law says and what the law actually enforces. But bringing it back to the original topic, I believe that the philosophy of FOSS is that we should try our best to honour the intentions of the writer, not to find some legal loophole that permits us to copy his or her work against their wishes. -- Steven From malte.forkel at berlin.de Mon Jun 10 02:42:07 2013 From: malte.forkel at berlin.de (Malte Forkel) Date: Mon, 10 Jun 2013 08:42:07 +0200 Subject: Re-using copyrighted code In-Reply-To: <51b564be$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b564be$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: Am 10.06.2013 07:31, schrieb Steven D'Aprano: > > But bringing it back to the original topic, I believe that the philosophy > of FOSS is that we should try our best to honour the intentions of the > writer, not to find some legal loophole that permits us to copy his or > her work against their wishes. > Woh! I didn't expect my naive question to trigger that kind of discussion. Thanks to all of you. While I'm grateful for all the input, I have to admit I still don't really know what to do yet. In addition to asking the PSF, I've written to PythonWare (formerly Secret Labs) about their point of view. I'll report their responses. Had I known in the beginning how convoluted things would become, I might have considered two other options: Just publish or keep the code to myself. But I still think, first understanding the legal aspects and then publishing (to give back at least a little) is the way to go. I certainly hope that there is no software out thre that didn't get released to the public because its author found the legal implications to difficult to handle. So there should exist some simple guidelines to help people like me to prepare themselves and their code for that step. Unfortenately, I just haven't discovered them. At least for the Python universe, PyPI would be a good place to setup a page or link to that kind of information. Or is it there already and I have simply overlooked it? Malte From rosuav at gmail.com Mon Jun 10 03:17:34 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 10 Jun 2013 17:17:34 +1000 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b564be$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Mon, Jun 10, 2013 at 4:42 PM, Malte Forkel wrote: > Had I known in the beginning how convoluted things would become, I might > have considered two other options: Just publish or keep the code to > myself. But I still think, first understanding the legal aspects and > then publishing (to give back at least a little) is the way to go. > > I certainly hope that there is no software out thre that didn't get > released to the public because its author found the legal implications > to difficult to handle. Understanding is good :) Unfortunately there will be heaps of software that didn't get released owing to potential legal messes. It's a loss that could be partially avoided in future by authors sticking to the well-known licenses; it's easy to make a derivative work based on three or four different components if they all use the same license. I've seen issues all over the place stemming from GNU Readline (which is GPL, not LGPL) and something not GPL-compat being both linked to the same application; and it's so likely as to be practically certain that there have been things left unreleased because of that. ChrisA From steve+comp.lang.python at pearwood.info Mon Jun 10 22:48:37 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 11 Jun 2013 02:48:37 GMT Subject: Re-using copyrighted code References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b564be$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b69005$0$29997$c3e8da3$5496439d@news.astraweb.com> On Mon, 10 Jun 2013 08:42:07 +0200, Malte Forkel wrote: > Am 10.06.2013 07:31, schrieb Steven D'Aprano: >> >> But bringing it back to the original topic, I believe that the >> philosophy of FOSS is that we should try our best to honour the >> intentions of the writer, not to find some legal loophole that permits >> us to copy his or her work against their wishes. >> >> > Woh! I didn't expect my naive question to trigger that kind of > discussion. Thanks to all of you. While I'm grateful for all the input, > I have to admit I still don't really know what to do yet. > > In addition to asking the PSF, I've written to PythonWare (formerly > Secret Labs) about their point of view. I'll report their responses. In my opinion, this is the right thing to do. And thank you in advance for coming back with their responses, if any. [...] > Had I known in the beginning how convoluted things would become, I might > I certainly hope that there is no software out thre that didn't get > released to the public because its author found the legal implications > to difficult to handle. Of course there is. That's the cost of having copyright in the first place. Since people can "own" particular chunks of code, or pieces of text, there is always the risk that a chunk of code you have written, or piece of text, happens to be similar enough to someone else's that you are infringing on their copyright. (One of the most egregious abuses of copyright, in my opinon: http://tuxdeluxe.org/node/88 Well, actually, there are probably far worse abuses. Men At Work's "Down Under" being judged as infringing the Kookaburra children's song is worse, since the pieces are as different as it is possible for music to be. But the above is one of the funniest egregious abuses of copyright.) But the trade-off is the hope that by granting monopoly privileges to the author, more people will be encouraged to create who otherwise wouldn't have, than people will be discouraged. (Interesting, as much as "the promotion of arts and sciences" has been the stated aim of copyright for a couple of centuries now[1], there's no actual evidence that it does.) [1] But not all the way back to the first ever copyright law, which was out-and-out a bribe to printers from the British Crown: "don't print anything we don't like, and we'll enforce your monopoly to print". -- Steven From llanitedave at veawb.coop Mon Jun 10 12:29:06 2013 From: llanitedave at veawb.coop (llanitedave) Date: Mon, 10 Jun 2013 09:29:06 -0700 (PDT) Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> On Sunday, June 9, 2013 2:08:54 PM UTC-7, zipher wrote: > > > > Fair use has nothing to do with money. It depends on how the work is > > > used and how you've changed it. Weird Al's song parodies are fair use, > > > even though he sells them. > > > > That can't really be claimed without a case being brought against him. > > Michael Jackson, for example, probably could have made a case against > > WierdAl, but did not -- that does not automatically mean that > > WierdAl's use was fair-use in the slightest. In fact, it probably was > > not, but MJ made enough money that he probably also didn't want to the > > PR loss. > > > Weird Al can be a complex case, because sometimes his songs are true parodies, and sometimes they're more satires. Parody has a pretty firm history of being protected under fair use, and Weird Al's MJ-inspired songs ("Fat" and "Eat It") are clearly parodies. (As is his more recent Lady Gaga sendup "Perform This Way", while his Star wars saga "The Story Begins" and Coolio-esque "Amish Paradise" are more like satires). So in the case of Weird Al's Michael Jackson parodies, he would be protected under law if MJ had decided to sue. However, there's another reason that Weird Al's "victims" never file a suit. First, he always gets permission from them BEFORE publishing a song. Second, the objects of his skewering usually like the fact that they've been noticed by him. Madonna actually suggested the idea of "Like a Surgeon", and when he did "Smells Like Nirvana", the group felt like they'd finally made it. This is all kind of OT, of course, except to point out that fair use is not as straightforward as it might seem, but neither is prohibition of reuse. However, I have yet to see an example of source code that qualifies as either parody or satire under any standard. From joshua.landau.ws at gmail.com Mon Jun 10 15:32:03 2013 From: joshua.landau.ws at gmail.com (Joshua Landau) Date: Mon, 10 Jun 2013 20:32:03 +0100 Subject: Re-using copyrighted code In-Reply-To: <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> Message-ID: On 10 June 2013 17:29, llanitedave wrote: > However, I have yet to see an example of source code that qualifies as either parody or satire under any standard. You should try reading Perl. From dreamingforward at gmail.com Mon Jun 10 15:40:57 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Mon, 10 Jun 2013 12:40:57 -0700 Subject: Re-using copyrighted code In-Reply-To: <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> Message-ID: > Weird Al can be a complex case, because sometimes his songs are true parodies, and sometimes they're more satires. Parody has a pretty firm history of being protected under fair use, and Weird Al's MJ-inspired songs ("Fat" and "Eat It") are clearly parodies. (As is his more recent Lady Gaga sendup "Perform This Way", while his Star wars saga "The Story Begins" and Coolio-esque "Amish Paradise" are more like satires). > > So in the case of Weird Al's Michael Jackson parodies, he would be protected under law if MJ had decided to sue. Not entirely. The use of the musical tune is not a parody, only the lyrics. But if, like you say, he did get permission, then he is safe. But you bring up a point of *criticism* which is distinct from re-use. -- MarkJ Tacoma, Washington From rosuav at gmail.com Mon Jun 10 16:09:10 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 11 Jun 2013 06:09:10 +1000 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> Message-ID: On Tue, Jun 11, 2013 at 5:40 AM, Mark Janssen wrote: >> Weird Al can be a complex case, because sometimes his songs are true parodies, and sometimes they're more satires. Parody has a pretty firm history of being protected under fair use, and Weird Al's MJ-inspired songs ("Fat" and "Eat It") are clearly parodies. (As is his more recent Lady Gaga sendup "Perform This Way", while his Star wars saga "The Story Begins" and Coolio-esque "Amish Paradise" are more like satires). >> >> So in the case of Weird Al's Michael Jackson parodies, he would be protected under law if MJ had decided to sue. > > Not entirely. The use of the musical tune is not a parody, only the > lyrics. But if, like you say, he did get permission, then he is safe. Citing once again Gilbert and Sullivan, it's definitely possible for a tune to be a parody. Compare "Poor Wand'ring One" from G&S's Pirates of Penzance with "Sempre Libera" from Verdi's La Traviata - the former is most definitely a parody of the latter. (And the song name is reminiscent of the opera name, too.) There are other parodies in Gilbert and Sullivan, of both lyrical and musical forms; sometimes both, like when a set of warriors take off their armor before a fight, set to music similar to that used in Handel's works for warriors *putting on* armor. There's plenty of room to make direct or indirect references in music. Sometimes all it takes is a bar or two, and everyone knows what you're parodying. That's even tighter than words! ChrisA From llanitedave at veawb.coop Mon Jun 10 16:36:46 2013 From: llanitedave at veawb.coop (llanitedave) Date: Mon, 10 Jun 2013 13:36:46 -0700 (PDT) Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <4704188c-ae1c-44f2-87b1-e1001f52ef4d@googlegroups.com> Message-ID: <468ac446-bbf1-4ace-a4cb-e692991b9199@googlegroups.com> On Monday, June 10, 2013 12:40:57 PM UTC-7, zipher wrote: > > Weird Al can be a complex case, because sometimes his songs are true parodies, and sometimes they're more satires. Parody has a pretty firm history of being protected under fair use, and Weird Al's MJ-inspired songs ("Fat" and "Eat It") are clearly parodies. (As is his more recent Lady Gaga sendup "Perform This Way", while his Star wars saga "The Story Begins" and Coolio-esque "Amish Paradise" are more like satires). > > > > > > So in the case of Weird Al's Michael Jackson parodies, he would be protected under law if MJ had decided to sue. > > > > Not entirely. The use of the musical tune is not a parody, only the > > lyrics. But if, like you say, he did get permission, then he is safe. > > > > But you bring up a point of *criticism* which is distinct from re-use. > > -- > > MarkJ > > Tacoma, Washington In this case, the tune and the lyrics really aren't separable. What's being parodied is the entire work, including the music video, down to the costumes, the dance moves, and the guitar solo. It's the work, taken as a whole. From rosuav at gmail.com Sun Jun 9 18:07:57 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 10 Jun 2013 08:07:57 +1000 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen wrote: > That's not entirely correct. If he *publishes* his code (I'm using > this term "publish" technically to mean "put forth in a way where > anyone of the general public can or is encouraged to view"), then he > is *tacitly* giving up protections that secrecy (or *not* disclosing > it) would *automatically* grant. The only preserved right is > authorship after that. So it can be re-distributed freely, if > authorship is preserved. The only issue after that is "fair use" and > that includes running the program (not merely copying the source). (Digression follows.) That was true back in the late 1800s in the US, but was not true in England at that time, and was solved in a unification of copyright laws and treaties. There was a huge issue over the copyright of the opera "HMS Pinafore" (by Gilbert and Sullivan - one of my other loves), and according to US law at the time, the publication (in this case, public performance, along with the public sale of libretti (books of the words) and some sheet music) of the work voided the authors' claim to ownership. There was no recourse against the myriad knock-off Pinafores. When the D'Oyly Carte Opera Company produced their subsequent operas, they tried a variety of techniques to secure international copyright, with limited (in many cases VERY limited) success. It wasn't till the late 20th century that the US finally signed into the international agreements that mean that we can depend on copyright protection world-wide. But we can, now. And the protection is still there even once something has been published. In fact, copyright protection still applies to works that don't have a "Copyright " citation, though it's harder to prove then, and the lawyers would have fun with it. It's safe to assume that anything you find on the internet *is* subject to copyright, unless you have good reason to believe otherwise. Came across a nice little history of copyright here: http://www.edwardsamuels.com/illustratedstory/isc10.htm Or if you're curious about how copyright applied to the works of Gilbert and Sullivan, join Savoynet - http://savoynet.oakapplepress.com/ - and ask. There are plenty of experts around. In any case, that's all ancient history now. Unless someone can cite a jurisdiction that still maintains that publication relinquishes all rights of ownership, I would assume that things remain in copyright. ChrisA From dreamingforward at gmail.com Sun Jun 9 19:39:13 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 16:39:13 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: > (Digression follows.) ...(by Gilbert and > Sullivan - one of my other loves), and according to US law at the > time, the publication (in this case, public performance, along with > the public sale of libretti (books of the words) and some sheet music) > of the work voided the authors' claim to ownership. > Came across a nice little history of copyright here: > http://www.edwardsamuels.com/illustratedstory/isc10.htm > Or if you're curious about how copyright applied to the works of > Gilbert and Sullivan, join Savoynet - > http://savoynet.oakapplepress.com/ - and ask. There are plenty of > experts around. Thank you for that reference. > In any case, that's all ancient history now. Unless someone can cite a > jurisdiction that still maintains that publication relinquishes all > rights of ownership, I would assume that things remain in copyright. My apologies, if any of my writing wasn't clear. By no means did I wish to suggest that publication relinquishes copyright -- only that the author's actions eliminate some natural protections afforded by non-publication. This is just common sense. If I'm a game developer and release my game to the public, I expose it to some risk -- that just the trade-off of getting noticed. FairUse explicitly allows others to derive works from yours and you're going to have to accept that to some degree, but copyright requires that they give you credit and if they make money from your work you may be due proceeds. But here is where Lawrence Lessig is way ahead of the crowd. FairUse should mean "ShareAlike". -- MarkJ Tacoma, Washington From steve+comp.lang.python at pearwood.info Sun Jun 9 20:34:01 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 10 Jun 2013 00:34:01 GMT Subject: Re-using copyrighted code References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <51b51ef9$0$30001$c3e8da3$5496439d@news.astraweb.com> On Mon, 10 Jun 2013 08:07:57 +1000, Chris Angelico wrote: > On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen > wrote: >> That's not entirely correct. If he *publishes* his code (I'm using >> this term "publish" technically to mean "put forth in a way where >> anyone of the general public can or is encouraged to view"), then he is >> *tacitly* giving up protections that secrecy (or *not* disclosing it) >> would *automatically* grant. The only preserved right is authorship >> after that. So it can be re-distributed freely, if authorship is >> preserved. The only issue after that is "fair use" and that includes >> running the program (not merely copying the source). > > (Digression follows.) That was true back in the late 1800s in the US, > but was not true in England at that time, and was solved in a > unification of copyright laws and treaties. There was a huge issue over > the copyright of the opera "HMS Pinafore" No, it was not true. Mark is saying that publishing a work automatically revokes all the privileges granted by copyright, which is ridiculous. There has never been a time where copyright only applies to secret works that aren't published. The HMS Pinafore issue -- and similarly for the works of Mark Twain, and any other British author who had work published in the US -- was that their copyright in Britain was not recognised, or legally enforceable, in the USA. -- Steven From rosuav at gmail.com Sun Jun 9 23:31:36 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 10 Jun 2013 13:31:36 +1000 Subject: Re-using copyrighted code In-Reply-To: <51b51ef9$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51ef9$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Mon, Jun 10, 2013 at 10:34 AM, Steven D'Aprano wrote: > On Mon, 10 Jun 2013 08:07:57 +1000, Chris Angelico wrote: > >> On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen >> wrote: >>> That's not entirely correct. If he *publishes* his code (I'm using >>> this term "publish" technically to mean "put forth in a way where >>> anyone of the general public can or is encouraged to view"), then he is >>> *tacitly* giving up protections that secrecy (or *not* disclosing it) >>> would *automatically* grant. The only preserved right is authorship >>> after that. So it can be re-distributed freely, if authorship is >>> preserved. The only issue after that is "fair use" and that includes >>> running the program (not merely copying the source). >> >> (Digression follows.) That was true back in the late 1800s in the US, >> but was not true in England at that time, and was solved in a >> unification of copyright laws and treaties. There was a huge issue over >> the copyright of the opera "HMS Pinafore" > > No, it was not true. Mark is saying that publishing a work automatically > revokes all the privileges granted by copyright, which is ridiculous. > There has never been a time where copyright only applies to secret works > that aren't published. > > The HMS Pinafore issue -- and similarly for the works of Mark Twain, and > any other British author who had work published in the US -- was that > their copyright in Britain was not recognised, or legally enforceable, in > the USA. It was partly that, but there were also aspects of "you've published the vocal score, ergo you can't claim copyright on the opera". This, incidentally, ignored the fact that the *orchestrations* are a huge part of the quality of the show (you can't just take the piano/vocal reduction and perfectly recreate the magnificent sound of the orchestra), but the courts can't be expected to be artistic! Granted, IANAL, but the scholarly article I linked to above refers to several of the same issues. I don't know about publication revoking *all rights*, but there was definitely an understanding by the court that publication meant a reduction of copyright claim. ChrisA From dreamingforward at gmail.com Sun Jun 9 23:40:43 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 20:40:43 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51ef9$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: > Granted, IANAL, but the scholarly article I linked to above refers to > several of the same issues. I don't know about publication revoking > *all rights*, but there was definitely an understanding by the court > that publication meant a reduction of copyright claim. Again, I don't think I said that publication revokes "all rights", but it certainly opens the can of worms that wouldn't have been open had you kept it to yourself. So while it *exposes you*, it does not still *deprive you of rights*. That is what copyright is for: to protect you after you've exposed yourself. -- MarkJ Tacoma, Washington From torriem at gmail.com Sun Jun 9 20:42:41 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 09 Jun 2013 18:42:41 -0600 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <51B52101.8080702@gmail.com> On 06/09/2013 02:32 PM, Mark Janssen wrote: > PyPi. But if you are *publishing*, there's no court which can > protect your IP afterwards from redistribution, unless you > explicitly *restrict* it. I am not a lawyer, and I haven't read the copyright act in its entirety, nor have I studied all the case law surrounding copyright, but your statement is exactly backwards of anything I've ever read on US copyright. What relevant case law supports this view? It's a very interesting opinion. From steve+comp.lang.python at pearwood.info Sun Jun 9 20:26:43 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 10 Jun 2013 00:26:43 GMT Subject: Re-using copyrighted code References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> Message-ID: <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> On Sun, 09 Jun 2013 13:32:00 -0700, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie > wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already granted by US >>> copyright. >> >> You are correct, except that the OP has already stated he wishes to >> have his code distributed. Without granting a license, the code cannot >> be distributed beyond the people he personally gives the code too. >> PyPi cannot legally allow others to download it without a license. > > That's not entirely correct. If he *publishes* his code (I'm using this > term "publish" technically to mean "put forth in a way where anyone of > the general public can or is encouraged to view"), then he is *tacitly* > giving up protections that secrecy (or *not* disclosing it) would > *automatically* grant. The only preserved right is authorship after > that. So it can be re-distributed freely, if authorship is preserved. Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? Listened to the radio? All these things publish copyrighted work. It is utter nonsense that merely publishing something in public gives up the monopoly privileges granted by copyright. Armchair lawyering is one thing, but please at least *try* to apply thought to these things before making ridiculous claims. If merely publishing something voided copyright monopoly, then copyright would hardly encourage people to publish things they wished to monopolise, would it? > The only issue after that is "fair use" and that includes running the > program (not merely copying the source). Running the program is irrelevant to copyright. Copyright does not grant the creator a monopoly of *running* the program. > Re-selling for money violates fair-use, The principle of re-sale have nothing to do with fair use. > as does redistribution without > preserving credit assignment (unless they've naively waived those rights > away). One cannot *naively* waive away copyright monopoly privileges. It requires an explicit and overt act to give away the rights granted. One might deliberately publish your work under a permissive licence without realising that it is permissive, but that's not an act of naivety, it's an act of stupidity for not reading the licence and understanding it before publishing. "Well Your Honour, I had heard that all the cool kids were using the GPL, so I copied the GPL into my source code. I didn't realise it had legal meaning." > I will have to take a look at PyPi. But if you are > *publishing*, there's no court which can protect your IP afterwards from > redistribution, unless you explicitly *restrict* it. When you listen to a song on the radio, do you know how they have a copyright announcer read out the copyright and explicitly list all the rights they keep after each and every song and advertisment? No, me neither. It doesn't happen. Because it's nonsense that you give up copyright by publishing. > In which case, if > you restrict terms of re-use, you're putting the court in jeopardy > because you making two actions opposed to one another. The only thing > the court can easily uphold is your authorship and non-exploitation from > a violation of fair-use (note again the key word is "use", nor merely > copying the code). But then if you waive *that* right away, you put the > court in jeopardy again. Put the court in jeopardy huh. Oh my, that's a level of embarrassment I haven't seen for a long time. Unless you are the government of the land, nothing you publish has jurisdiction over the court or can put it in jeopardy. You can publish: "I hereby abolish the court, and sentence everyone involved with it to being soundly spanked on the bottom until it turns red." but it has no legal or practical standing. [...] > Well this is where one must make a distinction with fair-use -- if I > re-publish my modifications then the code is still subject to the terms > by the original author. If I make a copy for myself and run the problem > for personal, non-commercial use, then I am in the domain of fair use > and have no other obligations. That's utter nonsense. Fair use does not give you the right to make a copy of an entire work for your own use, non-commercial or not. Fair use let's you copy a handful of pages from a book, not the entire thing. -- Steven From dreamingforward at gmail.com Sun Jun 9 21:40:55 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 18:40:55 -0700 Subject: Re-using copyrighted code In-Reply-To: <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: > Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? > Listened to the radio? All these things publish copyrighted work. It is > utter nonsense that merely publishing something in public gives up the > monopoly privileges granted by copyright. That's not correct. Keep in mind, that the law is for people: there is no automatic right to profit. There certainly is no "right to monopoly" (which you are absurdly arguing) on *anything* released to the public. If you want that monopoly *you* have to provide the means to protect your IP. You, sir, are being ridiculous and perhaps the court along with you -- I'm just telling you what is correct. That's important. A movie producer, publishes his/her work as soon as he/she puts it on the market or otherwise releases it for public viewing. That's just the risk of doing business. Fortunately, for them, its not easy to make a verbatim copy of a film, in a theatre or otherwise. But copyright ensures that they get the credit for making the movie -- not for profit of publishing it. Now copyright includes the clause of "fair-use", so that means one can make a copy of something if they aren't depriving the original creator of legitimate gains. If they are truly depriving the creator(s) of legit gains, then they are in violation. That's all the law should support. Don't think there is any law that can determine, once and for all, what counts as "legitimate gains" and what violates "fair use". *You* have simply *sold out*. "Legitimate gains" is something the courts have to work out, on a case-by-case basis, but if the movie producers are that worried about losing their gains, then they can do the f-ing work and require movie goers to sign a simple clause promising that they won't try to copy the movie (on concealed cameras and such). The issue beyond that, like code, is when it comes to digital media. Because digital media allows verbatim copying and *tacitly removes* *by its nature* any privilege or monopoly on public viewing. That, again, is just the risk of doing business of trying to "maximize your market" for-profit. Tough nuts asshole. Things are quite clear despite the FUD the media establishment would have you believe. Stop capitulating and selling out. The only issue is whether you're depriving the original content creator of *legitimate* gains. That means many things: how much is that movie a derived product of popular culture, for example? (Did you get rewarded for participating in some small part of that?) How much would you have paid if was offered to you to set the price? > Armchair lawyering is one thing, but please at least *try* to apply > thought to these things before making ridiculous claims. I have, and I assure you they are not ridiculous claims. You have just been lulled into complacency, like most everyone else. That's why people like the DeCSS folks are doing the rest of us a favor. Shame on you for defending the status quo. > If merely > publishing something voided copyright monopoly, Here you already shown your ignorance of the concept. Copyright protects your *authorship*, not your profit. Perhaps you're confusing patent law with copyright. > then copyright would > hardly encourage people to publish things they wished to monopolise, > would it? Why would they publish something they wished to monopolize? >> The only issue after that is "fair use" and that includes running the >> program (not merely copying the source). > > Running the program is irrelevant to copyright. Technically, the law likely recognizes the distinction from reproducing and "running" a program. If I am a secretary and am copying something for my boss, I'm not liable am I? But if I derive benefit from the program, I am, yes? > Copyright does not grant > the creator a monopoly of *running* the program. No, perhaps you are getting hung up on the misnomer of calling it "copyright" which would otherwise imply "right to copy". Copyright, could potentially grant the creator rights (like the DMCA) to who *can* run the program. >> Re-selling for money violates fair-use, > > The principle of re-sale have nothing to do with fair use. Yes it does. You are simply wrong. The point of the law is fairness, not supporting monopolies. >> as does redistribution without >> preserving credit assignment (unless they've naively waived those rights >> away). > > One cannot *naively* waive away copyright monopoly privileges. Why not? That is what happens, generally speaking, when one releases something to the "public domain", so what are you arguing? > It > requires an explicit and overt act to give away the rights granted. That's what i just implied by saying "waived away their rights". > One > might deliberately publish your work under a permissive licence without > realising that it is permissive, but that's not an act of naivety, it's > an act of stupidity for not reading the licence and understanding it > before publishing. Well, that's what the court is for, to decide whether an act is innocent, isn't it :^) ? > "Well Your Honour, I had heard that all the cool kids were using the GPL, > so I copied the GPL into my source code. I didn't realise it had legal > meaning." That's right. It's up to the world to educate youth about the law. That they have not done so, is not the fault of the kids. > When you listen to a song on the radio, do you know how they have a > copyright announcer read out the copyright and explicitly list all the > rights they keep after each and every song and advertisment? > > No, me neither. It doesn't happen. Because it's nonsense that you give up > copyright by publishing. You have not listened and do not understand copyright. > Put the court in jeopardy huh. Oh my, that's a level of embarrassment I > haven't seen for a long time. Yes, that means you are putting the court in the middle where there is no clear, fair ruling that can be made. The rest of your commentary is not worth my effort until you understand basic copyright. -- MarkJ Tacoma, Washington From benjamin.kaplan at case.edu Sun Jun 9 22:16:16 2013 From: benjamin.kaplan at case.edu (Benjamin Kaplan) Date: Sun, 9 Jun 2013 19:16:16 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sun, Jun 9, 2013 at 6:40 PM, Mark Janssen wrote: >> Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? >> Listened to the radio? All these things publish copyrighted work. It is >> utter nonsense that merely publishing something in public gives up the >> monopoly privileges granted by copyright. > > That's not correct. Keep in mind, that the law is for people: there > is no automatic right to profit. There certainly is no "right to > monopoly" (which you are absurdly arguing) on *anything* released to > the public. If you want that monopoly *you* have to provide the means > to protect your IP. You, sir, are being ridiculous and perhaps the > court along with you -- I'm just telling you what is correct. That's > important. > > A movie producer, publishes his/her work as soon as he/she puts it on > the market or otherwise releases it for public viewing. That's just > the risk of doing business. Fortunately, for them, its not easy to > make a verbatim copy of a film, in a theatre or otherwise. But > copyright ensures that they get the credit for making the movie -- not > for profit of publishing it. > > Now copyright includes the clause of "fair-use", so that means one can > make a copy of something if they aren't depriving the original creator > of legitimate gains. If they are truly depriving the creator(s) of > legit gains, then they are in violation. That's all the law should > support. Don't think there is any law that can determine, once and > for all, what counts as "legitimate gains" and what violates "fair > use". *You* have simply *sold out*. "Legitimate gains" is > something the courts have to work out, on a case-by-case basis, but if > the movie producers are that worried about losing their gains, then > they can do the f-ing work and require movie goers to sign a simple > clause promising that they won't try to copy the movie (on concealed > cameras and such). > The fact that a work is non commercial is one of several factors that is taken into account when determining fair use. It is not an automatic fair use for non-commercial works. I have no idea where your understanding of copyright law came from, but here is the relevant section of the US legal code: 17 USC ? 107 - Limitations on exclusive rights: Fair use Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phonorecords or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright. In determining whether the use made of a work in any particular case is a fair use the factors to be considered shall include? (1) the purpose and character of the use, including whether such use is of a commercial nature or is for nonprofit educational purposes; (2) the nature of the copyrighted work; (3) the amount and substantiality of the portion used in relation to the copyrighted work as a whole; and (4) the effect of the use upon the potential market for or value of the copyrighted work. The fact that a work is unpublished shall not itself bar a finding of fair use if such finding is made upon consideration of all the above factors. Can you provide any citations for your interpretation? Besides "that's what the law should be", I mean. From dreamingforward at gmail.com Sun Jun 9 22:30:40 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 19:30:40 -0700 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: > The fact that a work is non commercial is one of several factors that > is taken into account when determining fair use. It is not an > automatic fair use for non-commercial works. I have no idea where your > understanding of copyright law came from, but here is the relevant > section of the US legal code: Thanks for digging out the legal code. Upon reading, it is stunningly clear that the legal system has not established a solid framework or arching philosophy in which to contain and express the desire (in law) to protect content creators of all kinds or the general public with the fair use of such works and has been running on the sheer confidence of "the American spirit", however facile or misdirected that may be. > 17 USC ? 107 - Limitations on exclusive rights: Fair use > Notwithstanding the provisions of sections 106 and 106A, the fair use > of a copyrighted work, including such use by reproduction in copies or > phonorecords or by any other means specified by that section, for > purposes such as criticism, comment, news reporting, teaching > (including multiple copies for classroom use), scholarship, or > research, is not an infringement of copyright. In determining whether > the use made of a work in any particular case is a fair use the > factors to be considered shall include? > (1) the purpose and character of the use, including whether such use > is of a commercial nature or is for nonprofit educational purposes; > (2) the nature of the copyrighted work; > (3) the amount and substantiality of the portion used in relation to > the copyrighted work as a whole; and > (4) the effect of the use upon the potential market for or value of > the copyrighted work. > The fact that a work is unpublished shall not itself bar a finding of > fair use if such finding is made upon consideration of all the above > factors. > > Can you provide any citations for your interpretation? Besides "that's > what the law should be", I mean. I don't think I even have to: the legal code you're citing above is not very clear, consistent, or well-defined at all. As such, it shows that this area remains an area that has yet to be worked out by all parties involved. I would happily volunteer for any interested parties to such a broken system. Alternatively, I've been working on a real fix to IP protections in the form of a unified data model for the internet and data ecosystem. -- MarkJ Tacoma, Washington From python.list at tim.thechases.com Sun Jun 9 22:48:59 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Sun, 9 Jun 2013 21:48:59 -0500 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130609214859.5b7179c1@bigbox.christie.dr> On 2013-06-09 19:30, Mark Janssen wrote: > Thanks for digging out the legal code. Upon reading, it is > stunningly clear that the legal system has not established a solid > framework or arching philosophy in which to contain and express the > desire (in law) to protect content creators of all kinds or the > general public with the fair use of such works and has been running > on the sheer confidence of "the American spirit", however facile or > misdirected that may be. What is clear is the mandate that sets up the framework in the first place: "To promote the Progress of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respective Writings and Discoveries" -- USC Article I, Section 8 If it doesn't "promote the Progress of Science and useful Arts", then it misses the spirit of the law as drafted. Granted, courts seem to miss that interpretation on a regular basis, leaving me a bit disgusted at the whole mess. :-/ -tkc From dreamingforward at gmail.com Sun Jun 9 22:57:05 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Sun, 9 Jun 2013 19:57:05 -0700 Subject: Re-using copyrighted code In-Reply-To: <20130609214859.5b7179c1@bigbox.christie.dr> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> <20130609214859.5b7179c1@bigbox.christie.dr> Message-ID: > What is clear is the mandate that sets up the framework in the first > place: > > "To promote the Progress of Science and useful Arts, by securing > for limited Times to Authors and Inventors the exclusive Right to > their respective Writings and Discoveries" > -- USC Article I, Section 8 > > If it doesn't "promote the Progress of Science and useful Arts", then > it misses the spirit of the law as drafted. Exactly, academia has known what this is intuitively for some time. It's just the commercial world and the populace at large that is confused and exploited. This also disproves Steven D'Aprano's thesis that monopoly rights is its purpose, but no. > Granted, courts seem to miss that interpretation on a regular basis, > leaving me a bit disgusted at the whole mess. :-/ Yeah, and stranger is that people *defend* the interpretation which *takes away* their rights! Bizarre! -- MarkJ Tacoma, Washington From torriem at gmail.com Sun Jun 9 23:26:05 2013 From: torriem at gmail.com (Michael Torrie) Date: Sun, 09 Jun 2013 21:26:05 -0600 Subject: Re-using copyrighted code In-Reply-To: References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51B5474D.4010808@gmail.com> On 06/09/2013 08:30 PM, Mark Janssen wrote: >> Can you provide any citations for your interpretation? Besides "that's >> what the law should be", I mean. > > I don't think I even have to: the legal code you're citing above is > not very clear, consistent, or well-defined at all. As such, it shows > that this area remains an area that has yet to be worked out by all > parties involved. I would happily volunteer for any interested > parties to such a broken system. Alternatively, I've been working on > a real fix to IP protections in the form of a unified data model for > the internet and data ecosystem. Except that's now how law works in the US. All laws are unclear, inconsistent or ill-defined. Many laws even contradict existing laws. That's why there's a long history and tradition (for good or ill) of courts establishing case law to clarify and codify the implementation of law, and to resolve incompatibilities and consistencies. So while your views may be logical to you, and even common sense, unless case law backs you up, your opinions are irrelevant to the actual implementation of copyright law. As much as many of us are open source or even free software advocates, we do have to live within the copyright law currently, and use (or exploit) it to our benefit and to preserve our rights. Meaning if I as a developer produce code, and if I wish this code to be of use to others while still protecting my own rights under copyright law, I have to adopt a suitable distribution license. And if I use existing code that is already under license, I have to take that into consideration. It's not fair use. It's code license. That is why this issue does matter, and why the original poster asked his questions in the first place. From dreamingforward at gmail.com Mon Jun 10 03:26:44 2013 From: dreamingforward at gmail.com (Mark Janssen) Date: Mon, 10 Jun 2013 00:26:44 -0700 Subject: Re-using copyrighted code In-Reply-To: <51B5474D.4010808@gmail.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> <51B5474D.4010808@gmail.com> Message-ID: >>> Can you provide any citations for your interpretation? Besides "that's >>> what the law should be", I mean. >> >> I don't think I even have to: the legal code you're citing above is >> not very clear, consistent, or well-defined at all. As such, it shows >> that this area remains an area that has yet to be worked out by all >> parties involved. I would happily volunteer for any interested >> parties to such a broken system. Alternatively, I've been working on >> a real fix to IP protections in the form of a unified data model for >> the internet and data ecosystem. > > Except that's now how law works in the US. All laws are unclear, > inconsistent or ill-defined. Yes, but the issue is that some participants were suggesting that the law *is* clear when it is not -- so what is the procedure to follow when that is the case? >Many laws even contradict existing laws. > That's why there's a long history and tradition (for good or ill) of > courts establishing case law to clarify and codify the implementation of > law, and to resolve incompatibilities and consistencies. > > So while your views may be logical to you, and even common sense, unless > case law backs you up, your opinions are irrelevant to the actual > implementation of copyright law. No, the system of law is made for, and by the people, so while it may not reflect consensus, it isn't necessarily irrelevant and in any case where there are people spouting law as if it WAS clear, someone must do the job breaking down the walls. > As much as many of us are open source or even free software advocates, > we do have to live within the copyright law currently, We do not have to live within it, we can create it. Where did you get this idea? -- MarkJ Tacoma, Washington From rantingrickjohnson at gmail.com Mon Jun 10 01:18:12 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Sun, 9 Jun 2013 22:18:12 -0700 (PDT) Subject: Re-using copyrighted code In-Reply-To: <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <51B450C1.5030506@berlin.de> <51B4DCA2.9000903@gmail.com> <51b51d42$0$30001$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sunday, June 9, 2013 7:26:43 PM UTC-5, Steven D'Aprano wrote: > When you listen to a song on the radio, do you know how they have a > copyright announcer read out the copyright and explicitly list all the > rights they keep after each and every song and advertisment? > No, me neither. It doesn't happen. Because it's nonsense that you give up > copyright by publishing. The fact that media distributors think they can control source files in this day and age is just wishful thinking and even more foolish than the ongoing (and fruitless) two decade long "war on drugs". I can't decide which is worse: circumventing evolution for the sake of greed OR for the sake of blind altruism. [Tangential Meandering Ahead] What these "pseudo moral" fools fail to realize is that a certain segment of any group is doomed to failure. This is not my law, this is the law of the universe in which we live. """ But Rick you're heartless. What of the children? If we legalize drugs then kids will be addicts, some will even die!""" How many are dying now in the streets from gangland shootouts? How many lives are being ruined and minds are being brainwashed by the highly repetitive music spewing hateful lyrics, indoctrinating another generation into the dead-end thug lifestyle? By fighting a losing war to "protect" degenerates from themselves, we actually elevate the thug and destroy the collective well-being of all humanity. Let the drug addicts and alcoholics self-destruct! Put the thugs out of business by legalizing drugs and you take away their easy source of profit. Take away the profit and you reduce the influence of these punks over the minds of children. Take away the influence, and you break the cycle of a thug lifestyle. Only logic can only undo what decades of bleeding heart policies have utterly destroyed. Instead of wasting time saving people who are lost, you should focus your time (and money) on people who have a future, people who can be productive members of society, people who have a true moral compass. How many innocent people have to die before you idiot " pseudo moralist" realize that restricting personal choices is a lost cause? But more importantly, when are you going to realize that the blood of all the innocent lives lost is on your hands! But i digress... [Back on topic of Copyright/license Issues] Maintaining an ownership of "Yes, that was my idea" and "i should benefit from my idea for a limited amount of time" is great, but thinking you can squeeze every penny out of an idea to very detriment of our collective evolution is nothing less than a crime against humanity! (<-- that was NOT an exaggeration!) In the 80's huge record companies bilked consumers and artists for hundreds of millions of dollars. They had their day in the sun. But every good ponzie scheme comes to an end. Maybe i'll go cry in the corner for the corporate suits, or maybe not! The real losers where the artist who forfeited an egregious percentage of their potential earnings so the corporate suits could buy another jet or another summer home to impress their shallow friends. But this whole idea of "i was first so you're not allowed" is just nonsense. If someone can reproduce your work, then it must not have been much of a leap in the first place. Instead of squalling over who owns an idea (like two children fighting over a toy)try to inject uniqueness into your interpretation of the idea to make it your "very own". If you're an inventor, artist, musician, programmer, scientist, etc... your focus should be on creating the best idea you possibly can. If the thought of someone imitating or copying your idea keeps you awake at night, then don't release your idea to the public. In this day and age of the information revolution, any attempt to stop the propagation of your idea is foolish. Just as foolish as thinking that outlawing guns will end murder, or that some illogical "war on drugs" will ever be won, or that seat-belt laws exist because your government "cares" about your well-being -- Oh gawd your a bunch of idiots! "Authoritarian policies create side effects that are far worse than the miniscule problems the policies attempted to solve." From robert.kern at gmail.com Mon Jun 10 08:57:58 2013 From: robert.kern at gmail.com (Robert Kern) Date: Mon, 10 Jun 2013 13:57:58 +0100 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: On 2013-06-08 22:31, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory reading? Larry Rosen's free (open source, even!) book _Open Source Licensing_ is good introductory reading. Larry is an intellectual property lawyer and helped draft the current PSF license. http://www.rosenlaw.com/oslbook.htm -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From ethan at stoneleaf.us Mon Jun 10 10:24:46 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Mon, 10 Jun 2013 07:24:46 -0700 Subject: Re-using copyrighted code In-Reply-To: References: Message-ID: <51B5E1AE.4030008@stoneleaf.us> On 06/10/2013 05:57 AM, Robert Kern wrote: > On 2013-06-08 22:31, Malte Forkel wrote: >> Hello, >> >> I have written a small utility to locate errors in regular expressions >> that I want to upload to PyPI. Before I do that, I would like to learn >> a litte more about the legal aspects of open-source software. What would >> be a good introductory reading? > > Larry Rosen's free (open source, even!) book _Open Source Licensing_ is good introductory reading. Larry is an > intellectual property lawyer and helped draft the current PSF license. > > http://www.rosenlaw.com/oslbook.htm Nice, thanks for the link! -- ~Ethan~ From jphalip at gmail.com Sun Jun 9 00:30:48 2013 From: jphalip at gmail.com (Julien Phalip) Date: Sat, 8 Jun 2013 21:30:48 -0700 (PDT) Subject: Listing modules from all installed packages Message-ID: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Hi, I'm trying to write a function that programmatically obtains and returns the exact location of all first-level modules for all installed packages. For example, if the packages named 'django' and 'django-debug-toolbar' are installed, I'd like this function to return something like: >>> installed_modules() /Users/my_user/.virtualenvs/my_venv/lib/python2.6/site-packages/django /Users/my_user/.virtualenvs/my_venv/src/debug_toolbar That is, this function needs to consider all installed packages, including those that have been installed in "edit" mode (i.e. in the src/ folder). Note also that the main module for the 'django-debug-toolbar' is in fact named 'debug_toolbar'. So far the closest I've been to retrieving the list of first-level modules is as follows: import os import pkg_resources import setuptools pkgs = set() for dist in pkg_resources.working_set: if os.path.isdir(dist.location): for pkg in setuptools.find_packages(dist.location): if '.' not in pkg: pkgs.add(pkg) The idea is then to loop through that list of modules, import them and get their exact locations by fetching their __file__ attribute values. However, this feels very hackish and I don't think it's actually quite correct either. I'm sure there must be a better way. If possible I'd also like to avoid having to use setuptools. Do you have any tips on how to achieve this? Many thanks! Julien From carlosnepomuceno at outlook.com Sun Jun 9 01:23:15 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sun, 9 Jun 2013 08:23:15 +0300 Subject: Listing modules from all installed packages In-Reply-To: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> References: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Message-ID: print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]) > Date: Sat, 8 Jun 2013 21:30:48 -0700 > Subject: Listing modules from all installed packages > From: jphalip at gmail.com > To: python-list at python.org > > Hi, > > I'm trying to write a function that programmatically obtains and returns the exact location of all first-level modules for all installed packages. > > For example, if the packages named 'django' and 'django-debug-toolbar' are installed, I'd like this function to return something like: > >>> installed_modules() > /Users/my_user/.virtualenvs/my_venv/lib/python2.6/site-packages/django > /Users/my_user/.virtualenvs/my_venv/src/debug_toolbar > > That is, this function needs to consider all installed packages, including those that have been installed in "edit" mode (i.e. in the src/ folder). Note also that the main module for the 'django-debug-toolbar' is in fact named 'debug_toolbar'. > > So far the closest I've been to retrieving the list of first-level modules is as follows: > > import os > import pkg_resources > import setuptools > > pkgs = set() > > for dist in pkg_resources.working_set: > if os.path.isdir(dist.location): > for pkg in setuptools.find_packages(dist.location): > if '.' not in pkg: > pkgs.add(pkg) > > The idea is then to loop through that list of modules, import them and get their exact locations by fetching their __file__ attribute values. > > However, this feels very hackish and I don't think it's actually quite correct either. I'm sure there must be a better way. If possible I'd also like to avoid having to use setuptools. > > Do you have any tips on how to achieve this? > > Many thanks! > > Julien > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosnepomuceno at outlook.com Sun Jun 9 02:22:16 2013 From: carlosnepomuceno at outlook.com (Carlos Nepomuceno) Date: Sun, 9 Jun 2013 09:22:16 +0300 Subject: Listing modules from all installed packages In-Reply-To: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> References: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Message-ID: Just realized that you've asked for installed packages. Perhaps the following will do the trick. I don't know why the 'lib-tk' isn't included. Why not? toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in pkgutil.iter_modules() if ispkg] print '\n'.join(toplevel_packages) > Date: Sat, 8 Jun 2013 21:30:48 -0700 > Subject: Listing modules from all installed packages > From: jphalip at gmail.com > To: python-list at python.org > > Hi, > > I'm trying to write a function that programmatically obtains and returns the exact location of all first-level modules for all installed packages. > > For example, if the packages named 'django' and 'django-debug-toolbar' are installed, I'd like this function to return something like: > >>> installed_modules() > /Users/my_user/.virtualenvs/my_venv/lib/python2.6/site-packages/django > /Users/my_user/.virtualenvs/my_venv/src/debug_toolbar > > That is, this function needs to consider all installed packages, including those that have been installed in "edit" mode (i.e. in the src/ folder). Note also that the main module for the 'django-debug-toolbar' is in fact named 'debug_toolbar'. > > So far the closest I've been to retrieving the list of first-level modules is as follows: > > import os > import pkg_resources > import setuptools > > pkgs = set() > > for dist in pkg_resources.working_set: > if os.path.isdir(dist.location): > for pkg in setuptools.find_packages(dist.location): > if '.' not in pkg: > pkgs.add(pkg) > > The idea is then to loop through that list of modules, import them and get their exact locations by fetching their __file__ attribute values. > > However, this feels very hackish and I don't think it's actually quite correct either. I'm sure there must be a better way. If possible I'd also like to avoid having to use setuptools. > > Do you have any tips on how to achieve this? > > Many thanks! > > Julien > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From cclauss at bluewin.ch Sun Jun 9 08:51:36 2013 From: cclauss at bluewin.ch (cclauss at bluewin.ch) Date: Sun, 9 Jun 2013 05:51:36 -0700 (PDT) Subject: Listing modules from all installed packages In-Reply-To: References: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Message-ID: Adding : python -c 'help("modules") to the other two suggestions: #!/usr/bin/env python import commands, pkgutil, re, sys print('sys.modules.items()...') print('\n'.join(sorted([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]))) print('\npkgutil.iter_modules()...') toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in sorted(pkgutil.iter_modules()) if ispkg] print '\n'.join(toplevel_packages) theCommand = "python -c 'help(\"modules\")'" print('\n{} # this may take a few seconds...'.format(theCommand)) print(commands.getstatusoutput(theCommand)[1]) # help() only works in the python interpreter... From jphalip at gmail.com Fri Jun 14 15:18:34 2013 From: jphalip at gmail.com (Julien Phalip) Date: Fri, 14 Jun 2013 12:18:34 -0700 (PDT) Subject: Listing modules from all installed packages In-Reply-To: References: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Message-ID: <6622b482-a439-4223-9631-954fd97fe248@googlegroups.com> On Saturday, June 8, 2013 11:22:16 PM UTC-7, Carlos Nepomuceno wrote: > Just realized that you've asked for installed packages. Perhaps the following will do the trick. I don't know why the 'lib-tk' isn't included. Why not? > > toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in pkgutil.iter_modules() if ispkg] > print '\n'.join(toplevel_packages) Thanks a lot Carlos, this gives me exactly what I needed! Best wishes, Julien From dihedral88888 at gmail.com Sun Jun 9 14:57:41 2013 From: dihedral88888 at gmail.com (88888 Dihedral) Date: Sun, 9 Jun 2013 11:57:41 -0700 (PDT) Subject: Listing modules from all installed packages In-Reply-To: References: <210f2f63-13b0-46c2-b080-fd831cb3ca49@googlegroups.com> Message-ID: <109816a7-c8c8-487d-b568-af46b5c45ad2@googlegroups.com> Carlos Nepomuceno? 2013?6?9????UTC+8??1?23?15???? > print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]) > > > > > Date: Sat, 8 Jun 2013 21:30:48 -0700 > > Subject: Listing modules from all installed packages > > From: jph... at gmail.com > > To: pytho... at python.org > > > > Hi, > > > > I'm trying to write a function that programmatically obtains and returns the exact location of all first-level modules for all installed packages. > > > > For example, if the packages named 'django' and 'django-debug-toolbar' are installed, I'd like this function to return something like: > > >>> installed_modules() > > /Users/my_user/.virtualenvs/my_venv/lib/python2.6/site-packages/django > > /Users/my_user/.virtualenvs/my_venv/src/debug_toolbar > > > > That is, this function needs to consider all installed packages, including those that have been installed in "edit" mode (i.e. in the src/ folder). Note also that the main module for the 'django-debug-toolbar' is in fact named 'debug_toolbar'. > > > > So far the closest I've been to retrieving the list of first-level modules is as follows: > > > > import os > > import pkg_resources > > import setuptools > > > > pkgs = set() > > > > for dist in pkg_resources.working_set: > > if os.path.isdir(dist.location): > > for pkg in setuptools.find_packages(dist.location): > > if '.' not in pkg: > > pkgs.add(pkg) > > > > The idea is then to loop through that list of modules, import them and get their exact locations by fetching their __file__ attribute values. > > > > However, this feels very hackish and I don't think it's actually quite correct either. I'm sure there must be a better way. If possible I'd also like to avoid having to use setuptools. > > > > Do you have any tips on how to achieve this? > > > > Many thanks! > > > > Julien > > -- > > http://mail.python.org/mailman/listinfo/python-list Please use a dictionary to store a tree first. Then it is trivial to walk through all nodes of the tree. From claire.morandin at gmail.com Sun Jun 9 06:12:28 2013 From: claire.morandin at gmail.com (claire morandin) Date: Sun, 9 Jun 2013 03:12:28 -0700 (PDT) Subject: I used defaultdic to store some variables but the output is blank Message-ID: <35dd1554-de27-4209-b62e-6a2968c19d0c@googlegroups.com> I have the following script which does not return anything, no apparent mistake but my output file is empty.I am just trying to extract some decimal number from a file according to their names which are in another file. from collections import defaultdict import numpy as np [code]ercc_contigs= {} for line in open ('Faq_ERCC_contigs_name.txt'): gene = line.strip().split() ercc_rpkm = defaultdict(lambda: np.zeros(1, dtype=float)) output_file = open('out.txt','w') rpkm_file = open('RSEM_Faq_Q1.genes.results.txt') rpkm_file.readline() for line in rpkm_file: line = line.strip() columns = line.strip().split() gene = columns[0].strip() rpkm_value = float(columns[6].strip()) if gene in ercc_contigs: ercc_rpkm[gene] += rpkm_value ercc_fh = open ('out.txt','w') for gene, rpkm_value in ercc_rpkm.iteritems(): ercc = '{0}\t{1}\n'.format(gene, rpkm_value) ercc_fh.write (ercc)[/code] If someone could help me spot what's wrong it would be much appreciate cheers From __peter__ at web.de Sun Jun 9 07:56:41 2013 From: __peter__ at web.de (Peter Otten) Date: Sun, 09 Jun 2013 13:56:41 +0200 Subject: I used defaultdic to store some variables but the output is blank References: <35dd1554-de27-4209-b62e-6a2968c19d0c@googlegroups.com> Message-ID: claire morandin wrote: > I have the following script which does not return anything, no apparent > mistake but my output file is empty.I am just trying to extract some > decimal number from a file according to their names which are in another > file. from collections import defaultdict import numpy as np > > [code]ercc_contigs= {} > for line in open ('Faq_ERCC_contigs_name.txt'): > gene = line.strip().split() You probably planned to use the loop above to populate the ercc_contigs dict, but there's no code for that. > ercc_rpkm = defaultdict(lambda: np.zeros(1, dtype=float)) > output_file = open('out.txt','w') > > rpkm_file = open('RSEM_Faq_Q1.genes.results.txt') > rpkm_file.readline() > for line in rpkm_file: > line = line.strip() > columns = line.strip().split() > gene = columns[0].strip() > rpkm_value = float(columns[6].strip()) Remember that ercc_contigs is empty; therefore the test > if gene in ercc_contigs: always fails and the following line is never executed. > ercc_rpkm[gene] += rpkm_value > > ercc_fh = open ('out.txt','w') > for gene, rpkm_value in ercc_rpkm.iteritems(): > ercc = '{0}\t{1}\n'.format(gene, rpkm_value) > ercc_fh.write (ercc)[/code] > > If someone could help me spot what's wrong it would be much appreciate > cheers By the way: it is unclear to my why you are using a numpy array here: > ercc_rpkm = defaultdict(lambda: np.zeros(1, dtype=float)) I think ercc_rpkm = defaultdict(float) should suffice. Also: > line = line.strip() > columns = line.strip().split() > gene = columns[0].strip() > rpkm_value = float(columns[6].strip()) You can remove all strip() method calls here as line.split() implicitly removes all whitespace. From claire.morandin at gmail.com Sun Jun 9 08:27:01 2013 From: claire.morandin at gmail.com (claire morandin) Date: Sun, 9 Jun 2013 05:27:01 -0700 (PDT) Subject: I used defaultdic to store some variables but the output is blank In-Reply-To: <35dd1554-de27-4209-b62e-6a2968c19d0c@googlegroups.com> References: <35dd1554-de27-4209-b62e-6a2968c19d0c@googlegroups.com> Message-ID: <7b40883a-4211-48cc-8db4-2414fa52e23a@googlegroups.com> Thanks Peter, true I did not realize that ercc_contigs is empty, but I am not sure how to "populate" the dictionary if I only have one column for the value but no key From __peter__ at web.de Sun Jun 9 08:46:44 2013 From: __peter__ at web.de (Peter Otten) Date: Sun, 09 Jun 2013 14:46:44 +0200 Subject: I used defaultdic to store some variables but the output is blank References: <35dd1554-de27-4209-b62e-6a2968c19d0c@googlegroups.com> <7b40883a-4211-48cc-8db4-2414fa52e23a@googlegroups.com> Message-ID: claire morandin wrote: > Thanks Peter, true I did not realize that ercc_contigs is empty, but I am > not sure how to "populate" the dictionary if I only have one column for > the value but no key You could use a "dummy value" ercc_contigs = {} for line in open('Faq_ERCC_contigs_name.txt'): gene = line.split()[0] ercc_contigs[gene] = None but a better approach is to use a set instead of a dict: ercc_contigs = set() for line in open('Faq_ERCC_contigs_name.txt'): gene = line.split()[0] ercc_contigs.add(gene) From nikos.gr33k at gmail.com Sun Jun 9 06:44:57 2013 From: nikos.gr33k at gmail.com (=?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?=) Date: Sun, 9 Jun 2013 03:44:57 -0700 (PDT) Subject: A few questiosn about encoding Message-ID: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> A few questiosn about encoding please: >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you need >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >characters, with ordinal values 0x4C and 0xFA, or one character with >ordinal value 0x4CFA? I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. >> UTF-8 and UTF-16 and UTF-32 >> I though the number beside of UTF- was to declare how many bits the >> character set was using to store a character into the hdd, no? >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >values to make a surrogate pair. A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? Is this what a surrogate is? a pari of 2 chars? >UTF-8 uses 8-bit values, but sometimes >it combines two, three or four of them to represent a single code-point. 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? From fabiosantosart at gmail.com Sun Jun 9 08:18:08 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sun, 9 Jun 2013 13:18:08 +0100 Subject: A few questiosn about encoding In-Reply-To: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: On 9 Jun 2013 11:49, "???????? ??????" wrote: > > A few questiosn about encoding please: > > >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for > >> values up to 256? > > >Because then how do you tell when you need one byte, and when you need > >two? If you read two bytes, and see 0x4C 0xFA, does that mean two > >characters, with ordinal values 0x4C and 0xFA, or one character with > >ordinal value 0x4CFA? > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. > > > >> UTF-8 and UTF-16 and UTF-32 > >> I though the number beside of UTF- was to declare how many bits the > >> character set was using to store a character into the hdd, no? > > >Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. > >UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit > >values to make a surrogate pair. > > A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? > Is this what a surrogate is? a pari of 2 chars? > > > >UTF-8 uses 8-bit values, but sometimes > >it combines two, three or four of them to represent a single code-point. > > 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) > '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) > 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) > > The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? > -- > http://mail.python.org/mailman/listinfo/python-list In short, a utf-8 character takes 1 to 4 bytes. A utf-16 character takes 2 to 4 bytes. A utf-32 always takes 4 bytes. The process of encoding bytes to characters is called encoding. The opposite is decoding. This is all made transparent in python with the encode() and decode() methods. You normally don't care about this kind of things. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nobody at nowhere.com Sun Jun 9 13:01:06 2013 From: nobody at nowhere.com (Nobody) Date: Sun, 09 Jun 2013 18:01:06 +0100 Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: On Sun, 09 Jun 2013 03:44:57 -0700, ???????? ?????? wrote: >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes, and see 0x4C 0xFA, does that mean two >>characters, with ordinal values 0x4C and 0xFA, or one character with >>ordinal value 0x4CFA? > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I > meant up to 256, not above 256. But then you've used up all 256 possible bytes for storing the first 256 characters, and there aren't any left for use in multi-byte sequences. You need some means to distinguish between a single-byte character and an individual byte within a multi-byte sequence. UTF-8 does that by allocating specific ranges to specific purposes. 0x00-0x7F are single-byte characters, 0x80-0xBF are continuation bytes of multi-byte sequences, 0xC0-0xFF are leading bytes of multi-byte sequences. This scheme has the advantage of making UTF-8 non-modal, i.e. if a byte is corrupted, added or removed, it will only affect the character containing that particular byte; the encoder can re-synchronise at the beginning of the following character. OTOH, with encodings such as UTF-16, UTF-32 or ISO-2022, adding or removing a byte will result in desyncronisation, with all subsequent characters being corrupted. > A surrogate pair is like itting for example Ctrl-A, which means is a > combination character that consists of 2 different characters? Is this > what a surrogate is? a pari of 2 chars? A surrogate pair is a pair of 16-bit codes used to represent a single Unicode character whose code is greater than 0xFFFF. The 2048 codepoints from 0xD800 to 0xDFFF inclusive aren't used to represent characters, but "surrogates". Unicode characters with codes in the range 0x10000-0x10FFFF are represented in UTF-16 as a pair of surrogates. First, 0x10000 is subtracted from the code, giving a value in the range 0-0xFFFFF (20 bits). The top ten bits are added to 0xD800 to give a value in the range 0xD800-0xDBFF, while the bottom ten bits are added to 0xDC00 to give a value in the range 0xDC00-0xDFFF. Because the codes used for surrogates aren't valid as individual characters, scanning a string for a particular character won't accidentally match part of a multi-word character. > 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) > '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > > 127 ) 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be > stored ? (since ordinal > 65000 ) Most Chinese, Japanese and Korean (CJK) characters have codepoints within the BMP (i.e. <= 0xFFFF), so they only require 3 bytes in UTF-8. The codepoints above the BMP are mostly for archaic ideographs (those no longer in normal use), mathematical symbols, dead languages, etc. > The amount of bytes needed to store a character solely depends on the > character's ordinal value in the Unicode table? Yes. UTF-8 is essentially a mechanism for representing 31-bit unsigned integers such that smaller integers require fewer bytes than larger integers (subsequent revisions of Unicode cap the range of possible codepoints to 0x10FFFF, as that's all that UTF-16 can handle). From kwpolska at gmail.com Sun Jun 9 13:12:22 2013 From: kwpolska at gmail.com (=?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?=) Date: Sun, 9 Jun 2013 19:12:22 +0200 Subject: A few questiosn about encoding In-Reply-To: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 12:44 PM, ???????? ?????? wrote: > A few questiosn about encoding please: > >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes, and see 0x4C 0xFA, does that mean two >>characters, with ordinal values 0x4C and 0xFA, or one character with >>ordinal value 0x4CFA? > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. It is required so the computer can know where characters begin. 0x0080 (first non-ASCII character) becomes 0xC280 in UTF-8. Further details here: http://en.wikipedia.org/wiki/UTF-8#Description >>> UTF-8 and UTF-16 and UTF-32 >>> I though the number beside of UTF- was to declare how many bits the >>> character set was using to store a character into the hdd, no? > >>Not exactly, but close. UTF-32 is completely 32-bit (4 byte) values. >>UTF-16 mostly uses 16-bit values, but sometimes it combines two 16-bit >>values to make a surrogate pair. > > A surrogate pair is like itting for example Ctrl-A, which means is a combination character that consists of 2 different characters? > Is this what a surrogate is? a pari of 2 chars? http://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B10000_to_U.2B10FFFF Long story short: codepoint - 0x10000 (up to 20 bits) ? two 10-bit numbers ? 0xD800 + first_half 0xDC00 + second_half. Rephrasing: We take MATHEMATICAL BOLD CAPITAL B (U+1D401). If you have UTF-8: ? It is over 0xFFFF, and we need to use surrogate pairs. We end up with 0xD401, or 0b1101010000000001. Both representations are worthless, as we have a 16-bit number, not a 20-bit one. We throw in some leading zeroes and end up with 0b00001101010000000001. Split it in half and we get 0b0000110101 and 0b0000000001, which we can now shorten to 0b110101 and 0b1, or translate to hex as 0x0035 and 0x0001. 0xD800 + 0x0035 and 0xDC00 + 0x0035 ? 0xD835 0xDC00. Type it into python and: >>> b'\xD8\x35\xDC\x01'.decode('utf-16be') '?' And before you ask: that ?BE? stands for Big-Endian. Little-Endian would mean reversing the bytes in a codepoint, which would make it '\x35\xD8\x01\xDC' (the name is based on the first 256 characters, which are 0x6500 for 'a' in a little-endian encoding. Another question you may ask: 0xD800?0xDFFF are reserved in Unicode for the purposes of UTF-16, so there is no conflicts. >>UTF-8 uses 8-bit values, but sometimes >>it combines two, three or four of them to represent a single code-point. > > 'a' to be utf8 encoded needs 1 byte to be stored ? (since ordinal = 65) > '??' to be utf8 encoded needs 2 bytes to be stored ? (since ordinal is > 127 ) yup. ? is at 0x03B1, or 945 decimal. > 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) Not necessarily, as CJK characters start at U+2E80, which is in the 3-byte range (0x0800 through 0xFFFF) ? the table is here: http://en.wikipedia.org/wiki/UTF-8#Description -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html From support at superhost.gr Wed Jun 12 05:09:05 2013 From: support at superhost.gr (=?iso-8859-7?b?zenq/Ovh7/Igyu/98eHy?=) Date: Wed, 12 Jun 2013 09:09:05 +0000 (UTC) Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: >> (*) infact UTF8 also indicates the end of each character > Up to a point. The initial byte encodes the length and the top few > bits, but the subsequent octets aren?t distinguishable as final in > isolation. 0x80-0xBF can all be either medial or final. So, the first high-bits are a directive that UTF-8 uses to know how many bytes each character is being represented as. 0-127 codepoints(characters) use 1 bit to signify they need 1 bit for storage and the rest 7 bits to actually store the character ? while 128-256 codepoints(characters) use 2 bit to signify they need 2 bits for storage and the rest 14 bits to actually store the character ? Isn't 14 bits way to many to store a character ? From steve+comp.lang.python at pearwood.info Wed Jun 12 05:24:42 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 12 Jun 2013 09:24:42 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> On Wed, 12 Jun 2013 09:09:05 +0000, ???????? ?????? wrote: > Isn't 14 bits way to many to store a character ? No. There are 1114111 possible characters in Unicode. (And in Japan, they sometimes use TRON instead of Unicode, which has even more.) If you list out all the combinations of 14 bits: 0000 0000 0000 00 0000 0000 0000 01 0000 0000 0000 10 0000 0000 0000 11 [...] 1111 1111 1111 10 1111 1111 1111 11 you will see that there are only 32767 (2**15-1) such values. You can't fit 1114111 characters with just 32767 values. -- Steven From support at superhost.gr Wed Jun 12 07:23:49 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Wed, 12 Jun 2013 14:23:49 +0300 Subject: A few questiosn about encoding In-Reply-To: <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 12/6/2013 12:24 ??, Steven D'Aprano wrote: > On Wed, 12 Jun 2013 09:09:05 +0000, ???????? ?????? wrote: > >> Isn't 14 bits way to many to store a character ? > > No. > > There are 1114111 possible characters in Unicode. (And in Japan, they > sometimes use TRON instead of Unicode, which has even more.) > > If you list out all the combinations of 14 bits: > > 0000 0000 0000 00 > 0000 0000 0000 01 > 0000 0000 0000 10 > 0000 0000 0000 11 > [...] > 1111 1111 1111 10 > 1111 1111 1111 11 > > you will see that there are only 32767 (2**15-1) such values. You can't > fit 1114111 characters with just 32767 values. > > > Thanks Steven, So, how many bytes does UTF-8 stored for codepoints > 127 ? example for codepoint 256, 1345, 16474 ? From ulrich.eckhardt at dominolaser.com Wed Jun 12 08:52:09 2013 From: ulrich.eckhardt at dominolaser.com (Ulrich Eckhardt) Date: Wed, 12 Jun 2013 14:52:09 +0200 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: Am 12.06.2013 13:23, schrieb ???????? ??????: > So, how many bytes does UTF-8 stored for codepoints > 127 ? What has your research turned up? I personally consider it lazy and respectless to get lots of pointers that you could use for further research and ask for more info before you even followed these links. > example for codepoint 256, 1345, 16474 ? Yes, examples exist. Gee, if there only was an information network that you could access and where you could locate information on various programming-related topics somehow. Seriously, someone should invent this thing! But still, even without it, you have all the tools (i.e. Python) in your hand to generate these examples yourself! Check out ord, bin, encode, decode for a start. Uli From nobody at nowhere.com Wed Jun 12 16:30:23 2013 From: nobody at nowhere.com (Nobody) Date: Wed, 12 Jun 2013 21:30:23 +0100 Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Wed, 12 Jun 2013 14:23:49 +0300, ???????? ?????? wrote: > So, how many bytes does UTF-8 stored for codepoints > 127 ? U+0000..U+007F 1 byte U+0080..U+07FF 2 bytes U+0800..U+FFFF 3 bytes >=U+10000 4 bytes So, 1 byte for ASCII, 2 bytes for other Latin characters, Greek, Cyrillic, Arabic, and Hebrew, 3 bytes for Chinese/Japanese/Korean, 4 bytes for dead languages and mathematical symbols. The mechanism used by UTF-8 allows sequences of up to 6 bytes, for a total of 31 bits, but UTF-16 is limited to U+10FFFF (slightly more than 20 bits). From steve+comp.lang.python at pearwood.info Wed Jun 12 21:40:44 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 13 Jun 2013 01:40:44 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b9231b$0$29997$c3e8da3$5496439d@news.astraweb.com> On Wed, 12 Jun 2013 21:30:23 +0100, Nobody wrote: > The mechanism used by UTF-8 allows sequences of up to 6 bytes, for a > total of 31 bits, but UTF-16 is limited to U+10FFFF (slightly more than > 20 bits). Same with UTF-8 and UTF-32, both of which are limited to U+10FFFF because that is what Unicode is limited to. The *mechanism* of UTF-8 can go up to 6 bytes (or even 7 perhaps?), but that's not UTF-8, that's UTF-8-plus-extra-codepoints. Likewise the mechanism of UTF-32 could go up to 0xFFFFFFFF, but doing so means you don't have Unicode chars any more, and hence your byte-string is not valid UTF-32: py> b = b'\xFF'*8 py> b.decode('UTF-32') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'utf32' codec can't decode bytes in position 0-3: codepoint not in range(0x110000) -- Steven From rosuav at gmail.com Wed Jun 12 22:01:55 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 12:01:55 +1000 Subject: A few questiosn about encoding In-Reply-To: <51b9231b$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b9231b$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 13, 2013 at 11:40 AM, Steven D'Aprano wrote: > The *mechanism* of UTF-8 can go up to 6 bytes (or even 7 perhaps?), but > that's not UTF-8, that's UTF-8-plus-extra-codepoints. And a proper UTF-8 decoder will reject "\xC0\x80" and "\xed\xa0\x80", even though mathematically they would translate into U+0000 and U+D800 respectively. The UTF-16 *mechanism* is limited to no more than Unicode has currently used, but I'm left wondering if that's actually the other way around - that Unicode planes were deemed to stop at the point where UTF-16 can't encode any more. Not that it matters; with most of the current planes completely unallocated, it seems unlikely we'll be needing more. ChrisA From nobody at nowhere.com Thu Jun 13 06:02:38 2013 From: nobody at nowhere.com (Nobody) Date: Thu, 13 Jun 2013 11:02:38 +0100 Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b9231b$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, 13 Jun 2013 12:01:55 +1000, Chris Angelico wrote: > On Thu, Jun 13, 2013 at 11:40 AM, Steven D'Aprano > wrote: >> The *mechanism* of UTF-8 can go up to 6 bytes (or even 7 perhaps?), but >> that's not UTF-8, that's UTF-8-plus-extra-codepoints. > > And a proper UTF-8 decoder will reject "\xC0\x80" and "\xed\xa0\x80", even > though mathematically they would translate into U+0000 and U+D800 > respectively. The UTF-16 *mechanism* is limited to no more than Unicode > has currently used, but I'm left wondering if that's actually the other > way around - that Unicode planes were deemed to stop at the point where > UTF-16 can't encode any more. Indeed. 5-byte and 6-byte sequences were originally part of the UTF-8 specification, allowing for 31 bits. Later revisions of the standard imposed the UTF-16 limit on Unicode as a whole. From support at superhost.gr Thu Jun 13 02:21:28 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 09:21:28 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 12/6/2013 11:30 ??, Nobody wrote: > On Wed, 12 Jun 2013 14:23:49 +0300, ???????? ?????? wrote: > >> So, how many bytes does UTF-8 stored for codepoints > 127 ? > > U+0000..U+007F 1 byte > U+0080..U+07FF 2 bytes > U+0800..U+FFFF 3 bytes >> =U+10000 4 bytes 'U' stands for Unicode code-point which means a character right? How can you be able to tell up to what character utf-8 needs 1 byte or 2 bytes or 3? And some of the bytes' bits are used to tell where a code-points representations stops, right? i mean if we have a code-point that needs 2 bytes to be stored that the high bit must be set to 1 to signify that this character's encoding stops at 2 bytes. I just know that 2^8 = 256, that's by first look 265 places, which mean 256 positions to hold a code-point which in turn means a character. We take the high bit out and then we have 2^7 which is enough positions for 0-127 standard ASCII. High bit is set to '0' to signify that char is encoded in 1 byte. Please tell me that i understood correct so far. But how about for 2 or 3 or 4 bytes? Am i saying ti correct ? From wxjmfauth at gmail.com Thu Jun 13 02:28:40 2013 From: wxjmfauth at gmail.com (jmfauth) Date: Wed, 12 Jun 2013 23:28:40 -0700 (PDT) Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: <7d1f7756-31f4-4e0f-a5d3-6b736c2eef3c@k3g2000vbn.googlegroups.com> ------ UTF-8, Unicode (consortium): 1 to 4 *Unicode Transformation Unit* UTF-8, ISO 10646: 1 to 6 *Unicode Transformation Unit* (still actual, unless tealy freshly modified) jmf From rosuav at gmail.com Thu Jun 13 02:48:34 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 16:48:34 +1000 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 13, 2013 at 4:21 PM, ???????? ?????? wrote: > How can you be able to tell up to what character utf-8 needs 1 byte or 2 > bytes or 3? You look up Wikipedia, using the handy links that have been put to you MULTIPLE TIMES. ChrisA From steve+comp.lang.python at pearwood.info Wed Jun 12 20:13:34 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 13 Jun 2013 00:13:34 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> On Wed, 12 Jun 2013 14:23:49 +0300, ???????? ?????? wrote: > So, how many bytes does UTF-8 stored for codepoints > 127 ? Two, three or four, depending on the codepoint. > example for codepoint 256, 1345, 16474 ? You can do this yourself. I have already given you enough information in previous emails to answer this question on your own, but here it is again: Open an interactive Python session, and run this code: c = ord(16474) len(c.encode('utf-8')) That will tell you how many bytes are used for that example. -- Steven From support at superhost.gr Thu Jun 13 02:09:19 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 09:09:19 +0300 Subject: A few questiosn about encoding In-Reply-To: <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 13/6/2013 3:13 ??, Steven D'Aprano wrote: > On Wed, 12 Jun 2013 14:23:49 +0300, ???????? ?????? wrote: > >> So, how many bytes does UTF-8 stored for codepoints > 127 ? > > Two, three or four, depending on the codepoint. The amount of bytes needed by UTF-8 to store a code-point(character), depends on the ordinal value of the code-point in the Unicode charset, correct? If this is correct then the higher the ordinal value(which is an decimal integer) in the Unicode charset the more bytes needed for storage. Its like the bigger a decimal integer is the bigger binary number it produces. Is this correct? >> example for codepoint 256, 1345, 16474 ? > > You can do this yourself. I have already given you enough information in > previous emails to answer this question on your own, but here it is again: > > Open an interactive Python session, and run this code: > > c = ord(16474) > len(c.encode('utf-8')) > > > That will tell you how many bytes are used for that example. This si actually wrong. ord()'s arguments must be a character for which we expect its ordinal value. >>> chr(16474) '?' Some Chinese symbol. So code-point '?' has a Unicode ordinal value of 16474, correct? where in after encoding this glyph's ordinal value to binary gives us the following bytes: >>> bin(16474).encode('utf-8') b'0b100000001011010' Now, we take tow symbols out: 'b' symbolism which is there to tell us that we are looking a bytes object as well as the '0b' symbolism which is there to tell us that we are looking a binary representation of a bytes object Thus, there we count 15 bits left. So it says 15 bits, which is 1-bit less that 2 bytes. Is the above statements correct please? but thinking this through more and more: >>> chr(16474).encode('utf-8') b'\xe4\x81\x9a' >>> len(b'\xe4\x81\x9a') 3 it seems that the bytestring the encode process produces is of length 3. So i take it is 3 bytes? but there is a mismatch of what >>> bin(16474).encode('utf-8') and >>> chr(16474).encode('utf-8') is telling us here. Care to explain that too please ? From steve+comp.lang.python at pearwood.info Thu Jun 13 03:11:08 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 13 Jun 2013 07:11:08 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> On Thu, 13 Jun 2013 09:09:19 +0300, ???????? ?????? wrote: > On 13/6/2013 3:13 ??, Steven D'Aprano wrote: >> Open an interactive Python session, and run this code: >> >> c = ord(16474) >> len(c.encode('utf-8')) >> >> >> That will tell you how many bytes are used for that example. > This si actually wrong. > > ord()'s arguments must be a character for which we expect its ordinal > value. Gah! That's twice I've screwed that up. Sorry about that! > >>> chr(16474) > '?' > > Some Chinese symbol. > So code-point '?' has a Unicode ordinal value of 16474, correct? Correct. > where in after encoding this glyph's ordinal value to binary gives us > the following bytes: > > >>> bin(16474).encode('utf-8') > b'0b100000001011010' No! That creates a string from 16474 in base two: '0b100000001011010' The leading 0b is just syntax to tell you "this is base 2, not base 8 (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. Then you encode the string '0b100000001011010' into UTF-8. There are 17 characters in this string, and they are all ASCII characters to they take up 1 byte each, giving you bytes b'0b100000001011010' (in ASCII form). In hex form, they are: b'\x30\x62\x31\x30\x30\x30\x30\x30\x30\x30\x31\x30\x31\x31\x30\x31\x30' which takes up a lot more room, which is why Python prefers to show ASCII characters as characters rather than as hex. What you want is: chr(16474).encode('utf-8') [...] > Thus, there we count 15 bits left. > So it says 15 bits, which is 1-bit less that 2 bytes. Is the above > statements correct please? No. There are 17 BYTES there. The string "0" doesn't get turned into a single bit. It still takes up a full byte, 0x30, which is 8 bits. > but thinking this through more and more: > > >>> chr(16474).encode('utf-8') > b'\xe4\x81\x9a' > >>> len(b'\xe4\x81\x9a') > 3 > > it seems that the bytestring the encode process produces is of length 3. Correct! Now you have got the right idea. -- Steven From support at superhost.gr Thu Jun 13 03:42:40 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 10:42:40 +0300 Subject: A few questiosn about encoding In-Reply-To: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >> >>> chr(16474) >> '?' >> >> Some Chinese symbol. >> So code-point '?' has a Unicode ordinal value of 16474, correct? > > Correct. > > >> where in after encoding this glyph's ordinal value to binary gives us >> the following bytes: >> >> >>> bin(16474).encode('utf-8') >> b'0b100000001011010' An observations here that you please confirm as valid. 1. A code-point and the code-point's ordinal value are associated into a Unicode charset. They have the so called 1:1 mapping. So, i was under the impression that by encoding the code-point into utf-8 was the same as encoding the code-point's ordinal value into utf-8. That is why i tried to: bin(16474).encode('utf-8') instead of chr(16474).encode('utf-8') So, now i believe they are two different things. The code-point *is what actually* needs to be encoded and *not* its ordinal value. > The leading 0b is just syntax to tell you "this is base 2, not base 8 > (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. But byte objects are represented as '\x' instead of the aforementioned '0x'. Why is that? > No! That creates a string from 16474 in base two: > '0b100000001011010' I disagree here. 16474 is a number in base 10. Doing bin(16474) we get the binary representation of number 16474 and not a string. Why you say we receive a string while python presents a binary number? > Then you encode the string '0b100000001011010' into UTF-8. There are 17 > characters in this string, and they are all ASCII characters to they take > up 1 byte each, giving you bytes b'0b100000001011010' (in ASCII form). 0b100000001011010 stands for a number in base 2 for me not as a string. Have i understood something wrong? From rosuav at gmail.com Thu Jun 13 03:58:04 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 17:58:04 +1000 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? wrote: > On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >> No! That creates a string from 16474 in base two: >> '0b100000001011010' > > I disagree here. > 16474 is a number in base 10. Doing bin(16474) we get the binary > representation of number 16474 and not a string. > Why you say we receive a string while python presents a binary number? You can disagree all you like. Steven cited a simple point of fact, one which can be verified in any Python interpreter. Nikos, you are flat wrong here; bin(16474) creates a string. ChrisA From support at superhost.gr Thu Jun 13 04:08:04 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 11:08:04 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 13/6/2013 10:58 ??, Chris Angelico wrote: > On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? wrote: >> On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >>> No! That creates a string from 16474 in base two: >>> '0b100000001011010' >> >> I disagree here. >> 16474 is a number in base 10. Doing bin(16474) we get the binary >> representation of number 16474 and not a string. >> Why you say we receive a string while python presents a binary number? > > You can disagree all you like. Steven cited a simple point of fact, > one which can be verified in any Python interpreter. Nikos, you are > flat wrong here; bin(16474) creates a string. Indeed python embraced it in single quoting '0b100000001011010' and not as 0b100000001011010 which in fact makes it a string. But since bin(16474) seems to create a string rather than an expected number(at leat into my mind) then how do we get the binary representation of the number 16474 as a number? From rosuav at gmail.com Thu Jun 13 04:20:38 2013 From: rosuav at gmail.com (Chris Angelico) Date: Thu, 13 Jun 2013 18:20:38 +1000 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Thu, Jun 13, 2013 at 6:08 PM, ???????? ?????? wrote: > On 13/6/2013 10:58 ??, Chris Angelico wrote: >> >> On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? >> wrote: >> >>> On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >>>> >>>> No! That creates a string from 16474 in base two: >>>> '0b100000001011010' >>> >>> >>> I disagree here. >>> 16474 is a number in base 10. Doing bin(16474) we get the binary >>> representation of number 16474 and not a string. >>> Why you say we receive a string while python presents a binary number? >> >> >> You can disagree all you like. Steven cited a simple point of fact, >> one which can be verified in any Python interpreter. Nikos, you are >> flat wrong here; bin(16474) creates a string. > > > Indeed python embraced it in single quoting '0b100000001011010' and not as > 0b100000001011010 which in fact makes it a string. > > But since bin(16474) seems to create a string rather than an expected > number(at leat into my mind) then how do we get the binary representation of > the number 16474 as a number? In Python 2: >>> 16474 In Python 3, you have to fiddle around with ctypes, but broadly speaking, the same thing. ChrisA From support at superhost.gr Thu Jun 13 05:41:41 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 12:41:41 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 13/6/2013 11:20 ??, Chris Angelico wrote: > On Thu, Jun 13, 2013 at 6:08 PM, ???????? ?????? wrote: >> On 13/6/2013 10:58 ??, Chris Angelico wrote: >>> >>> On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? >>> wrote: >>> >>>> On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >>>>> >>>>> No! That creates a string from 16474 in base two: >>>>> '0b100000001011010' >>>> >>>> >>>> I disagree here. >>>> 16474 is a number in base 10. Doing bin(16474) we get the binary >>>> representation of number 16474 and not a string. >>>> Why you say we receive a string while python presents a binary number? >>> >>> >>> You can disagree all you like. Steven cited a simple point of fact, >>> one which can be verified in any Python interpreter. Nikos, you are >>> flat wrong here; bin(16474) creates a string. >> >> >> Indeed python embraced it in single quoting '0b100000001011010' and not as >> 0b100000001011010 which in fact makes it a string. >> >> But since bin(16474) seems to create a string rather than an expected >> number(at leat into my mind) then how do we get the binary representation of >> the number 16474 as a number? > > In Python 2: >>>> 16474 typing 16474 in interactive session both in python 2 and 3 gives back the number 16474 while we want the the binary representation of the number 16474 From steve+comp.lang.python at pearwood.info Thu Jun 13 07:49:44 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 13 Jun 2013 11:49:44 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51b9b1d7$0$29997$c3e8da3$5496439d@news.astraweb.com> On Thu, 13 Jun 2013 12:41:41 +0300, ???????? ?????? wrote: >> In Python 2: >>>>> 16474 > typing 16474 in interactive session both in python 2 and 3 gives back > the number 16474 > > while we want the the binary representation of the number 16474 Python does not work that way. Ints *always* display in decimal. Regardless of whether you enter the decimal in binary: py> 0b100000001011010 16474 octal: py> 0o40132 16474 or hexadecimal: py> 0x405A 16474 ints always display in decimal. The only way to display in another base is to build a string showing what the int would look like in a different base: py> hex(16474) '0x405a' Notice that the return value of bin, oct and hex are all strings. If they were ints, then they would display in decimal, defeating the purpose! -- Steven From support at superhost.gr Thu Jun 13 10:19:47 2013 From: support at superhost.gr (=?UTF-8?B?zp3Ouc66z4zOu86xzr/PgiDOms6/z43Pgc6xz4I=?=) Date: Thu, 13 Jun 2013 17:19:47 +0300 Subject: A few questiosn about encoding In-Reply-To: <51b9b1d7$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51b9b1d7$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 13/6/2013 2:49 ??, Steven D'Aprano wrote: Please confirm these are true statement: A code-point and the code-point's ordinal value are associated into a Unicode charset. They have the so called 1:1 mapping. So, i was under the impression that by encoding the code-point into utf-8 was the same as encoding the code-point's ordinal value into utf-8. So, now i believe they are two different things. The code-point *is what actually* needs to be encoded and *not* its ordinal value. > The leading 0b is just syntax to tell you "this is base 2, not base 8 > (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. But byte objects are represented as '\x' instead of the aforementioned '0x'. Why is that? > ints always display in decimal. The only way to display in another base > is to build a string showing what the int would look like in a different > base: > > py> hex(16474) > '0x405a' > > Notice that the return value of bin, oct and hex are all strings. If they > were ints, then they would display in decimal, defeating the purpose! Thank you didn't knew that! indeed it working like this. To encode a number we have to turn it into a string first. "16474".encode('utf-8') b'16474' That 'b' stand for bytes. How can i view this byte's object representation as hex() or as bin()? ============ Also: >>> len('0b100000001011010') 17 You said this string consists of 17 chars. Why the leading syntax of '0b' counts as bits as well? Shouldn't be 15 bits instead of 17? From cs at zip.com.au Thu Jun 13 21:00:37 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 14 Jun 2013 11:00:37 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <20130614010037.GA18106@cskk.homeip.net> On 13Jun2013 17:19, Nikos as SuperHost Support wrote: | A code-point and the code-point's ordinal value are associated into | a Unicode charset. They have the so called 1:1 mapping. | | So, i was under the impression that by encoding the code-point into | utf-8 was the same as encoding the code-point's ordinal value into | utf-8. | | So, now i believe they are two different things. | The code-point *is what actually* needs to be encoded and *not* its | ordinal value. Because there is a 1:1 mapping, these are the same thing: a code point is directly _represented_ by the ordinal value, and the ordinal value is encoded for storage as bytes. | > The leading 0b is just syntax to tell you "this is base 2, not base 8 | > (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. | | But byte objects are represented as '\x' instead of the | aforementioned '0x'. Why is that? You're confusing a "string representation of a single number in some base (eg 2 or 16)" with the "string-ish representation of a bytes object". The former is just notation for writing a number in different bases, eg: 27 base 10 1b base 16 33 base 8 11011 base 2 A common convention, and the one used by hex(), oct() and bin() in Python, is to prefix the non-base-10 representations with "0x" for base 16, "0o" for base 8 ("o"ctal) and "0b" for base 2 ("b"inary): 27 0x1b 0o33 0b11011 This allows the human reader or a machine lexer to decide what base the number is written in, and therefore to figure out what the underlying numeric value is. Conversely, consider the bytes object consisting of the values [97, 98, 99, 27, 10]. In ASCII (and UTF-8 and the iso-8859-x encodings) these may all represent the characters ['a', 'b', 'c', ESC, NL]. So when "printing" a bytes object, which is a sequence of small integers representing values stored in bytes, it is compact to print: b'abc\x1b\n' which is ['a', 'b', 'c', chr(27), newline]. The slosh (\) is the common convention in C-like languages and many others for representing special characters not directly represents by themselves. So "\\" for a slosh, "\n" for a newline and "\x1b" for character 27 (ESC). The bytes object is still just a sequence on integers, but because it is very common to have those integers represent text, and very common to have some text one want represented as bytes in a direct 1:1 mapping, this compact text form is useful and readable. It is also legal Python syntax for making a small bytes object. To demonstrate that this is just a _representation_, run this: >>> [ i for i in b'abc\x1b\n' ] [97, 98, 99, 27, 10] at an interactive Python 3 prompt. See? Just numbers. | To encode a number we have to turn it into a string first. | | "16474".encode('utf-8') | b'16474' | | That 'b' stand for bytes. Syntactic details. Read this: http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals | How can i view this byte's object representation as hex() or as bin()? See above. A bytes is a _sequence_ of values. hex() and bin() print individual values in hexadecimal or binary respectively. You could do this: for value in b'16474': print(value, hex(value), bin(value)) Cheers, -- Cameron Simpson Uhlmann's Razor: When stupidity is a sufficient explanation, there is no need to have recourse to any other. - Michael M. Uhlmann, assistant attorney general for legislation in the Ford Administration From support at superhost.gr Fri Jun 14 02:59:59 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 09:59:59 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 14/6/2013 4:00 ??, Cameron Simpson wrote: > On 13Jun2013 17:19, Nikos as SuperHost Support wrote: > | A code-point and the code-point's ordinal value are associated into > | a Unicode charset. They have the so called 1:1 mapping. > | > | So, i was under the impression that by encoding the code-point into > | utf-8 was the same as encoding the code-point's ordinal value into > | utf-8. > | > | So, now i believe they are two different things. > | The code-point *is what actually* needs to be encoded and *not* its > | ordinal value. > > Because there is a 1:1 mapping, these are the same thing: a code > point is directly _represented_ by the ordinal value, and the ordinal > value is encoded for storage as bytes. So, you are saying that: chr(16474).encode('utf-8') #being the code-point encoded ord(chr(16474)).encode('utf-8') #being the code-point's ordinal encoded which gives an error. that shows us that a character is what is being be encoded to utf-8 but the character's ordinal cannot. So, whay you say "....and the ordinal value is encoded for storage as bytes." ? > | > The leading 0b is just syntax to tell you "this is base 2, not base 8 > | > (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. > | > | But byte objects are represented as '\x' instead of the > | aforementioned '0x'. Why is that? > > You're confusing a "string representation of a single number in > some base (eg 2 or 16)" with the "string-ish representation of a > bytes object". >>> bin(16474) '0b100000001011010' that is a binary format string representation of number 16474, yes? >>> hex(16474) '0x405a' that is a hexadecimal format string representation of number 16474, yes? WHILE: b'abc\x1b\n' = a string representation of a byte, which in turn is a series of integers, so that makes this a string representation of integers, is this correct? \x1b = ESC character \ = for seperating bytes x = to flag that the following bytes are going to be represented as hex values? whats exactly 'x' means here? character perhaps? Still its not clear into my head what the difference of '0x1b' and '\x1b' is: i think: 0x1b = an integer represented in hex format \x1b = a character represented in hex format id this true? > | How can i view this byte's object representation as hex() or as bin()? > > See above. A bytes is a _sequence_ of values. hex() and bin() print > individual values in hexadecimal or binary respectively. >>> for value in b'\x97\x98\x99\x27\x10': ... print(value, hex(value), bin(value)) ... 151 0x97 0b10010111 152 0x98 0b10011000 153 0x99 0b10011001 39 0x27 0b100111 16 0x10 0b10000 >>> for value in b'abc\x1b\n': ... print(value, hex(value), bin(value)) ... 97 0x61 0b1100001 98 0x62 0b1100010 99 0x63 0b1100011 27 0x1b 0b11011 10 0xa 0b1010 Why these two give different values when printed? -- What is now proved was at first only imagined! From cs at zip.com.au Fri Jun 14 06:14:54 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 14 Jun 2013 20:14:54 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <20130614101454.GA14436@cskk.homeip.net> On 14Jun2013 09:59, Nikos as SuperHost Support wrote: | On 14/6/2013 4:00 ??, Cameron Simpson wrote: | >On 13Jun2013 17:19, Nikos as SuperHost Support wrote: | >| A code-point and the code-point's ordinal value are associated into | >| a Unicode charset. They have the so called 1:1 mapping. | >| | >| So, i was under the impression that by encoding the code-point into | >| utf-8 was the same as encoding the code-point's ordinal value into | >| utf-8. | >| | >| So, now i believe they are two different things. | >| The code-point *is what actually* needs to be encoded and *not* its | >| ordinal value. | > | >Because there is a 1:1 mapping, these are the same thing: a code | >point is directly _represented_ by the ordinal value, and the ordinal | >value is encoded for storage as bytes. | | So, you are saying that: | | chr(16474).encode('utf-8') #being the code-point encoded | | ord(chr(16474)).encode('utf-8') #being the code-point's ordinal | encoded which gives an error. | | that shows us that a character is what is being be encoded to utf-8 | but the character's ordinal cannot. | | So, whay you say "....and the ordinal value is encoded for storage | as bytes." ? No, I mean conceptually, there is no difference between a codepoint and its ordinal value. They are the same thing. Inside Python itself, a character (a string of length 1; there is no separate character type) is a distinct type. Interally, the characters in a string are stored numericly. As Unicode codepoints, as their ordinal values. It is a meaningful idea to store a Python string encoded into bytes using some text encoding scheme (utf-8, iso-8859-7, what have you). It is not a meaningful thing to store a number "encoded" without some more context. The .encode() method that accepts an encoding name like "utf-8" is specificly an encoding procedure FOR TEXT. So strings have such a method, and integers do not. When you write: chr(16474) you receive a _string_, containing the single character whose ordinal is 16474. It is meaningful to transcribe this string to bytes using a text encoding procedure like 'utf-8'. When you write: ord(chr(16474)) you get an integer. Because ord() is the reverse of chr(), you get the integer 16474. Integers do not have .encode() methods that accept a _text_ encoding name like 'utf-8' because integers are not text. | >| > The leading 0b is just syntax to tell you "this is base 2, not base 8 | >| > (0o) or base 10 or base 16 (0x)". Also, leading zero bits are dropped. | >| | >| But byte objects are represented as '\x' instead of the | >| aforementioned '0x'. Why is that? | > | >You're confusing a "string representation of a single number in | >some base (eg 2 or 16)" with the "string-ish representation of a | >bytes object". | | >>> bin(16474) | '0b100000001011010' | that is a binary format string representation of number 16474, yes? Yes. | >>> hex(16474) | '0x405a' | that is a hexadecimal format string representation of number 16474, yes? Yes. | WHILE: | b'abc\x1b\n' = a string representation of a byte, which in turn is a | series of integers, so that makes this a string representation of | integers, is this correct? A "bytes" Python object. So not "a byte", 5 bytes. It is a string representation of the series of byte values, ON THE PREMISE that the bytes may well represent text. On that basis, b'abc\x1b\n' is a reasonable way to display them. In other contexts this might not be a sensible way to display these bytes, and then another format would be chosen, possibly hand constructed by the programmer, or equally reasonable, the hexlify() function from the binascii module. | \x1b = ESC character Considering the bytes to be representing characters, then yes. | \ = for seperating bytes No, \ to introduce a sequence of characters with special meaning. Normally a character in a b'...' item represents the byte value matching the character's Unicode ordinal value. But several characters are hard or confusing to place literally in a b'...' string. For example a newline character or and escape character. 'a' means 65. '\n' means 10 (newline, hence the 'n'). '\x1b' means 33 (escape, value 27, value 0x1b in hexadecimal). And, of course, '\\' means a literal slosh, value 92. | x = to flag that the following bytes are going to be represented as | hex values? whats exactly 'x' means here? character perhaps? A slosh followed by an 'x' means there will be 2 hexadecimal digits to follow, and those two digits represent the byte value. So, yes. | Still its not clear into my head what the difference of '0x1b' and | '\x1b' is: They're the same thing in two similar but slightly different formats. 0x1b is a legitimate "bare" integer value in Python. \x1b is a sequence you find inside strings (and "byte" strings, the b'...' format). | i think: | 0x1b = an integer represented in hex format Yes. | \x1b = a character represented in hex format Yes. | >| How can i view this byte's object representation as hex() or as bin()? | > | >See above. A bytes is a _sequence_ of values. hex() and bin() print | >individual values in hexadecimal or binary respectively. | | >>> for value in b'\x97\x98\x99\x27\x10': | ... print(value, hex(value), bin(value)) | ... | 151 0x97 0b10010111 | 152 0x98 0b10011000 | 153 0x99 0b10011001 | 39 0x27 0b100111 | 16 0x10 0b10000 | | | >>> for value in b'abc\x1b\n': | ... print(value, hex(value), bin(value)) | ... | 97 0x61 0b1100001 | 98 0x62 0b1100010 | 99 0x63 0b1100011 | 27 0x1b 0b11011 | 10 0xa 0b1010 | | | Why these two give different values when printed? 97 is in base 10 (9*10+7=97), but the notation '\x97' is base 16, so 9*16+7=151. Cheers, -- Cameron Simpson I'm Bubba of Borg. Y'all fixin' to be assimilated. From support at superhost.gr Fri Jun 14 09:58:20 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 16:58:20 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 14/6/2013 1:14 ??, Cameron Simpson wrote: > Normally a character in a b'...' item represents the byte value > matching the character's Unicode ordinal value. The only thing that i didn't understood is this line. First please tell me what is a byte value > \x1b is a sequence you find inside strings (and "byte" strings, the > b'...' format). \x1b is a character(ESC) represented in hex format b'\x1b' is a byte object that represents what? >>> chr(27).encode('utf-8') b'\x1b' >>> b'\x1b'.decode('utf-8') '\x1b' After decoding it gives the char ESC in hex format Shouldn't it result in value 27 which is the ordinal of ESC ? > No, I mean conceptually, there is no difference between a code-point > and its ordinal value. They are the same thing. Why Unicode charset doesn't just contain characters, but instead it contains a mapping of (characters <--> ordinals) ? I mean what we do is to encode a character like chr(65).encode('utf-8') What's the reason of existence of its corresponding ordinal value since it doesn't get involved into the encoding process? Thank you very much for taking the time to explain. -- What is now proved was at first only imagined! From joel.goldstick at gmail.com Fri Jun 14 11:21:39 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Fri, 14 Jun 2013 11:21:39 -0400 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: let's cut to the chase and start with telling us what you DO know Nick. That would take less typing On Fri, Jun 14, 2013 at 9:58 AM, Nick the Gr33k wrote: > On 14/6/2013 1:14 ??, Cameron Simpson wrote: > >> Normally a character in a b'...' item represents the byte value >> matching the character's Unicode ordinal value. >> > > The only thing that i didn't understood is this line. > First please tell me what is a byte value > > > \x1b is a sequence you find inside strings (and "byte" strings, the >> b'...' format). >> > > \x1b is a character(ESC) represented in hex format > > b'\x1b' is a byte object that represents what? > > > >>> chr(27).encode('utf-8') > b'\x1b' > > >>> b'\x1b'.decode('utf-8') > '\x1b' > > After decoding it gives the char ESC in hex format > Shouldn't it result in value 27 which is the ordinal of ESC ? > > > No, I mean conceptually, there is no difference between a code-point > > > and its ordinal value. They are the same thing. > > Why Unicode charset doesn't just contain characters, but instead it > contains a mapping of (characters <--> ordinals) ? > > I mean what we do is to encode a character like chr(65).encode('utf-8') > > What's the reason of existence of its corresponding ordinal value since it > doesn't get involved into the encoding process? > > Thank you very much for taking the time to explain. > > -- > What is now proved was at first only imagined! > -- > http://mail.python.org/**mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From support at superhost.gr Fri Jun 14 11:26:08 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 18:26:08 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 14/6/2013 6:21 ??, Joel Goldstick wrote: > let's cut to the chase and start with telling us what you DO know Nick. > That would take less typing Well, my biggest successes up until now where to build 3 websites utilizing database saves and retrievals in PHP in Perl and later in Python with absolute ignorance of Apache Configuration: CGI: Linux: with just basic knowledge of linux. I'am very proud of it. -- What is now proved was at first only imagined! From rosuav at gmail.com Fri Jun 14 13:03:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 15 Jun 2013 03:03:02 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On Sat, Jun 15, 2013 at 1:26 AM, Nick the Gr33k wrote: > Well, my biggest successes up until now where to build 3 websites utilizing > database saves and retrievals > > in PHP > in Perl > and later in Python > > with absolute ignorance of > > Apache Configuration: > CGI: > Linux: > > with just basic knowledge of linux. > I'am very proud of it. Translation: "I just built a car. I don't know anything about internal combustion engines or road rules or metalwork, and I'm very proud of the monstrosity that I'm now selling to my friends." Would you buy a car built by someone who proudly announces that he has no clue how to build one? Why do you sell web hosting services when you have no clue how to provide them? ChrisA From walterhurry at lavabit.com Fri Jun 14 19:32:58 2013 From: walterhurry at lavabit.com (Walter Hurry) Date: Fri, 14 Jun 2013 23:32:58 +0000 (UTC) Subject: A few questiosn about encoding References: Message-ID: On Sat, 15 Jun 2013 03:03:02 +1000, Chris Angelico wrote: > Why do you sell web hosting services when you > have no clue how to provide them? > And why do you continue responding to this timewaster? Please, please just killfile him and let's all move on. From cs at zip.com.au Fri Jun 14 20:26:32 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 15 Jun 2013 10:26:32 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <20130615002632.GA13648@cskk.homeip.net> On 14Jun2013 16:58, Nikos as SuperHost Support wrote: | On 14/6/2013 1:14 ??, Cameron Simpson wrote: | >Normally a character in a b'...' item represents the byte value | >matching the character's Unicode ordinal value. | | The only thing that i didn't understood is this line. | First please tell me what is a byte value The numeric value stored in a byte. Bytes are just small integers in the range 0..255; the values available with 8 bits of storage. | >\x1b is a sequence you find inside strings (and "byte" strings, the | >b'...' format). | | \x1b is a character(ESC) represented in hex format Yes. | b'\x1b' is a byte object that represents what? An array of 1 byte, whose value is 0x1b or 27. | >>> chr(27).encode('utf-8') | b'\x1b' Transcribing the ESC Unicode character to byte storage. | >>> b'\x1b'.decode('utf-8') | '\x1b' Reading a single byte array containing a 27 and decoding it assuming 'utf-8'. This obtains a single character string containing the ESC character. | After decoding it gives the char ESC in hex format | Shouldn't it result in value 27 which is the ordinal of ESC ? When printing strings, the non-printable characters in the string are _represented_ in hex format, so \x1b was printed. | > No, I mean conceptually, there is no difference between a code-point | > and its ordinal value. They are the same thing. | | Why Unicode charset doesn't just contain characters, but instead it | contains a mapping of (characters <--> ordinals) ? Look, as far as a computer is concerned a character and an ordinal are the same thing because you just store character ordinals in memory when you store a string. When characters are _displayed_, your Terminal (or web browser or whatever) takes character ordinals and looks them up in a _font_, which is a mapping of character ordinals to glyphs (character images), and renders the character image onto your screen. | I mean what we do is to encode a character like chr(65).encode('utf-8') | What's the reason of existence of its corresponding ordinal value | since it doesn't get involved into the encoding process? Stop thinking of Unicode code points and ordinal values as separate things. They are effectively two terms for the same thing. So there is no "corresponding ordinal value". 65 _is_ the ordinal value. When you run: chr(65).encode('utf-8') you're going: chr(65) ==> 'A' Producing a string with just one character in it. Internally, Python stores an array of character ordinals, thus: [65] 'A'.encode('utf-8') Walk along all the ordinals in the string and transribe them as bytes. For 65, the byte encoding in 'utf-8' is a single byte of value 65. So you get an array of bytes (a "bytes object" in Python), thus: [65] -- Cameron Simpson The double cam chain setup on the 1980's DOHC CB750 was another one of Honda's pointless engineering breakthroughs. You know the cycle (if you'll pardon the pun :-), Wonderful New Feature is introduced with much fanfare, WNF is fawned over by the press, WNF is copied by the other three Japanese makers (this step is sometimes optional), and finally, WNF is quietly dropped by Honda. - Blaine Gardner, From denismfmcmahon at gmail.com Sat Jun 15 02:34:46 2013 From: denismfmcmahon at gmail.com (Denis McMahon) Date: Sat, 15 Jun 2013 06:34:46 +0000 (UTC) Subject: A few questiosn about encoding References: Message-ID: On Fri, 14 Jun 2013 16:58:20 +0300, Nick the Gr33k wrote: > On 14/6/2013 1:14 ??, Cameron Simpson wrote: >> Normally a character in a b'...' item represents the byte value >> matching the character's Unicode ordinal value. > The only thing that i didn't understood is this line. > First please tell me what is a byte value Seriously? You don't understand the term byte? And you're the support desk for a webhosting company? -- Denis McMahon, denismfmcmahon at gmail.com From invalid at invalid.invalid Sat Jun 15 10:44:55 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Sat, 15 Jun 2013 14:44:55 +0000 (UTC) Subject: A few questiosn about encoding References: Message-ID: On 2013-06-15, Denis McMahon wrote: > On Fri, 14 Jun 2013 16:58:20 +0300, Nick the Gr33k wrote: > >> On 14/6/2013 1:14 ????, Cameron Simpson wrote: >>> Normally a character in a b'...' item represents the byte value >>> matching the character's Unicode ordinal value. > >> The only thing that i didn't understood is this line. >> First please tell me what is a byte value > > Seriously? You don't understand the term byte? And you're the support > desk for a webhosting company? Well, we haven't had this thread for a week or so... There is some ambiguity in the term "byte". It used to mean the smallest addressable unit of memory (which varied in the past -- at one point, both 20 and 60 bit "bytes" were common). These days the smallest addressable unit of memory is almost always 8 bits on desktop and embedded processors (but often not on DSPs). That's why when IEEE stadards want to refer to an 8-bit chunk of data they use the term "octet". :) From support at superhost.gr Sat Jun 15 10:49:13 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 17:49:13 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 15/6/2013 5:44 ??, Grant Edwards wrote: > There is some ambiguity in the term "byte". It used to mean the > smallest addressable unit of memory (which varied in the past -- at > one point, both 20 and 60 bit "bytes" were common). These days the > smallest addressable unit of memory is almost always 8 bits on desktop > and embedded processors (but often not on DSPs). That's why when IEEE > stadards want to refer to an 8-bit chunk of data they use the term > "octet". What the difference between a byte and a byte's value? -- What is now proved was at first only imagined! From steve+comp.lang.python at pearwood.info Sat Jun 15 11:30:18 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 15:30:18 GMT Subject: A few questiosn about encoding References: Message-ID: <51bc888a$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 17:49:13 +0300, Nick the Gr33k wrote: > What the difference between a byte and a byte's value? Nothing. -- Steven From roy at panix.com Sat Jun 15 10:59:32 2013 From: roy at panix.com (Roy Smith) Date: Sat, 15 Jun 2013 10:59:32 -0400 Subject: A few questiosn about encoding References: Message-ID: In article , Grant Edwards wrote: > There is some ambiguity in the term "byte". It used to mean the > smallest addressable unit of memory (which varied in the past -- at > one point, both 20 and 60 bit "bytes" were common). I would have defined it more like, "some arbitrary collection of adjacent bits which hold some useful value". Doesn't need to be addressable, nor does it need to be the smallest such thing. For example, on the pdp-10 (36 bit word), it was common to treat a word as either four 9-bit bytes, or five 7-bit bytes (with one bit left over), depending on what you were doing. And, of course, a nybble was something smaller than a byte! And, yes, especially in networking, everybody talks about octets when they want to make sure people understand what they mean. From support at superhost.gr Sat Jun 15 11:14:02 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 18:14:02 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 15/6/2013 5:59 ??, Roy Smith wrote: > And, yes, especially in networking, everybody talks about octets when > they want to make sure people understand what they mean. 1 byte = 8 bits in networking though since we do not use encoding schemes with variable lengths like utf-8 is, how do we separate when a byte value start and when it stops? do we need a start bit and a stop bit for that? -- What is now proved was at first only imagined! From joel.goldstick at gmail.com Sat Jun 15 11:35:17 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Sat, 15 Jun 2013 11:35:17 -0400 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On Sat, Jun 15, 2013 at 11:14 AM, Nick the Gr33k wrote: > On 15/6/2013 5:59 ??, Roy Smith wrote: > > And, yes, especially in networking, everybody talks about octets when >> they want to make sure people understand what they mean. >> > > 1 byte = 8 bits > > in networking though since we do not use encoding schemes with variable > lengths like utf-8 is, how do we separate when a byte value start and when > it stops? > > do we need a start bit and a stop bit for that? > > > And this is specific to python how? > > > > -- > What is now proved was at first only imagined! > -- > http://mail.python.org/**mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From support at superhost.gr Sat Jun 15 15:26:24 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 22:26:24 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 14/6/2013 4:58 ??, Nick the Gr33k wrote: > On 14/6/2013 1:14 ??, Cameron Simpson wrote: >> Normally a character in a b'...' item represents the byte value >> matching the character's Unicode ordinal value. > > The only thing that i didn't understood is this line. > First please tell me what is a byte value > >> \x1b is a sequence you find inside strings (and "byte" strings, the >> b'...' format). > > \x1b is a character(ESC) represented in hex format > > b'\x1b' is a byte object that represents what? > > > >>> chr(27).encode('utf-8') > b'\x1b' > > >>> b'\x1b'.decode('utf-8') > '\x1b' > > After decoding it gives the char ESC in hex format > Shouldn't it result in value 27 which is the ordinal of ESC ? > > > No, I mean conceptually, there is no difference between a code-point > > and its ordinal value. They are the same thing. > > Why Unicode charset doesn't just contain characters, but instead it > contains a mapping of (characters <--> ordinals) ? > > I mean what we do is to encode a character like chr(65).encode('utf-8') > > What's the reason of existence of its corresponding ordinal value since > it doesn't get involved into the encoding process? > > Thank you very much for taking the time to explain. Can someone please explain these questions too? -- What is now proved was at first only imagined! From benjamin at schollnick.net Sat Jun 15 16:35:48 2013 From: benjamin at schollnick.net (Benjamin Schollnick) Date: Sat, 15 Jun 2013 16:35:48 -0400 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <7DD56BB4-A7B2-4A48-961A-03065A349995@schollnick.net> Nick, >> The only thing that i didn't understood is this line. >> First please tell me what is a byte value >> >>> \x1b is a sequence you find inside strings (and "byte" strings, the >>> b'...' format). >> >> \x1b is a character(ESC) represented in hex format >> >> b'\x1b' is a byte object that represents what? >> >> >> >>> chr(27).encode('utf-8') >> b'\x1b' >> >> >>> b'\x1b'.decode('utf-8') >> '\x1b' >> >> After decoding it gives the char ESC in hex format >> Shouldn't it result in value 27 which is the ordinal of ESC ? I'm sorry are you not listening? 1b is a HEXADECIMAL Number. As a so-called programmer, did you seriously not consider that? Try this: 1) Open a Web browser 2) Go to Google.com 3) Type in "Hex 1B" 4) Click on the first link 5) In the Hexadecimal column find 1B. Or open your favorite calculator, and convert Hexadecimal 1B to Decimal (Base 10). - Benjamin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kwpolska at gmail.com Sun Jun 16 09:45:50 2013 From: kwpolska at gmail.com (=?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?=) Date: Sun, 16 Jun 2013 15:45:50 +0200 Subject: A few questiosn about encoding In-Reply-To: <7DD56BB4-A7B2-4A48-961A-03065A349995@schollnick.net> References: <7DD56BB4-A7B2-4A48-961A-03065A349995@schollnick.net> Message-ID: On Sat, Jun 15, 2013 at 10:35 PM, Benjamin Schollnick wrote: > Nick, > > The only thing that i didn't understood is this line. > First please tell me what is a byte value > > \x1b is a sequence you find inside strings (and "byte" strings, the > b'...' format). > > > \x1b is a character(ESC) represented in hex format > > b'\x1b' is a byte object that represents what? > > >>>> chr(27).encode('utf-8') > b'\x1b' > >>>> b'\x1b'.decode('utf-8') > '\x1b' > > After decoding it gives the char ESC in hex format > Shouldn't it result in value 27 which is the ordinal of ESC ? > > > I'm sorry are you not listening? > > 1b is a HEXADECIMAL Number. As a so-called programmer, did you seriously > not consider that? > > Try this: > > 1) Open a Web browser > 2) Go to Google.com > 3) Type in "Hex 1B" > 4) Click on the first link > 5) In the Hexadecimal column find 1B. > > Or open your favorite calculator, and convert Hexadecimal 1B to Decimal > (Base 10). > > - Benjamin > > > > -- > http://mail.python.org/mailman/listinfo/python-list > Better: a programmer should know how to convert hexadecimal to decimal. 0x1B = (0x1 * 16^1) + (0xB * 16^0) = (1 * 16) + (11 * 1) = 16 + 11 = 27 It?s that easy, and a programmer should be able to do that in their brain, at least with small numbers. Or at least know that: http://lmgtfy.com/?q=0x1B+in+decimal Or at least `hex(27)`; or '`{:X}'.format(27)`; or `'%X' % 27`. (I despise hex numbers with lowercase letters, but that?s my personal opinion.) -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html From antoon.pardon at rece.vub.ac.be Fri Jun 14 03:36:29 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 09:36:29 +0200 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BAC7FD.2060404@rece.vub.ac.be> Op 13-06-13 10:08, ???????? ?????? schreef: > On 13/6/2013 10:58 ??, Chris Angelico wrote: >> On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? >> wrote: >>> On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >>>> No! That creates a string from 16474 in base two: >>>> '0b100000001011010' >>> >>> I disagree here. >>> 16474 is a number in base 10. Doing bin(16474) we get the binary >>> representation of number 16474 and not a string. >>> Why you say we receive a string while python presents a binary number? >> >> You can disagree all you like. Steven cited a simple point of fact, >> one which can be verified in any Python interpreter. Nikos, you are >> flat wrong here; bin(16474) creates a string. > > Indeed python embraced it in single quoting '0b100000001011010' and > not as 0b100000001011010 which in fact makes it a string. > > But since bin(16474) seems to create a string rather than an expected > number(at leat into my mind) then how do we get the binary > representation of the number 16474 as a number? You don't. You should remember that python (or any programming language) doesn't print numbers. It always prints string representations of numbers. It is just so that we are so used to the decimal representation that we think of that representation as being the number. Normally that is not a problem but it can cause confusion when you are working with mulitple representations. -- Antoon Pardon From support at superhost.gr Fri Jun 14 03:49:51 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 10:49:51 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 14/6/2013 10:36 ??, Antoon Pardon wrote: > Op 13-06-13 10:08, ???????? ?????? schreef: >> On 13/6/2013 10:58 ??, Chris Angelico wrote: >>> On Thu, Jun 13, 2013 at 5:42 PM, ???????? ?????? >>> wrote: >>>> On 13/6/2013 10:11 ??, Steven D'Aprano wrote: >>>>> No! That creates a string from 16474 in base two: >>>>> '0b100000001011010' >>>> >>>> I disagree here. >>>> 16474 is a number in base 10. Doing bin(16474) we get the binary >>>> representation of number 16474 and not a string. >>>> Why you say we receive a string while python presents a binary number? >>> >>> You can disagree all you like. Steven cited a simple point of fact, >>> one which can be verified in any Python interpreter. Nikos, you are >>> flat wrong here; bin(16474) creates a string. >> >> Indeed python embraced it in single quoting '0b100000001011010' and >> not as 0b100000001011010 which in fact makes it a string. >> >> But since bin(16474) seems to create a string rather than an expected >> number(at leat into my mind) then how do we get the binary >> representation of the number 16474 as a number? > > You don't. You should remember that python (or any programming language) > doesn't print numbers. It always prints string representations of > numbers. It is just so that we are so used to the decimal representation > that we think of that representation as being the number. > > Normally that is not a problem but it can cause confusion when you are > working with mulitple representations. Hold on! Youa re basically saying here that: >>> 16474 16474 is nto a number as we think but instead is string representation of a number? I dont think so, if it were a string representation of a number that would print the following: >>> 16474 '16474' Python prints numbers: >>> 16474 16474 >>> 0b100000001011010 16474 >>> 0x405a 16474 it prints them all to decimal format though. but when we need a decimal integer to be turned into bin() or hex() we can bin(number) hex(number) and just remove the pair of single quoting. -- What is now proved was at first only imagined! From antoon.pardon at rece.vub.ac.be Fri Jun 14 04:22:31 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 10:22:31 +0200 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BAD2C7.8050002@rece.vub.ac.be> Op 14-06-13 09:49, Nick the Gr33k schreef: > On 14/6/2013 10:36 ??, Antoon Pardon wrote: >> Op 13-06-13 10:08, ???????? ?????? schreef: >>> >>> Indeed python embraced it in single quoting '0b100000001011010' and >>> not as 0b100000001011010 which in fact makes it a string. >>> >>> But since bin(16474) seems to create a string rather than an expected >>> number(at leat into my mind) then how do we get the binary >>> representation of the number 16474 as a number? >> >> You don't. You should remember that python (or any programming language) >> doesn't print numbers. It always prints string representations of >> numbers. It is just so that we are so used to the decimal representation >> that we think of that representation as being the number. >> >> Normally that is not a problem but it can cause confusion when you are >> working with mulitple representations. > Hold on! > Youa re basically saying here that: > > > >>> 16474 > 16474 > > is nto a number as we think but instead is string representation of a > number? Yes, or if you prefer what python prints is the decimal notation of the number. > > I dont think so, if it were a string representation of a number that > would print the following: > > >>> 16474 > '16474' No it wouldn't, You are confusing representation in the everyday meaning with representation as python jargon. > Python prints numbers: No it doesn't, numbers are abstract concepts that can be represented in various notations, these notations are strings. Those notaional strings end up being printed. As I said before we are so used in using the decimal notation that we often use the notation and the number interchangebly without a problem. But when we are working with multiple notations that can become confusing and we should be careful to seperate numbers from their representaions/notations. > but when we need a decimal integer There are no decimal integers. There is only a decimal notation of the number. Decimal, octal etc are not characteristics of the numbers themselves. -- Antoon Pardon From support at superhost.gr Fri Jun 14 04:37:02 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 11:37:02 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 14/6/2013 11:22 ??, Antoon Pardon wrote: >> Python prints numbers: > No it doesn't, numbers are abstract concepts that can be represented in > various notations, these notations are strings. Those notaional strings > end up being printed. As I said before we are so used in using the > decimal notation that we often use the notation and the number interchangebly > without a problem. But when we are working with multiple notations that > can become confusing and we should be careful to seperate numbers from their > representaions/notations. How do we separate a number then from its represenation-natation? What is a notation anywat? is it a way of displayment? but that would be a represeantion then.... Please explain this line as it uses both terms. No it doesn't, numbers are abstract concepts that can be represented in various notations >> but when we need a decimal integer > > There are no decimal integers. There is only a decimal notation of the number. > Decimal, octal etc are not characteristics of the numbers themselves. So everything we see like: 16474 nikos abc123 everything is a string and nothing is a number? not even number 1? -- What is now proved was at first only imagined! From modelnine at modelnine.org Fri Jun 14 05:06:55 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Fri, 14 Jun 2013 11:06:55 +0200 Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BADD2F.6010006@modelnine.org> Am 14.06.2013 10:37, schrieb Nick the Gr33k: > So everything we see like: > > 16474 > nikos > abc123 > > everything is a string and nothing is a number? not even number 1? Come on now, this is _so_ obviously trolling, it's not even remotely funny anymore. Why doesn't killfiling work with the mailing list version of the python list? :-( -- --- Heiko. From fabiosantosart at gmail.com Fri Jun 14 06:20:53 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Fri, 14 Jun 2013 11:20:53 +0100 Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) In-Reply-To: <51BADD2F.6010006@modelnine.org> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: On 14 Jun 2013 10:20, "Heiko Wundram" wrote: > > Am 14.06.2013 10:37, schrieb Nick the Gr33k: >> >> So everything we see like: >> >> 16474 >> nikos >> abc123 >> >> everything is a string and nothing is a number? not even number 1? > > > Come on now, this is _so_ obviously trolling, it's not even remotely funny anymore. Why doesn't killfiling work with the mailing list version of the python list? :-( I have skimmed the archives for this month, and I estimate that a third of this month's activity on this list was helping this person. About 80% of that is wasted in explaining basic concepts he refuses to read in links given to him. A depressingly large number of replies to his posts are seemingly ignored. Since this is a lot of spam, I feel like leaving the list, but I also honestly want to help people use python and the replies to questions of others often give me much insight on several matters. -------------- next part -------------- An HTML attachment was scrubbed... URL: From breamoreboy at yahoo.co.uk Fri Jun 14 07:57:02 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Fri, 14 Jun 2013 12:57:02 +0100 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: On 14/06/2013 11:20, F?bio Santos wrote: > > Since this is a lot of spam, I feel like leaving the list, but I also > honestly want to help people use python and the replies to questions of > others often give me much insight on several matters. > Plenty of genuine people needing genuine help on the tutor mailing list, or have you been there already? -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From rustompmody at gmail.com Fri Jun 14 07:51:46 2013 From: rustompmody at gmail.com (rusi) Date: Fri, 14 Jun 2013 04:51:46 -0700 (PDT) Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> On Jun 14, 3:20?pm, F?bio Santos wrote: > > Come on now, this is _so_ obviously trolling, it's not even remotely > > funny anymore. Why doesn't killfiling work with the mailing list version of > the python list? :-( > > I have skimmed the archives for this month, and I estimate that a third of > this month's activity on this list was helping this person. About 80% of > that is wasted in explaining basic concepts he refuses to read in links > given to him. A depressingly large number of replies to his posts are > seemingly ignored. > > Since this is a lot of spam, I feel like leaving the list, but I also > honestly want to help people use python and the replies to questions of > others often give me much insight on several matters. Adding my +1 to this sentiment. In older saner and more politically incorrect times, when there was a student who was as idiotic as Nikos, he would be made to: -- run five rounds of the field -- stay after school -- write pages of "I shall not talk in class" In the age of cut-n-paste the last has lost its sting. Likewise the first two are hard to administer across the internet. Still if we are genuinely interested in solving this problem, ways may be found, for example: Any question from Nikos that has any English error, should be returned with: Correct your English before we look at your python. If he is brazen enough to correct one error and leave the other 35, then we put in a 24-hour delay for each reply. I am sure others can come up with better solutions if we wish. The alternative is that this disease has an unfavorable prognosis: [Yes Nikos is an infectious disease: I believe I can pull out mails from Steven and Grant Edwards whic hare begng tolook sspcicious ly like Nikos [Sorry Im not much good at imitation!] ] And that unfavorable prognosis is what Fabio is suggesting -- people will start leaving the list/group. Nikos: This is not against you personally. Just your current mode of conduct towards this list. And that mode quite simply is this: You have no interest in python, you are only interested in the immediate questions of your web-hosting. From rustompmody at gmail.com Fri Jun 14 08:09:05 2013 From: rustompmody at gmail.com (rusi) Date: Fri, 14 Jun 2013 05:09:05 -0700 (PDT) Subject: Don't feed the help-vampire References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> Message-ID: On Jun 14, 4:51?pm, rusi wrote: > On Jun 14, 3:20?pm, F?bio Santos wrote: > > > > Come on now, this is _so_ obviously trolling, it's not even remotely > > > funny anymore. Why doesn't killfiling work with the mailing list version of > > the python list? :-( > > > I have skimmed the archives for this month, and I estimate that a third of > > this month's activity on this list was helping this person. About 80% of > > that is wasted in explaining basic concepts he refuses to read in links > > given to him. A depressingly large number of replies to his posts are > > seemingly ignored. > > > Since this is a lot of spam, I feel like leaving the list, but I also > > honestly want to help people use python and the replies to questions of > > others often give me much insight on several matters. > > Adding my +1 to this sentiment. Since identifying a disease by the right name is key to finding a cure: Nikos is not trolling or spamming; he is help-vampiring. Lets call it that. From modelnine at modelnine.org Fri Jun 14 08:31:53 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Fri, 14 Jun 2013 14:31:53 +0200 Subject: Don't feed the help-vampire In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> Message-ID: <51BB0D39.3030908@modelnine.org> Am 14.06.2013 14:09, schrieb rusi: > Since identifying a disease by the right name is key to finding a > cure: > Nikos is not trolling or spamming; he is help-vampiring. Just to explain the trolling allegation: I'm not talking about him wanting to get his scripts fixed, that's help-vampiring most certainly, and an extreme form of that (thanks btw. for pointing me to that term, whoever did). I was talking about his repeated attempts at "making conversation" by asking questions about encoding, short-circuit evaluation and such which seem like they are relevant for him to solve his problem, but due to his persistence of understanding things in a wrong way/not understanding them at all/repeating the same misunderstandings time after time have drifted off into endless repetitions of the same facts by helpful posters, and have gotten a lot of people seriously annoyed (also, due to other facts such as him changing his NNTP hosts and/or From-addresses which breaks kill-filing). Now, if that latter behaviour isn't trolling, I don't know what is. Simply nobody who takes what he does at least a little bit serious is _as_ thick as he makes himself seem. -- --- Heiko. From ian.g.kelly at gmail.com Fri Jun 14 12:51:46 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 14 Jun 2013 10:51:46 -0600 Subject: Don't feed the help-vampire In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> Message-ID: On Fri, Jun 14, 2013 at 6:09 AM, rusi wrote: > Since identifying a disease by the right name is key to finding a > cure: > Nikos is not trolling or spamming; he is help-vampiring. I think he's a very dedicated troll elaborately disguised as a help vampire. Remember that one of the names he previously used to post to this list was "Ferrous Cranus". http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm From support at superhost.gr Fri Jun 14 08:50:37 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 15:50:37 +0300 Subject: Don't feed the troll... In-Reply-To: <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> Message-ID: On 14/6/2013 2:51 ??, rusi wrote: > Nikos: > This is not against you personally. Just your current mode of conduct > towards this list. > And that mode quite simply is this: You have no interest in python, > you are only interested in the immediate questions of your web-hosting. If that was True i wouldn't be asking to be given detailed explanations of a solution provided to me, neither would i been asked to understand why the way i tried it is wrong and what was the correct way of writing the code and why. So, if i had no interest of actually learning python i would just cut n' paste provided code without worrying what it actually does, since knowing that came form you would be enough to know that works. -- What is now proved was at first only imagined! From schesis at gmail.com Fri Jun 14 09:33:06 2013 From: schesis at gmail.com (Zero Piraeus) Date: Fri, 14 Jun 2013 09:33:06 -0400 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <8c0ca270-1ccc-44c7-a85a-05ebd1ec9b52@v10g2000pbv.googlegroups.com> Message-ID: : On 14 June 2013 08:50, Nick the Gr33k wrote: > > So, if i had no interest of actually learning python i would just cut n' > paste provided code without worrying what it actually does, since knowing > that came form you would be enough to know that works. Worrying what it actually does is good; an inquiring mind is a prerequisite for becoming a good programmer. Another prerequisite is discipline. That means the discipline to try and work out for yourself what's going on, rather than repeatedly spamming this list with trivial enquiries. It also means the discipline to both read and type carefully: until and unless you learn to take more care in how you express yourself, both in code and in prose, you will be plagued by syntax errors and frustrated responses respectively. I have only skimmed it, but you might find the following tutorial helpful: http://learnpythonthehardway.org/ Many of the early exercises may seem too basic, and you'll be tempted to skip them - given your conduct here, I imagine you'll be *strongly* tempted to skip them. Don't. You need to learn discipline. -[]z. From support at superhost.gr Fri Jun 14 08:45:15 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 15:45:15 +0300 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: On 14/6/2013 1:20 ??, F?bio Santos wrote: > > On 14 Jun 2013 10:20, "Heiko Wundram" > wrote: > > > > Am 14.06.2013 10:37, schrieb Nick the Gr33k: > >> > >> So everything we see like: > >> > >> 16474 > >> nikos > >> abc123 > >> > >> everything is a string and nothing is a number? not even number 1? > > > > > > Come on now, this is _so_ obviously trolling, it's not even remotely > funny anymore. Why doesn't killfiling work with the mailing list version > of the python list? :-( > > I have skimmed the archives for this month, and I estimate that a third > of this month's activity on this list was helping this person. About 80% > of that is wasted in explaining basic concepts he refuses to read in > links given to him. A depressingly large number of replies to his posts > are seemingly ignored. > > Since this is a lot of spam, I feel like leaving the list, but I also > honestly want to help people use python and the replies to questions of > others often give me much insight on several matters. > I'am not spamming and as you say i dare to ask what other don't if they don't understand something. I'am not trolling and actually help people with my questions(as you admitted yourself) and you are helping with your replies. we are all benefit out of this. -- What is now proved was at first only imagined! From modelnine at modelnine.org Fri Jun 14 08:58:05 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Fri, 14 Jun 2013 14:58:05 +0200 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: <51BB135D.9050002@modelnine.org> Am 14.06.2013 14:45, schrieb Nick the Gr33k: > we are all benefit out of this. Let's nominate you for a nobel prize, saviour of python-list! -- --- Heiko. From fabiosantosart at gmail.com Fri Jun 14 09:25:54 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Fri, 14 Jun 2013 14:25:54 +0100 Subject: Don't feed the troll... In-Reply-To: <51BB135D.9050002@modelnine.org> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <51BB135D.9050002@modelnine.org> Message-ID: On Fri, Jun 14, 2013 at 1:58 PM, Heiko Wundram wrote: > Am 14.06.2013 14:45, schrieb Nick the Gr33k: > >> we are all benefit out of this. > > > Let's nominate you for a nobel prize, saviour of python-list! > I don't want to be saved. I just found out how to mute conversations in gmail. -- F?bio Santos From breamoreboy at yahoo.co.uk Fri Jun 14 12:12:00 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Fri, 14 Jun 2013 17:12:00 +0100 Subject: Don't feed the troll... In-Reply-To: <51BB135D.9050002@modelnine.org> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <51BB135D.9050002@modelnine.org> Message-ID: On 14/06/2013 13:58, Heiko Wundram wrote: > Am 14.06.2013 14:45, schrieb Nick the Gr33k: >> we are all benefit out of this. > > Let's nominate you for a nobel prize, saviour of python-list! > The Nobel prize is unsuited in a situation like this, maybe the ACM Turing Award? -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From darcy at druid.net Fri Jun 14 13:13:23 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Fri, 14 Jun 2013 13:13:23 -0400 Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) In-Reply-To: <51BADD2F.6010006@modelnine.org> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> Message-ID: <20130614131323.16c4fbd3@imp> On Fri, 14 Jun 2013 11:06:55 +0200 Heiko Wundram wrote: > Come on now, this is _so_ obviously trolling, it's not even remotely > funny anymore. Why doesn't killfiling work with the mailing list > version of the python list? :-( A big problem, other than Mr. Support's shenanigans with his email address, is that even those of us who seem to have successfully *plonked* him get the responses to him. The biggest issue with a troll isn't so much the annoying emails from him but the amplified slew of responses. That's the point of a troll after all. The answer is to always make sure that you include the previous poster in the reply as a Cc or To. I filter out any email that has the string "support at superhost.gr" in a header so I would also filter out the replies if people would follow that simple rule. I have suggested this before but the push back I get is that then people would get two copies of the email, one to them and one to the list. My answer is simple. Get a proper email system that filters out duplicates. Is there an email client out there that does not have this facility? -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From rosuav at gmail.com Fri Jun 14 13:31:12 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sat, 15 Jun 2013 03:31:12 +1000 Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) In-Reply-To: <20130614131323.16c4fbd3@imp> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> Message-ID: On Sat, Jun 15, 2013 at 3:13 AM, D'Arcy J.M. Cain wrote: > The answer is to always make sure that you include the previous poster > in the reply as a Cc or To. I filter out any email that has the string > "support at superhost.gr" in a header so I would also filter out the > replies if people would follow that simple rule. > > I have suggested this before but the push back I get is that then > people would get two copies of the email, one to them and one to the > list. My answer is simple. Get a proper email system that filters out > duplicates. Is there an email client out there that does not have this > facility? The main downside to that is not the first response, to somebody at somewhere and python-list, but the subsequent ones. Do you include everyone's addresses? And if so, how do they then get off the list? (This is a serious consideration. I had some very angry people asking me to unsubscribe them from a (private) mailman list I run, but they weren't subscribed at all - they were being cc'd.) I prefer to simply mail the list. You should be able to mute entire threads, and he doesn't start more than a couple a day usually. ChrisA From darcy at druid.net Fri Jun 14 13:56:19 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Fri, 14 Jun 2013 13:56:19 -0400 Subject: Don't feed the troll In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> Message-ID: <20130614135619.425d264d@imp> On Sat, 15 Jun 2013 03:31:12 +1000 Chris Angelico wrote: > On Sat, Jun 15, 2013 at 3:13 AM, D'Arcy J.M. Cain > wrote: > > I have suggested this before but the push back I get is that then > > people would get two copies of the email, one to them and one to the > > list. My answer is simple. Get a proper email system that filters > > out duplicates. Is there an email client out there that does not > > have this facility? > > The main downside to that is not the first response, to > somebody at somewhere and python-list, but the subsequent ones. Do you > include everyone's addresses? And if so, how do they then get off the No, I think Ccing the From is enough. Other than the OP who is already *plonked* replies to the replies tend to have at least a modicum of information. > I prefer to simply mail the list. You should be able to mute entire > threads, and he doesn't start more than a couple a day usually. But then I have to deal with each thread. I don't want to deal with them at all. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From python.list at tim.thechases.com Fri Jun 14 15:00:17 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Fri, 14 Jun 2013 14:00:17 -0500 Subject: Don't feed the troll In-Reply-To: <20130614135619.425d264d@imp> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> <20130614135619.425d264d@imp> Message-ID: <20130614140017.63d74da4@bigbox.christie.dr> On 2013-06-14 13:56, D'Arcy J.M. Cain wrote: > > I prefer to simply mail the list. You should be able to mute > > entire threads, and he doesn't start more than a couple a day > > usually. > > But then I have to deal with each thread. I don't want to deal with > them at all. At least Thunderbird had the ability to set up a filter of the form "If the sender matches 'xyz at example.com' then kill this thread" so the thread-killing (or sub-thread killing) was automatic. I set that up for Xah posts and my life was far better. I've since switched to Claws for my mail and miss that kill-thread functionality. :-/ -tkc From darcy at druid.net Fri Jun 14 15:17:10 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Fri, 14 Jun 2013 15:17:10 -0400 Subject: Don't feed the troll In-Reply-To: <20130614140017.63d74da4@bigbox.christie.dr> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> <20130614135619.425d264d@imp> <20130614140017.63d74da4@bigbox.christie.dr> Message-ID: <20130614151710.45aa1e46@imp> On Fri, 14 Jun 2013 14:00:17 -0500 Tim Chase wrote: > I set that up for Xah posts and my life was far better. Has he disappeared or is my filtering just really successful? > I've since switched to Claws for my mail and miss that kill-thread > functionality. :-/ Heh. Exactly what I am using. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From invalid at invalid.invalid Fri Jun 14 15:40:10 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Fri, 14 Jun 2013 19:40:10 +0000 (UTC) Subject: Don't feed the troll... (was: Re: A few questiosn about encoding) References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> Message-ID: On 2013-06-14, Chris Angelico wrote: > On Sat, Jun 15, 2013 at 3:13 AM, D'Arcy J.M. Cain wrote: >> The answer is to always make sure that you include the previous poster >> in the reply as a Cc or To. I filter out any email that has the string >> "support at superhost.gr" in a header so I would also filter out the >> replies if people would follow that simple rule. >> >> I have suggested this before but the push back I get is that then >> people would get two copies of the email, one to them and one to the >> list. My answer is simple. Get a proper email system that filters out >> duplicates. Is there an email client out there that does not have this >> facility? > > The main downside to that is not the first response, to > somebody at somewhere and python-list, but the subsequent ones. Do you > include everyone's addresses? And if so, how do they then get off the > list? (This is a serious consideration. I had some very angry people > asking me to unsubscribe them from a (private) mailman list I run, but > they weren't subscribed at all - they were being cc'd.) I think the answer is to automatically kill all threads stared by "him". Unfortunately, I don't know if that's possible in most newsreaders. -- Grant Edwards grant.b.edwards Yow! A dwarf is passing out at somewhere in Detroit! gmail.com From ben+python at benfinney.id.au Fri Jun 14 20:42:20 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Sat, 15 Jun 2013 10:42:20 +1000 Subject: Don't feed the troll... References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <51BADD2F.6010006@modelnine.org> <20130614131323.16c4fbd3@imp> Message-ID: <7wfvwkcihf.fsf@benfinney.id.au> "D'Arcy J.M. Cain" writes: > The answer is to always make sure that you include the previous poster > in the reply as a Cc or To. Dragging the discussion from one forum (comp.lang.python) to another (every person's individual email) is obnoxious. Please don't. > I have suggested this before but the push back I get is that then > people would get two copies of the email, one to them and one to the > list. In my case, I don't want to receive the messages by email *at all*. I participate in this forum using a non-email system, and it works fine so long as people continue to participate in this forum. Even for those who do participate by email, though, your approach is broken: > My answer is simple. Get a proper email system that filters out > duplicates. The message sent to the individual typically arrives earlier (since it is sent straight from you to the individual), and the message on the forum arrives later (since it typically requires more processing). But since we're participating in the discussion on the forum and not in individual email, it is the later one we want, and the earlier one should be deleted. So at the point the first message arrives, it isn't a duplicate. The mail program will show it anyway, because ?remove duplicates? can't catch it when there's no duplicate yet. The proper solution is for you not to send that one at all, and send only the message to the forum. You do this by using your mail client's ?reply to list? function, which uses the RFC 3696 information in every mailing list message. Is there any mail client which doesn't have this function? If so, use your vendor's bug reporting system to request this feature as standard, and/or switch to a better mail client until they fix that. -- \ ?Timid men prefer the calm of despotism to the boisterous sea | `\ of liberty.? ?Thomas Jefferson | _o__) | Ben Finney From cs at zip.com.au Fri Jun 14 22:09:57 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 15 Jun 2013 12:09:57 +1000 Subject: Don't feed the troll... In-Reply-To: <7wfvwkcihf.fsf@benfinney.id.au> References: <7wfvwkcihf.fsf@benfinney.id.au> Message-ID: <20130615020957.GA72426@cskk.homeip.net> On 15Jun2013 10:42, Ben Finney wrote: | "D'Arcy J.M. Cain" writes: | Even for those who do participate by email, though, your approach is | broken: | > My answer is simple. Get a proper email system that filters out | > duplicates. | | The message sent to the individual typically arrives earlier (since it | is sent straight from you to the individual), and the message on the | forum arrives later (since it typically requires more processing). | | But since we're participating in the discussion on the forum and not in | individual email, it is the later one we want, and the earlier one | should be deleted. They're the same message! (Delivered twice.) Replying to either is equivalent. So broadly I don't care which gets deleted; it works regardless. | So at the point the first message arrives, it isn't a duplicate. The | mail program will show it anyway, because ?remove duplicates? can't | catch it when there's no duplicate yet. But it can when the second one arrives. This is true regardless of the delivery order. The correct approach it to file the one message wherever it matches. Message to me+list (I use the list, not the newsgroup) get filed in my inbox and _also_ in my python folder. I do that based on the to/cc headers for the most part, so either message's arrival files the same way. I delete dups on entry to a mail folder (automatically, of course) instead of at mail filing time, but the effect is equivalent. | The proper solution is for you not to send that one at all, and send | only the message to the forum. Bah. Plenty of us like both. In the inbox alerts me that someone replied to _my_ post, and in the python mail gets it nicely threaded. | You do this by using your mail client's ?reply to list? function, which | uses the RFC 3696 information in every mailing list message. No need, but a valid option. | Is there any mail client which doesn't have this function? If so, use | your vendor's bug reporting system to request this feature as standard, | and/or switch to a better mail client until they fix that. Sorry, I could have sworn you said you weren't using a mail client for this... -- Cameron Simpson You've read the book. You've seen the movie. Now eat the cast. - Julian Macassey, describing "Watership Down" From robert.kern at gmail.com Sat Jun 15 05:30:59 2013 From: robert.kern at gmail.com (Robert Kern) Date: Sat, 15 Jun 2013 10:30:59 +0100 Subject: Don't feed the troll... In-Reply-To: <20130615020957.GA72426@cskk.homeip.net> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> Message-ID: On 2013-06-15 03:09, Cameron Simpson wrote: > On 15Jun2013 10:42, Ben Finney wrote: > | "D'Arcy J.M. Cain" writes: > | Even for those who do participate by email, though, your approach is > | broken: > | > My answer is simple. Get a proper email system that filters out > | > duplicates. > | > | The message sent to the individual typically arrives earlier (since it > | is sent straight from you to the individual), and the message on the > | forum arrives later (since it typically requires more processing). > | > | But since we're participating in the discussion on the forum and not in > | individual email, it is the later one we want, and the earlier one > | should be deleted. > > They're the same message! (Delivered twice.) Replying to either is equivalent. > So broadly I don't care which gets deleted; it works regardless. > > | So at the point the first message arrives, it isn't a duplicate. The > | mail program will show it anyway, because ?remove duplicates? can't > | catch it when there's no duplicate yet. > > But it can when the second one arrives. This is true regardless of > the delivery order. Ben said that he doesn't use email for this list. Neither do I. We use one of the newsgroup mirrors. If you Cc us, we will get a reply on the newsgroup (where we want it) and a reply in our email (where we don't). The two systems cannot talk to each other to delete the other message. > | You do this by using your mail client's ?reply to list? function, which > | uses the RFC 3696 information in every mailing list message. > > No need, but a valid option. > > | Is there any mail client which doesn't have this function? If so, use > | your vendor's bug reporting system to request this feature as standard, > | and/or switch to a better mail client until they fix that. > > Sorry, I could have sworn you said you weren't using a mail client for this... He's suggesting that *you* who are using a mail reader to use the "reply to list" functionality or request it if it is not present. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From ben+python at benfinney.id.au Sat Jun 15 07:29:35 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Sat, 15 Jun 2013 21:29:35 +1000 Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> Message-ID: <7w61xfa9y8.fsf@benfinney.id.au> Cameron Simpson writes: > On 15Jun2013 10:42, Ben Finney wrote: > | The message sent to the individual typically arrives earlier (since > | it is sent straight from you to the individual), and the message on > | the forum arrives later (since it typically requires more > | processing). > | > | But since we're participating in the discussion on the forum and not > | in individual email, it is the later one we want, and the earlier > | one should be deleted. > > They're the same message! (Delivered twice.) Replying to either is > equivalent. Wrong. They have the same Message-Id, but one of them is delivered via the mailing list, and has the correct RFC 3696 fields in the header to continue the discussion there. The one delivered individually is the one to discard, since it was not delivered via the mailing list. > Bah. Plenty of us like both. In the inbox alerts me that someone > replied to _my_ post, and in the python mail gets it nicely threaded. Your mail client doesn't alert you to a message addressed to you? > Sorry, I could have sworn you said you weren't using a mail client for > this... As I already said, this is demonstrating the fact that ?reply to all? is broken even for the use case of participating via email. -- \ ?Software patents provide one more means of controlling access | `\ to information. They are the tool of choice for the internet | _o__) highwayman.? ?Anthony Taylor | Ben Finney From darcy at druid.net Sat Jun 15 07:58:27 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Sat, 15 Jun 2013 07:58:27 -0400 Subject: Don't feed the troll... In-Reply-To: <7w61xfa9y8.fsf@benfinney.id.au> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> Message-ID: <20130615075827.1a62c322@imp> On Sat, 15 Jun 2013 21:29:35 +1000 Ben Finney wrote: > > Bah. Plenty of us like both. In the inbox alerts me that someone > > replied to _my_ post, and in the python mail gets it nicely > > threaded. > > Your mail client doesn't alert you to a message addressed to you? Every message in my mailbox is addressed to me otherwise I wouldn't get it. Do you mean the To: line? Which address? I have about a dozen addresses not counting the plus sign addresses like the one you use for this list. Which one should I treat as special? > > Sorry, I could have sworn you said you weren't using a mail client > > for this... > > As I already said, this is demonstrating the fact that ?reply to all? > is broken even for the use case of participating via email. As the person who proposed this I would like to point out that I never suggested "reply to all?. I suggested including the poster that you are replying to. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From steve+comp.lang.python at pearwood.info Sat Jun 15 11:40:35 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 15:40:35 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> Message-ID: <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: > I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. -- Steven From kwpolska at gmail.com Sat Jun 15 12:41:41 2013 From: kwpolska at gmail.com (=?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?=) Date: Sat, 15 Jun 2013 18:41:41 +0200 Subject: Don't feed the troll... In-Reply-To: <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano wrote: > On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: > >> I suggested including the poster that you are replying to. > > In the name of all that's good and decent in the world, why on earth > would you do that when replying to a mailing list??? They're already > getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html From darcy at druid.net Sat Jun 15 13:07:29 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Sat, 15 Jun 2013 13:07:29 -0400 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130615130729.574fc00b@imp> On Sat, 15 Jun 2013 18:41:41 +0200 Chris ?Kwpolska? Warrick wrote: > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano > wrote: > > In the name of all that's good and decent in the world, why on earth > > would you do that when replying to a mailing list??? They're already > > getting a reply. Sending them TWO identical replies is just rude. > > Mailman is intelligent enough not to send a second copy in that case. > This message was sent with a CC, and you got only one copy. Actually, no. Mailman is not your MTA. It only gets the email sent to the mailing list. Your MTA sends the other one directly so Steve is correct. He gets two copies. If his client doesn't suppress the duplicate then he will be presented with both. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From wking at tremily.us Sat Jun 15 13:25:28 2013 From: wking at tremily.us (W. Trevor King) Date: Sat, 15 Jun 2013 13:25:28 -0400 Subject: Mailman forwarding (was: Don't feed the troll...) In-Reply-To: <20130615130729.574fc00b@imp> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> Message-ID: <20130615172528.GG24970@odin.tremily.us> On Sat, Jun 15, 2013 at 01:07:29PM -0400, D'Arcy J.M. Cain wrote: > On Sat, 15 Jun 2013 18:41:41 +0200 Chris ?Kwpolska? Warrick wrote: > > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano wrote: > > > In the name of all that's good and decent in the world, why on earth > > > would you do that when replying to a mailing list??? They're already > > > getting a reply. Sending them TWO identical replies is just rude. > > > > Mailman is intelligent enough not to send a second copy in that case. > > This message was sent with a CC, and you got only one copy. > > Actually, no. Mailman is not your MTA. It only gets the email sent to > the mailing list. Your MTA sends the other one directly so Steve is > correct. He gets two copies. If his client doesn't suppress the > duplicate then he will be presented with both. Mailman can (optionally) assume that addresses listed in To, CC, ? fields received an out-of-band copies, and not mail them an additional copy [1]. Cheers, Trevor [1]: http://www.gnu.org/software/mailman/mailman-member/node21.html -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: From kwpolska at gmail.com Sat Jun 15 13:25:21 2013 From: kwpolska at gmail.com (=?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?=) Date: Sat, 15 Jun 2013 19:25:21 +0200 Subject: Don't feed the troll... In-Reply-To: <20130615130729.574fc00b@imp> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> Message-ID: On Sat, Jun 15, 2013 at 7:07 PM, D'Arcy J.M. Cain wrote: > On Sat, 15 Jun 2013 18:41:41 +0200 > Chris ?Kwpolska? Warrick wrote: >> On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano >> wrote: >> > In the name of all that's good and decent in the world, why on earth >> > would you do that when replying to a mailing list??? They're already >> > getting a reply. Sending them TWO identical replies is just rude. >> >> Mailman is intelligent enough not to send a second copy in that case. >> This message was sent with a CC, and you got only one copy. > > Actually, no. Mailman is not your MTA. It only gets the email sent to > the mailing list. Your MTA sends the other one directly so Steve is > correct. He gets two copies. If his client doesn't suppress the > duplicate then he will be presented with both. The source code seems to think otherwise: http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/mailman/handlers/avoid_duplicates.py On Sat, Jun 15, 2013 at 7:12 PM, Steven D'Aprano wrote: > Wrong. I got two copies. One via comp.lang.python, and one direct to me. You are subscribed through Usenet and not , in which case the above doesn?t apply, because Mailman throws the mail to Usenet and not you personally. -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html From steve+comp.lang.python at pearwood.info Sat Jun 15 13:47:14 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 17:47:14 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> Message-ID: <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 19:25:21 +0200, Chris ?Kwpolska? Warrick wrote: > On Sat, Jun 15, 2013 at 7:07 PM, D'Arcy J.M. Cain > wrote: >> On Sat, 15 Jun 2013 18:41:41 +0200 >> Chris ?Kwpolska? Warrick wrote: >>> On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano >>> wrote: >>> > In the name of all that's good and decent in the world, why on earth >>> > would you do that when replying to a mailing list??? They're already >>> > getting a reply. Sending them TWO identical replies is just rude. >>> >>> Mailman is intelligent enough not to send a second copy in that case. >>> This message was sent with a CC, and you got only one copy. >> >> Actually, no. Mailman is not your MTA. It only gets the email sent to >> the mailing list. Your MTA sends the other one directly so Steve is >> correct. He gets two copies. If his client doesn't suppress the >> duplicate then he will be presented with both. > > The source code seems to think otherwise: Mailman is not the only mailing list software in the world, and the feature you are referring to is optional. > http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/ mailman/handlers/avoid_duplicates.py > > On Sat, Jun 15, 2013 at 7:12 PM, Steven D'Aprano > wrote: >> Wrong. I got two copies. One via comp.lang.python, and one direct to >> me. > > You are subscribed through Usenet and not > , in which case the > above doesn?t apply, because Mailman throws the mail to Usenet and not > you personally. I still get two copies if you CC me. That's still unnecessary and rude. If I wanted a copy emailed to me, I'd subscribe via email rather than via news. Whether you agree or not, I'd appreciate if you respect my wishes rather than try to wiggle out of it on a technicality. -- Steven From support at superhost.gr Sat Jun 15 14:59:36 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 21:59:36 +0300 Subject: Don't feed the troll... In-Reply-To: <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 15/6/2013 8:47 ??, Steven D'Aprano wrote: > I still get two copies if you CC me. That's still unnecessary and rude. > If I wanted a copy emailed to me, I'd subscribe via email rather than via > news. Whether you agree or not, I'd appreciate if you respect my wishes > rather than try to wiggle out of it on a technicality. I'am also getting 2 notifications two of any response in TB One in the news section and one by mail. Please do not CC. If i wanted mail notification i would subscribed via email. -- What is now proved was at first only imagined! From rosuav at gmail.com Sat Jun 15 19:09:37 2013 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 16 Jun 2013 09:09:37 +1000 Subject: Don't feed the troll... In-Reply-To: <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Sun, Jun 16, 2013 at 3:47 AM, Steven D'Aprano wrote: > On Sat, 15 Jun 2013 19:25:21 +0200, Chris ?Kwpolska? Warrick wrote: >> The source code seems to think otherwise: > > Mailman is not the only mailing list software in the world, and the > feature you are referring to is optional. > >> http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/ > mailman/handlers/avoid_duplicates.py Mailman is the software that runs python-list at python.org, so this *is* applicable to everyone who reads the mailing list (including myself). The fact that there's other mailing list software isn't significant; the fact that there's comp.lang.python, though, is. But I think people have realized that now. ChrisA From steve+comp.lang.python at pearwood.info Sat Jun 15 20:51:04 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 16 Jun 2013 00:51:04 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51bd0bf8$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sun, 16 Jun 2013 09:09:37 +1000, Chris Angelico wrote: > On Sun, Jun 16, 2013 at 3:47 AM, Steven D'Aprano > wrote: >> On Sat, 15 Jun 2013 19:25:21 +0200, Chris ?Kwpolska? Warrick wrote: >>> The source code seems to think otherwise: >> >> Mailman is not the only mailing list software in the world, and the >> feature you are referring to is optional. >> >>> http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/ src/ >> mailman/handlers/avoid_duplicates.py > > Mailman is the software that runs python-list at python.org, so this *is* > applicable to everyone who reads the mailing list (including myself). > The fact that there's other mailing list software isn't significant; I'm not making an argument about CCing the sender on specifically this list, I'm making a general observations about list etiquette in general. -- Steven From wking at tremily.us Sat Jun 15 21:29:10 2013 From: wking at tremily.us (W. Trevor King) Date: Sat, 15 Jun 2013 21:29:10 -0400 Subject: CC etiquette for mailing lists (was: Don't feed the troll...) In-Reply-To: <51bd0bf8$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130615130729.574fc00b@imp> <51bca8a2$0$29997$c3e8da3$5496439d@news.astraweb.com> <51bd0bf8$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130616012910.GI24970@odin.tremily.us> On Sun, Jun 16, 2013 at 12:51:04AM +0000, Steven D'Aprano wrote: > On Sun, 16 Jun 2013 09:09:37 +1000, Chris Angelico wrote: > > Mailman is the software that runs python-list at python.org, so this > > *is* applicable to everyone who reads the mailing list (including > > myself). The fact that there's other mailing list software isn't > > significant; > > I'm not making an argument about CCing the sender on specifically > this list, I'm making a general observations about list etiquette in > general. For some lists [1], the convention *is* to CC interested parties (which presumably includes the person who's message you are replying to). In the case of Mailman-hosted lists, it would seem to be more considerate to CC folks (since they can opt-out via Mailman), while folks who only follow the list via occasionally reading Gmane [2] will probably appreciate the direct ping. I'm not saying that this should be the convention for python-list@, I'm just saying that it's not immediately obvious what the conventions are for a particular list [3], and there are valid arguments going both ways. What seems more obvious (to me), is that it's polite to adjust the subject line if your response if far enough off-topic that the original subject no longer applies ;). Cheers, Trevor [1]: http://git.kernel.org/cgit/git/git.git/tree/MaintNotes?h=todo#n10 [2]: http://news.gmane.org/gmane.comp.python.general [3]: Unless you tell new subscribers what the conventions are. For example, the git@ list emails [1] to new list subscribers. -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: From steve+comp.lang.python at pearwood.info Sat Jun 15 13:12:50 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 17:12:50 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51bca091$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 18:41:41 +0200, Chris ?Kwpolska? Warrick wrote: > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano > wrote: >> On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: >> >>> I suggested including the poster that you are replying to. >> >> In the name of all that's good and decent in the world, why on earth >> would you do that when replying to a mailing list??? They're already >> getting a reply. Sending them TWO identical replies is just rude. > > Mailman is intelligent enough not to send a second copy in that case. > This message was sent with a CC, and you got only one copy. Wrong. I got two copies. One via comp.lang.python, and one direct to me. -- Steven From support at superhost.gr Sat Jun 15 13:30:29 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 20:30:29 +0300 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 15/6/2013 7:41 ??, Chris ?Kwpolska? Warrick wrote: > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano > wrote: >> On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: >> >>> I suggested including the poster that you are replying to. >> >> In the name of all that's good and decent in the world, why on earth >> would you do that when replying to a mailing list??? They're already >> getting a reply. Sending them TWO identical replies is just rude. > > Mailman is intelligent enough not to send a second copy in that case. > This message was sent with a CC, and you got only one copy. > > -- > Kwpolska | GPG KEY: 5EAAEA16 > stop html mail | always bottom-post > http://asciiribbon.org | http://caliburn.nl/topposting.html > You are spamming my thread. -- What is now proved was at first only imagined! From rustompmody at gmail.com Sat Jun 15 13:36:00 2013 From: rustompmody at gmail.com (rusi) Date: Sat, 15 Jun 2013 10:36:00 -0700 (PDT) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> On Jun 15, 10:30?pm, Nick the Gr33k wrote: > > You are spamming my thread. With you as our spamming-guru, Onward! Sky is the limit! From steve+comp.lang.python at pearwood.info Sat Jun 15 13:52:43 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 17:52:43 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> Message-ID: <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: > With you as our spamming-guru, Onward! Sky is the limit! If you're going to continue making unproductive, off-topic, inflammatory posts that prolong these already excessively large threads, Nikos won't be the only one kill-filed. If you have nothing helpful to say, send it to /dev/null. -- Steven From rustompmody at gmail.com Sat Jun 15 14:18:03 2013 From: rustompmody at gmail.com (rusi) Date: Sat, 15 Jun 2013 11:18:03 -0700 (PDT) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> On Jun 15, 10:52?pm, Steven D'Aprano wrote: > On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: > > With you as our spamming-guru, Onward! Sky is the limit! > > If you're going to continue making unproductive, off-topic, inflammatory > posts that prolong these already excessively large threads, Nikos won't > be the only one kill-filed. At least two people -- Alex and Antoon -- have told you that by supporting Nikos, when everyone else wants him off list, you are part of the problem. Others -- Fabio -- have indicated their wish to leave the list due to everything becoming Nikos-tainted. Everyone is exasperated and talking of kill-filing him. Let me remind you of your post: http://mail.python.org/pipermail/python-list/2013-June/649581.html In this post you have imputed masturbation to first-time poster for a quite valid question. [I am assuming that google is correct in informing me that choking the chicken means that]. This is way beyond being rude uncalled-for and generally unacceptable. I suggest it is because of something else you said -- viz that Nikos mails are draining you. In short because you are unable to restrain your charitable behavior towards Nikos -- note that this is charity at public (the group) expense -- you are behaving abominably in other contexts, including towards first time posters. If you must help Nikos, please do it in private. He is not wanted here. [This is not specifically addressed to you Steven alone but to all who are feeling charitable at public expense] From steve+comp.lang.python at pearwood.info Sat Jun 15 15:29:24 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 15 Jun 2013 19:29:24 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> Message-ID: <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> On Sat, 15 Jun 2013 11:18:03 -0700, rusi wrote: > At least two people -- Alex and Antoon -- have told you that by > supporting Nikos, when everyone else wants him off list, you are part of > the problem. And others have publicly thanked me for giving useful answers to Nikos, because they have learned from them. You replied to Antoon, and agreed with his position that we should shun Nikos, then *immediately* contradicted yourself by stating that Robert Kern's helpful answers were "the ideal". And then, just to further demonstrate that your actions are at best inconsistent and at worst hypocritical, you have since gone on to fire barbs at Nikos instead of ignoring him. So please tend to the beam in your own eye before pointing at the mote in mine. > Others -- Fabio -- have indicated their wish to leave the list due to > everything becoming Nikos-tainted. That would be disappointing, but there's nothing I can do about it. > Everyone is exasperated and talking of kill-filing him. Then why don't they? "Don't feed the troll" includes trying to beat him into submission with insults and half-witty remarks. This is not about Nikos. It's about those who are also doing their bit to make this community an ugly, hostile place. I won't mention names -- you know who you are. Those who take it upon themselves to bait and prod and poke Nikos with insults and inflammatory replies. Appointing themselves Internet Police and making ridiculous claims that Nikos ought to be reported to the police. Sending bogus complaints to the domain registrar. There is a word for this sort of behaviour: bullying. I don't care how morally justified you think you are, you are now just as big a part of the problem as Nikos. > Let me remind you of your post: > http://mail.python.org/pipermail/python-list/2013-June/649581.html > > In this post you have imputed masturbation to first-time poster for a > quite valid question. > [I am assuming that google is correct in informing me that choking the > chicken means that]. > This is way beyond being rude uncalled-for and generally unacceptable. Not as rude as making such a misleading characterisation of my post. The original poster's reply is one click away from that link: "Thank you for your help and sense of humor... all the best, Buford" http://mail.python.org/pipermail/python-list/2013-June/649680.html If you insist on taking umbrage on behalf of the OP, I can't stop you, but that says more about you than about me. -- Steven From wuwei23 at gmail.com Sat Jun 15 17:47:46 2013 From: wuwei23 at gmail.com (alex23) Date: Sat, 15 Jun 2013 14:47:46 -0700 (PDT) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <60445b41-bf0b-47fc-9941-de4a7ad36195@wf10g2000pbc.googlegroups.com> On Jun 16, 5:29?am, Steven D'Aprano wrote: > And others have publicly thanked me for giving useful answers to Nikos, > because they have learned from them. I take it you'll also be critical of people on list now saying "we don't do your homework for you"? Or is there some fundamental difference here that I'm missing? That others have derived value from some of the desperate flailings to fill Nikos' alleged ignorance doesn't mean there's any value in his original posts. I also strongly disagree with your claim that you've given "useful answers" to him: his reposting *code you've written for him* asking others to modify it to his liking would indicate he's learned nothing at all from your approach. Well, nothing other than that if he keeps this crap up, there apparently *are* people who will repeatedly do his job for him, which I guess makes you the current god of his cargo cult. So, uh, well done? From breamoreboy at yahoo.co.uk Sat Jun 15 18:04:56 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sat, 15 Jun 2013 23:04:56 +0100 Subject: Don't feed the troll... In-Reply-To: <60445b41-bf0b-47fc-9941-de4a7ad36195@wf10g2000pbc.googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <60445b41-bf0b-47fc-9941-de4a7ad36195@wf10g2000pbc.googlegroups.com> Message-ID: On 15/06/2013 22:47, alex23 wrote: > On Jun 16, 5:29 am, Steven D'Aprano +comp.lang.pyt... at pearwood.info> wrote: >> And others have publicly thanked me for giving useful answers to Nikos, >> because they have learned from them. > > I take it you'll also be critical of people on list now saying "we > don't do your homework for you"? Or is there some fundamental > difference here that I'm missing? > > That others have derived value from some of the desperate flailings to > fill Nikos' alleged ignorance doesn't mean there's any value in his > original posts. I also strongly disagree with your claim that you've > given "useful answers" to him: his reposting *code you've written for > him* asking others to modify it to his liking would indicate he's > learned nothing at all from your approach. > > Well, nothing other than that if he keeps this crap up, there > apparently *are* people who will repeatedly do his job for him, which > I guess makes you the current god of his cargo cult. So, uh, well done? > +1 -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From antoon.pardon at rece.vub.ac.be Sun Jun 16 14:16:34 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Sun, 16 Jun 2013 20:16:34 +0200 Subject: Don't feed the troll... In-Reply-To: <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BE0102.4030803@rece.vub.ac.be> Op 15-06-13 21:29, Steven D'Aprano schreef: > On Sat, 15 Jun 2013 11:18:03 -0700, rusi wrote: > >> At least two people -- Alex and Antoon -- have told you that by >> supporting Nikos, when everyone else wants him off list, you are part of >> the problem. > > And others have publicly thanked me for giving useful answers to Nikos, > because they have learned from them. That doesn't contradict that you may be part of the problem. There is something like the law of diminishing returns. So the kind of respons that is helpful at the beginnig can become part of the problem when it becomes part of a seemingly endless cycle. > You replied to Antoon, and agreed with his position that we should shun > Nikos, then *immediately* contradicted yourself by stating that Robert > Kern's helpful answers were "the ideal". And then, just to further > demonstrate that your actions are at best inconsistent and at worst > hypocritical, you have since gone on to fire barbs at Nikos instead of > ignoring him. So please tend to the beam in your own eye before pointing > at the mote in mine. So what. We all are somewhat inconsistent and hypocritical. That doesn't make your responses unproblematic. If in the future you want to respond like Robert Kern that seems fine enough. But if you continue like you are now, I'll consider you an enabler. >> Others -- Fabio -- have indicated their wish to leave the list due to >> everything becoming Nikos-tainted. > > That would be disappointing, but there's nothing I can do about it. Yes you can. You can stop enabling his behaviour. Now you may think this is an unacceptable option for and that is something you will have to decide for yourself but you do have a choice. >> Everyone is exasperated and talking of kill-filing him. > > Then why don't they? "Don't feed the troll" includes trying to beat him > into submission with insults and half-witty remarks. Not feeding the troll doesn't help. If people are transgressing the social norms in a community, they need to get a response that makes it clear they crossed the line. If they don't you are implicetly broadcasting the message there is no out of bound behaviour. > This is not about Nikos. It's about those who are also doing their bit to > make this community an ugly, hostile place. I won't mention names -- you > know who you are. Those who take it upon themselves to bait and prod and > poke Nikos with insults and inflammatory replies. Appointing themselves > Internet Police and making ridiculous claims that Nikos ought to be > reported to the police. Sending bogus complaints to the domain registrar. > There is a word for this sort of behaviour: bullying. I don't care how > morally justified you think you are, you are now just as big a part of > the problem as Nikos. You are trying to get it both ways. On the one hand you try to argue that there are no boundaries to what is acceptable by calling people who do try to enforce such boundaries the Internet Police. On the other hand you do suggest that playing Internet Police is out of bound behaviour. You have to make a choice. Either you don't want to recognize there can be something like out of bound behaviour and then people making this community an ugly hostile place is acceptable. Or you think there is behaviour that is out of bounds and then you must consider the possiblity that Nikos behaviour is an example of that and that what you consider ugly responses are people trying to address that out of bound behaviour and that you responding to Nikos as you do for the moment is perpetuating Nokos's unacceptable behaviour. -- Antoon Pardon From steve+comp.lang.python at pearwood.info Sun Jun 16 16:04:18 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 16 Jun 2013 20:04:18 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: > You are trying to get it both ways. On the one hand you try to argue > that there are no boundaries I have never, ever argued that there are no boundaries. I have repeatedly made it clear to Nikos when I thought he was behaving improperly. And I've done the same to others when they've acted improperly. > to what is acceptable by calling people who > do try to enforce such boundaries the Internet Police. On the other hand > you do suggest that playing Internet Police is out of bound behaviour. Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It is unproductive, it makes this a hostile, unpleasant place to be, it ruins the environment for the rest of the community, it's off topic, and it simply doesn't work to discourage trolls. -- Steven From rurpy at yahoo.com Sun Jun 16 23:46:05 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Sun, 16 Jun 2013 20:46:05 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> On 06/16/2013 02:04 PM, Steven D'Aprano wrote: > On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: > >> You are trying to get it both ways. On the one hand you try to argue >> that there are no boundaries > > I have never, ever argued that there are no boundaries. I have repeatedly > made it clear to Nikos when I thought he was behaving improperly. And > I've done the same to others when they've acted improperly. > >> to what is acceptable by calling people who >> do try to enforce such boundaries the Internet Police. On the other hand >> you do suggest that playing Internet Police is out of bound behaviour. > > Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It > is unproductive, it makes this a hostile, unpleasant place to be, it > ruins the environment for the rest of the community, it's off topic, and > it simply doesn't work to discourage trolls. The difficulty with trying to suppress such responses is that the flamers get just as much pleasure from having a target to unrestrainedly spew their pent up anger and vile at, as the troll gets from simulating that reaction. The result is a positive feedback loop. I could be wrong but I don't think Nikos is a pure troll -- someone motivated purely by provoking reaction and discord. He has a real website and his problems with Python seem like genuine problems many beginners have. He seems to have little knowledge, not much concern for anyone else but a lot of determination to get things working. I have certainly known people like that in the real world. I speculate that half of his "bad behavior" is simple "I want now and don't care about your conventions". The rest is a reaction to "we're the alphas, your a beta" attitude expressed by many here and later, overt hostility directed at him. He has changed some things -- his posting method, he's made an effort to understand his encoding issues, etc. So I think Steven's approach of responding to his questions, at least those that are coherent and don't require reading a dozen posts over several threads to piece together, with an actual attempt to help (not a bunch of obscure hints, links to wikipedia, and "you're an idiot" replies) is right. If Nikos fails to respond with better questions, then those that do answer will get tired of trying to help and stop answering. In the meantime everyone else can just killfile or otherwise ignore him rather than egging him on by intentionally provoking him (unless of course you enjoy the results.) So positive reinforcement for less bad behavior, negative reinforcement (which for trolling is NO response, not negative responses) for more bad. Standard behavioral conditioning. And if it doesn't work it will still be a much nicer and quieter here with only Nikos' trolling than with 10x as much garbage from the local vigilantes who are more obnoxious than he. From support at superhost.gr Mon Jun 17 01:04:33 2013 From: support at superhost.gr (Ferrous Cranus) Date: Mon, 17 Jun 2013 08:04:33 +0300 Subject: Don't feed the troll... In-Reply-To: <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: On 17/6/2013 6:46 ??, rurpy at yahoo.com wrote: > I could be wrong but I don't think Nikos is a pure troll -- > someone motivated purely by provoking reaction and discord. > He has a real website and his problems with Python seem like > genuine problems many beginners have. He seems to have little > knowledge, not much concern for anyone else but a lot of > determination to get things working. I have certainly known > people like that in the real world. This is the best definition of me. It is very nice to see that someone has understood my character and intentions. The only thing i'm feeling guilty is that instead of reading help files and PEP's which seem too technical for me, i prefer the live help of an actual expert human being. An yes, i'm not trolling this fine newsgroup. If it wasn't for the help of some of the nicest fellows here my site would be up and working neither with Python 3.3.2 nor with 2.6. Many difficulties that occurred to me when trying to write some code were addresses here making my website actually happen. I could have made it to Joomla(that's web design) instead of Python(web development_ but i really like Python and the reason i ask in detail is because i don't want only provided code that will help address an issue i have, but i want to know "how" things work. Thanks for understanding me ruspy. -- What is now proved was at first only imagined! From rosuav at gmail.com Mon Jun 17 03:23:58 2013 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 17 Jun 2013 17:23:58 +1000 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus wrote: > The only thing i'm feeling guilty is that instead of reading help files and > PEP's which seem too technical for me, i prefer the live help of an actual > expert human being. > This is definitely a reason to feel guilty. You are asking people to provide live help for free, rather than simply reading the documentation. If the help files are too technical for you, you will need to improve your technical ability. (Though the PEPs shouldn't need to concern you, generally.) Live help is a VERY expensive service to offer, because it involves an expert's time dedicated to one single person. Collective help is far more efficient - that's why documentation exists, because it gets read by far more people than wrote it (at least, that's the theory). ChrisA From antoon.pardon at rece.vub.ac.be Mon Jun 17 04:26:21 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 10:26:21 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: <51BEC82D.4000502@rece.vub.ac.be> Op 17-06-13 07:04, Ferrous Cranus schreef: > On 17/6/2013 6:46 ??, rurpy at yahoo.com wrote: >> I could be wrong but I don't think Nikos is a pure troll -- >> someone motivated purely by provoking reaction and discord. >> He has a real website and his problems with Python seem like >> genuine problems many beginners have. He seems to have little >> knowledge, not much concern for anyone else but a lot of >> determination to get things working. I have certainly known >> people like that in the real world. > This is the best definition of me. > It is very nice to see that someone has understood my character and > intentions. It still describes you as a jerk. Someone who acts without much concerns for others, is a jerk even if he has no malice in mind. > > The only thing i'm feeling guilty is that instead of reading help files > and PEP's which seem too technical for me, i prefer the live help of an > actual expert human being. > An yes, i'm not trolling this fine newsgroup. > If it wasn't for the help of some of the nicest fellows here my site > would be up and working neither with Python 3.3.2 nor with 2.6. Yes you are trolling this newsgroup. Intent is not magic. You just admitted to have little concerns for others. So if your behaviour happens to be rude and provoke people in behaving badly, you just don't care and continue to act essentially in the same way. That is trolling even if it is not your intention. > > Many difficulties that occurred to me when trying to write some code > were addresses here making my website actually happen. > I could have made it to Joomla(that's web design) instead of Python(web > development_ but i really like Python and the reason i ask in detail is > because i don't want only provided code that will help address an issue > i have, but i want to know "how" things work. Sure, but you don't want to make any effort yourself in getting to know how things work. You expect others to spoon feed you. From rurpy at yahoo.com Mon Jun 17 10:41:54 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Mon, 17 Jun 2013 07:41:54 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> On 06/17/2013 01:23 AM, Chris Angelico wrote: > On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus wrote: >> The only thing i'm feeling guilty is that instead of reading help files and >> PEP's which seem too technical for me, i prefer the live help of an actual >> expert human being. > > This is definitely a reason to feel guilty. You are asking people to > provide live help for free, rather than simply reading the > documentation. It is NOT a matter of simply reading the documentation. I have posted here several times as have many others about some of the problems the documentation has, especially for people who don't already know Python. Take a look at issue http://bugs.python.org/issue16665 for an example of why the Python doc has some of the problems that it does. (Please change the subject line if you want to discuss the documentation rather than Nikos.) While the Python tutorial is a good answer for many people it is not the answer for everyone. Many people don't have a large block of time to sit down and go through it from beginning to end. Many people don't learn well reading a large volume of not-immediately-relevant material, trying to commit it to memory, and then trying to apply it all later, as opposed to looking up those aspects of python relevant to what they are attempting at that moment. (I am in that category.) All these problems are aggravated for people whose native language is not English. > If the help files are too technical for you, you will > need to improve your technical ability. (Though the PEPs shouldn't > need to concern you, generally.) Live help is a VERY expensive service > to offer, because it involves an expert's time dedicated to one single > person. Luckily, in a group of volunteers, participants can individually decide how much their time is worth and answer if they want or not if they don't. The reality, regardless of whether you or I think the world should not be this way, is that Nikos has embarked on his website building project and telling him to drop it and come back after he has learned more is totally ineffectual noise. > Collective help is far more efficient - that's why > documentation exists, because it gets read by far more people than > wrote it (at least, that's the theory). Yup. And it works well most of the time but occasionally not. From rosuav at gmail.com Mon Jun 17 17:43:02 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 18 Jun 2013 07:43:02 +1000 Subject: Don't feed the troll... In-Reply-To: <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: On Tue, Jun 18, 2013 at 12:41 AM, wrote: > On 06/17/2013 01:23 AM, Chris Angelico wrote: >> On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus wrote: >>> The only thing i'm feeling guilty is that instead of reading help files and >>> PEP's which seem too technical for me, i prefer the live help of an actual >>> expert human being. >> >> This is definitely a reason to feel guilty. You are asking people to >> provide live help for free, rather than simply reading the >> documentation. > > It is NOT a matter of simply reading the documentation. > I have posted here several times as have many others about > some of the problems the documentation has, especially for > people who don't already know Python. I'm aware the docs aren't perfect. But there's a world of difference between: "Here's my code, tell me what's wrong. TELL ME NOW!!" and "Having trouble understanding this function [link to docs] - I expect X but Y happens". That's what I take issue with. The implication behind Nikos's questions is that he *can't be bothered* reading the docs, which he has explicitly confirmed above. That's nothing to do with "the problems the documentation has"; if Python had perfect documentation, he still wouldn't read it. That is a problem. A major problem. ChrisA From breamoreboy at yahoo.co.uk Mon Jun 17 18:22:13 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Mon, 17 Jun 2013 23:22:13 +0100 Subject: Don't feed the troll... In-Reply-To: <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: On 17/06/2013 15:41, rurpy at yahoo.com wrote: > > It is NOT a matter of simply reading the documentation. > I have posted here several times as have many others about > some of the problems the documentation has, especially for > people who don't already know Python. > It's extremely easy to change the Python documentation, either raise an issue on the bug tracker or send an email to IIRC docs at python dot org. The fastest time I've ever seen between an issue being raised and the change being implemented was literally minutes. If that isn't good enough, put up or shut up. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From steve+comp.lang.python at pearwood.info Mon Jun 17 18:50:02 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 17 Jun 2013 22:50:02 GMT Subject: Problems with Python documentation [Re: Don't feed the troll...] References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: <51bf9299$0$29872$c3e8da3$5496439d@news.astraweb.com> On Mon, 17 Jun 2013 07:41:54 -0700, rurpy wrote: > On 06/17/2013 01:23 AM, Chris Angelico wrote: >> On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus >> wrote: >>> The only thing i'm feeling guilty is that instead of reading help >>> files and PEP's which seem too technical for me, i prefer the live >>> help of an actual expert human being. >> >> This is definitely a reason to feel guilty. You are asking people to >> provide live help for free, rather than simply reading the >> documentation. > > It is NOT a matter of simply reading the documentation. I have posted > here several times as have many others about some of the problems the > documentation has, especially for people who don't already know Python. This is very reasonable. And nobody -- well, at least not me, and probably not Chris -- expects that reading the documentation will suddenly cause the light to shine for every beginner who reads it. Often the official docs are written with an expected audience who already knows the language well. But in context, Nikos has been programming Python long enough, and he's been told often enough, that his FIRST stop should be the documentation, and us second. Not what he does now, which is to make us his first, second, third, fourth, fifth, sixth, seventh and eighth stops. (Are you paying attention Nikos?) But speaking more generally, yes, you are right, the docs are not a panacea. If they were, mailing lists like this, and websites like StackOverflow, would not exist. -- Steven From joel.goldstick at gmail.com Mon Jun 17 21:11:06 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Mon, 17 Jun 2013 21:11:06 -0400 Subject: Problems with Python documentation [Re: Don't feed the troll...] In-Reply-To: <51bf9299$0$29872$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> <51bf9299$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Mon, Jun 17, 2013 at 6:50 PM, Steven D'Aprano < steve+comp.lang.python at pearwood.info> wrote: > On Mon, 17 Jun 2013 07:41:54 -0700, rurpy wrote: > > > On 06/17/2013 01:23 AM, Chris Angelico wrote: > >> On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus > >> wrote: > >>> The only thing i'm feeling guilty is that instead of reading help > >>> files and PEP's which seem too technical for me, i prefer the live > >>> help of an actual expert human being. > >> > >> This is definitely a reason to feel guilty. You are asking people to > >> provide live help for free, rather than simply reading the > >> documentation. > > > > It is NOT a matter of simply reading the documentation. I have posted > > here several times as have many others about some of the problems the > > documentation has, especially for people who don't already know Python. > > This is very reasonable. And nobody -- well, at least not me, and > probably not Chris -- expects that reading the documentation will > suddenly cause the light to shine for every beginner who reads it. Often > the official docs are written with an expected audience who already knows > the language well. > > But in context, Nikos has been programming Python long enough, and he's > been told often enough, that his FIRST stop should be the documentation, > and us second. Not what he does now, which is to make us his first, > second, third, fourth, fifth, sixth, seventh and eighth stops. > > (Are you paying attention Nikos?) > > But speaking more generally, yes, you are right, the docs are not a > panacea. If they were, mailing lists like this, and websites like > StackOverflow, would not exist. > > > I read the python docs. I've gone through the tutorials. If not the first time, or the second, I get that Aha moment with additional reads. Some people say they learn better by other methods than reading. In that case, google like crazy because python has lots of pycon stuff online in video form, and there is the google course. and many others. If people interaction is what you need, find, and visit your local meetup or user group. Lots of places have them. If you don't have one near you, maybe you could start one so you would have local help and back and forth (fourth?). I think its great to read a question here and get a link for an answer. gives me somewhere to go explore more. If you reject these ways of learning for the single method of asking.. fix my code. Then you will never get good at this craft anyway. Its not the answers that are important, its discovering how to find the answers that is really important. The old give a man a fish, vs teach a man to fish truism -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rurpy at yahoo.com Mon Jun 17 21:03:07 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Mon, 17 Jun 2013 18:03:07 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: On 06/17/2013 03:43 PM, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 12:41 AM, wrote: >> On 06/17/2013 01:23 AM, Chris Angelico wrote: >>> On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus wrote: >>>> The only thing i'm feeling guilty is that instead of reading help files and >>>> PEP's which seem too technical for me, i prefer the live help of an actual >>>> expert human being. >>> >>> This is definitely a reason to feel guilty. You are asking people to >>> provide live help for free, rather than simply reading the >>> documentation. >> >> It is NOT a matter of simply reading the documentation. >> I have posted here several times as have many others about >> some of the problems the documentation has, especially for >> people who don't already know Python. > > I'm aware the docs aren't perfect. But there's a world of difference between: > > "Here's my code, tell me what's wrong. TELL ME NOW!!" > > and > > "Having trouble understanding this function [link to docs] - I expect > X but Y happens". I'm not sure he even thinks in those terms. He seems to have a hard time isolating misbehaving code to a particular function's behavior. I could speculate that it doesn't occur to him to lookup the function, or it hard to find (I had lots of problems finding stuff in the Python docs at first because the difference between builtins, other functions, methods, classes (look like functions when called) was not clear to me and when I did find the right place the doc was often in terms I didn't understand), or that he does but can't get a clear idea or gets the wrong idea about how it behaves, or... Figuring out how beginners think is something that talented teachers are good at and (from my observations) almost nobody here is. > That's what I take issue with. The implication behind Nikos's > questions is that he *can't be bothered* reading the docs, which he > has explicitly confirmed above. He didn't confirm that at all! You are seeing what you want to see rather than what is there. He said he didn't read them because (see the quoted text above!), "[they] seem too technical for me", not "I can't be bothered". I agree the poor problem descriptions and the "help me now" tone (in other messages) is irritating. But I also realize I don't work for him and have no obligation to respond. So if it is something I can help with and I feel like it and no one else has posted anything useful, I might try. If I don't feel like it a quick click of the mouse moves me to the next topic. What is a waste of time is a "hey, rtfm at this link, dickwad" response. It doesn't help Nikos. It sends the message to everyone else that aggressive responses are ok And it likely prods Nikos (or whomever) to respond in kind. (A link in conjunction with some help though one hopes will be constructive.) > That's nothing to do with "the > problems the documentation has"; "[they] seem too technical for me" doesn't necessarily imply a problem with the docs (although it could) but it does imply their usefulness to Nikos is going to be limited until he gains a better understanding of some of the basic concepts and terminology of Python. And to anticipate the obvious, I am not advocating the docs be written to address Nikos' level of understanding, only that if people with much better understanding also find problems with them, that it is not surprising that Nikos has even more trouble with them, quite possibly finding them not useful at all. > if Python had perfect documentation, > he still wouldn't read it. If your crystal ball is that good, could you try using it to solve some of Nikos' problems? Now in the end you may turn out to be right and Nikos is playing everyone here to get as much free help as possible and those willing to help him are getting suckered. Still, until that becomes clear to me personally I'd rather err of the side of helping him when I can than not. And in either case abusive posts don't help. From rosuav at gmail.com Mon Jun 17 21:16:55 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 18 Jun 2013 11:16:55 +1000 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: On Tue, Jun 18, 2013 at 11:03 AM, wrote: >> if Python had perfect documentation, >> he still wouldn't read it. > > If your crystal ball is that good, could you try using it > to solve some of Nikos' problems? I have done so, many times. Sometimes it helps, often it doesn't. Once, it led me to accept his root password. You doubtless saw how THAT went over. ChrisA From rurpy at yahoo.com Mon Jun 17 21:08:14 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Mon, 17 Jun 2013 18:08:14 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <6ef1ab49-4596-4204-b0f6-10decd4f0d31@googlegroups.com> Message-ID: On 06/17/2013 04:22 PM, Mark Lawrence wrote: > On 17/06/2013 15:41, rurpy at yahoo.com wrote: >> It is NOT a matter of simply reading the documentation. >> I have posted here several times as have many others about >> some of the problems the documentation has, especially for >> people who don't already know Python. > > It's extremely easy to change the Python documentation, either raise an > issue on the bug tracker or send an email to IIRC docs at python dot > org. Really? Did you bother to read the link I included? Ironic that you are one of the people criticizing Nikos for not reading anything. > The fastest time I've ever seen between an issue being raised and > the change being implemented was literally minutes. If that isn't good > enough, put up or shut up. Perhaps you missed this? http://bugs.python.org/issue1397474 While the lower bound may be minutes, the upper bound is a hell of a lot longer. From antoon.pardon at rece.vub.ac.be Mon Jun 17 04:15:23 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 10:15:23 +0200 Subject: Don't feed the troll... In-Reply-To: <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: <51BEC59B.2090803@rece.vub.ac.be> Op 17-06-13 05:46, rurpy at yahoo.com schreef: > On 06/16/2013 02:04 PM, Steven D'Aprano wrote: > >> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >> is unproductive, it makes this a hostile, unpleasant place to be, it >> ruins the environment for the rest of the community, it's off topic, and >> it simply doesn't work to discourage trolls. > The difficulty with trying to suppress such responses is that > the flamers get just as much pleasure from having a target > to unrestrainedly spew their pent up anger and vile at, as > the troll gets from simulating that reaction. The result is > a positive feedback loop. > Well if asocial behaviour of one provokes asocial behaviour in others, you can't claim the problem is not the social behaviour of the first. > > I could be wrong but I don't think Nikos is a pure troll -- > someone motivated purely by provoking reaction and discord. > He has a real website and his problems with Python seem like > genuine problems many beginners have. He seems to have little > knowledge, not much concern for anyone else but a lot of > determination to get things working. I have certainly known > people like that in the real world. Does that matter? I don't care what Nikos's motivation is. I care about the result or effect of his behaviour and that seems to differ very little from a troll. Intent is not magic. Bad behaviour with the best of intentions still results in annoyance. The only way it which intent makes a difference is when the person with good intentions, upon learning his behaviour is bothersome, tries to adapt his behaviour. > I speculate that half of his "bad behavior" is simple "I want > now and don't care about your conventions". The rest is a > reaction to "we're the alphas, your a beta" attitude expressed > by many here and later, overt hostility directed at him. He > has changed some things -- his posting method, he's made an > effort to understand his encoding issues, etc. I don't see that much change in his style. He just admitted not reading help files (because they are too technical for him). So essentialy he is asking we give him a beginners tutorial in everything he doesn't understand without much effort of him trying to understand things on his own and without much appreciation for the time of others. > So I think Steven's approach of responding to his questions, > at least those that are coherent and don't require reading a > dozen posts over several threads to piece together, with an > actual attempt to help (not a bunch of obscure hints, links > to wikipedia, and "you're an idiot" replies) is right. A respons that is in effect reinforcing bad bahaviour. > If Nikos fails to respond with better questions, then those > that do answer will get tired of trying to help and stop > answering. In the meantime everyone else can just killfile > or otherwise ignore him rather than egging him on by > intentionally provoking him (unless of course you enjoy > the results.) In the mean time you and steve can just killfile those you think are just egging him on. > So positive reinforcement for less bad behavior, negative > reinforcement (which for trolling is NO response, not negative > responses) for more bad. Standard behavioral conditioning. It means you are still reinforcing bad behaviour. Less bad is still bad. > And if it doesn't work it will still be a much nicer and > quieter here with only Nikos' trolling than with 10x as much > garbage from the local vigilantes who are more obnoxious > than he. But not quiet enough for some people. They hope that somehow punishing Nikos for his behaviour, although it may make the environment even less nice in the short term, may help to make the environment as nice again as it was before Nikos started his quest for spoon feeders. While reinforcing bad bahaviour provides no hope at all for that. -- Antoon Pardon From rurpy at yahoo.com Mon Jun 17 13:56:19 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Mon, 17 Jun 2013 10:56:19 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> Message-ID: <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> On 06/17/2013 02:15 AM, Antoon Pardon wrote: > Op 17-06-13 05:46, rurpy at yahoo.com schreef: >> On 06/16/2013 02:04 PM, Steven D'Aprano wrote: >> >>> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >>> is unproductive, it makes this a hostile, unpleasant place to be, it >>> ruins the environment for the rest of the community, it's off topic, and >>> it simply doesn't work to discourage trolls. >> The difficulty with trying to suppress such responses is that >> the flamers get just as much pleasure from having a target >> to unrestrainedly spew their pent up anger and vile at, as >> the troll gets from simulating that reaction. The result is >> a positive feedback loop. >> > Well if asocial behaviour of one provokes asocial behaviour in > others, you can't claim the problem is not the social behaviour > of the first. Sure I can. If you have a photodetector that activates a bright light when it detects a flash, you can blame the first flash for the fact that the bright light is on all the time. Or you can say that stray flashes are to be expected now and then in the environment of this system and the fault is responding to them with a bright light. >> I could be wrong but I don't think Nikos is a pure troll -- >> someone motivated purely by provoking reaction and discord. >> He has a real website and his problems with Python seem like >> genuine problems many beginners have. He seems to have little >> knowledge, not much concern for anyone else but a lot of >> determination to get things working. I have certainly known >> people like that in the real world. > > Does that matter? I don't care what Nikos's motivation is. I > care about the result or effect of his behaviour and that seems > to differ very little from a troll. Intent is not magic. Bad > behaviour with the best of intentions still results in annoyance. > The only way it which intent makes a difference is when the > person with good intentions, upon learning his behaviour is > bothersome, tries to adapt his behaviour. As I said (and you disagree with below), I did see some attempts to adapt his behavior but it is not realistic to expect immediate acquiescence to every request made here, especially given that a lot of them were/are bullshit. >> I speculate that half of his "bad behavior" is simple "I want >> now and don't care about your conventions". The rest is a >> reaction to "we're the alphas, your a beta" attitude expressed >> by many here and later, overt hostility directed at him. He >> has changed some things -- his posting method, he's made an >> effort to understand his encoding issues, etc.' > > I don't see that much change in his style. He just admitted > not reading help files (because they are too technical for > him). So essentialy he is asking we give him a beginners > tutorial in everything he doesn't understand without much > effort of him trying to understand things on his own and > without much appreciation for the time of others. See my reply to ChrisA. My personal feeling is that he tends to ask on the list too quickly, but I suspect he also does more than you're giving him credit for. He seems to be naive (eg the password event), open and honest so when he says he has been trying to fix something for hours I am prone to believe him. I think his approach to fixing is to try making changes more or less at random, in part because he doesn't understand the docs (or doesn't look at them because they haven't made sense to him in the past) and in part because he hasn't developed any skill in debugging (a skill that I think most everyone here takes for granted but which doesn't come naturally to some people) and which also accounts for the poor formulation of his questions. I'm not willing to go though twelve gazillion previous posts to try and find examples of improved behavior so I'll leave it as my personal impression and that you disagree. >> So I think Steven's approach of responding to his questions, >> at least those that are coherent and don't require reading a >> dozen posts over several threads to piece together, with an >> actual attempt to help (not a bunch of obscure hints, links >> to wikipedia, and "you're an idiot" replies) is right. > A respons that is in effect reinforcing bad bahaviour. > >> If Nikos fails to respond with better questions, then those >> that do answer will get tired of trying to help and stop >> answering. In the meantime everyone else can just killfile >> or otherwise ignore him rather than egging him on by >> intentionally provoking him (unless of course you enjoy >> the results.) > > In the mean time you and steve can just killfile those you > think are just egging him on. Unfortunately it is not a symmetrical situation. Nikos responds only in his own threads and is more killable that many of the eggers who both more numerous and respond in many other threads that are of interest. But then I seldom killfile people (always have found it trivially easy just to skip over annoying threads) so maybe I need to explore killfile options more. >> So positive reinforcement for less bad behavior, negative >> reinforcement (which for trolling is NO response, not negative >> responses) for more bad. Standard behavioral conditioning. > It means you are still reinforcing bad behaviour. Less bad is > still bad. > >> And if it doesn't work it will still be a much nicer and >> quieter here with only Nikos' trolling than with 10x as much >> garbage from the local vigilantes who are more obnoxious >> than he. > But not quiet enough for some people. They hope that somehow > punishing Nikos for his behaviour, although it may make the > environment even less nice in the short term, may help to > make the environment as nice again as it was before Nikos > started his quest for spoon feeders. While reinforcing bad > bahaviour provides no hope at all for that. Unfortunately if Nikos is a troll as you say, the "punishment" is positive reinforcement, not negative. And if I am reading Nikos right, he seems to be a "fuck you" type person: "if you're an asshole to me I'll be an asshole right back", so again, "punishment" is going to be counter productive. [*1] Now if you could hire some Sicilian mafia gangster to visit Nikos in person that *might* be more effective but three decades of internet experience shows that flaming trolls is counter productive. [*2] ---- [*1] I know the obvious response is that he is being an asshole prior to any responses but my point is that flames produce more bad behavior from him, not less. [*2] "Experienced participants in online forums know that the most effective way to discourage a troll is usually to ignore it, because responding tends to encourage trolls to continue disruptive posts ? hence the often-seen warning: 'Please do not feed the trolls'". http://en.wikipedia.org/wiki/Troll_%28Internet%29#Usage) From antoon.pardon at rece.vub.ac.be Tue Jun 18 04:22:47 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Tue, 18 Jun 2013 10:22:47 +0200 Subject: Don't feed the troll... In-Reply-To: <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> Message-ID: <51C018D7.30704@rece.vub.ac.be> Op 17-06-13 19:56, rurpy at yahoo.com schreef: > On 06/17/2013 02:15 AM, Antoon Pardon wrote: >> Op 17-06-13 05:46, rurpy at yahoo.com schreef: >>> On 06/16/2013 02:04 PM, Steven D'Aprano wrote: >>> >>>> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >>>> is unproductive, it makes this a hostile, unpleasant place to be, it >>>> ruins the environment for the rest of the community, it's off topic, and >>>> it simply doesn't work to discourage trolls. >>> The difficulty with trying to suppress such responses is that >>> the flamers get just as much pleasure from having a target >>> to unrestrainedly spew their pent up anger and vile at, as >>> the troll gets from simulating that reaction. The result is >>> a positive feedback loop. >>> >> Well if asocial behaviour of one provokes asocial behaviour in >> others, you can't claim the problem is not the social behaviour >> of the first. > Sure I can. If you have a photodetector that activates a > bright light when it detects a flash, you can blame the first > flash for the fact that the bright light is on all the time. > Or you can say that stray flashes are to be expected now > and then in the environment of this system and the fault > is responding to them with a bright light. But that doesn't make sense. Your photodetector working as it does, is just as expected as the happening of stray flashes. There is no reason to differentiate between these two in terms of being expected or not. > As I said (and you disagree with below), I did see some > attempts to adapt his behavior but it is not realistic to > expect immediate acquiescence to every request made here, > especially given that a lot of them were/are bullshit. I don't care whether it is realistic or not. If he can't conform his behaviour in a reasonable way, he doesn't belong here. It is not realistic to expect someone who is just learing to swim to survive a jump in the deep. So we expect those people not to jump in the deep. We don't tolerate them jumping in the deep on the expectation that others will pull them out. That is wat Nikos keeps doing here, jumping in the deep. And a lot of people feel it is time we let him (metaphorically drown). >>> I speculate that half of his "bad behavior" is simple "I want >>> now and don't care about your conventions". The rest is a >>> reaction to "we're the alphas, your a beta" attitude expressed >>> by many here and later, overt hostility directed at him. He >>> has changed some things -- his posting method, he's made an >>> effort to understand his encoding issues, etc.' >> I don't see that much change in his style. He just admitted >> not reading help files (because they are too technical for >> him). So essentialy he is asking we give him a beginners >> tutorial in everything he doesn't understand without much >> effort of him trying to understand things on his own and >> without much appreciation for the time of others. > See my reply to ChrisA. Your reply doesn't address his unwillingness to read the documentation which was IMO rather apparant. > My personal feeling is that he tends to ask on the list too > quickly, but I suspect he also does more than you're giving > him credit for. He seems to be naive (eg the password event), > open and honest so when he says he has been trying to fix > something for hours I am prone to believe him. I don't care. In the end he is still jumping in the deep expecting others to drag him out. I don't care how much he does. Just as I don't care how much energy someone has put into learning to swim. If your skills are not adequate you don't jump into the deep. > I think his > approach to fixing is to try making changes more or less at > random, in part because he doesn't understand the docs (or > doesn't look at them because they haven't made sense to him > in the past) and in part because he hasn't developed any > skill in debugging (a skill that I think most everyone here > takes for granted but which doesn't come naturally to some > people) and which also accounts for the poor formulation of > his questions. I don't care whether he has trouble developping debuging skills or not. Just as I don't care if someone has trouble learning to swim or not. If it is reasonable to expect those skill in a specific environment, you are just rude if you enter without those skill and expect others to get you out of the troubles you probably will fall victim to. >> In the mean time you and steve can just killfile those you >> think are just egging him on. > Unfortunately it is not a symmetrical situation. > Nikos responds only in his own threads and is more killable > that many of the eggers who both more numerous and respond > in many other threads that are of interest. Can you explain how these people can egg Nikos on in threads in which he doesn't participate? I also don't find your assymmetry of much relevance. It is just happens how history played out. There is no priciple difference. In both cases we have people being annoyed by the behaviour of others. I you want to advise others should somehow ignore the behaviour they find annoying, you should expect to be given the same advise. >> But not quiet enough for some people. They hope that somehow >> punishing Nikos for his behaviour, although it may make the >> environment even less nice in the short term, may help to >> make the environment as nice again as it was before Nikos >> started his quest for spoon feeders. While reinforcing bad >> bahaviour provides no hope at all for that. > Unfortunately if Nikos is a troll as you say, the "punishment" > is positive reinforcement, not negative. And if I am reading > Nikos right, he seems to be a "fuck you" type person: "if > you're an asshole to me I'll be an asshole right back", so > again, "punishment" is going to be counter productive. [*1] It is all the same to me. I don't care much about what the most adequate term would be for his kind of behaviour. And of course he is too narcistic too realise he started with the asshole behaviour. And in my opinion he will continue to be an asshole as long as people continue to drag him out of the deep each time he behaves like an asshole and jumps in without the necessary skills. -- Antoon Pardon From invalid at invalid.invalid Tue Jun 18 09:42:27 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Tue, 18 Jun 2013 13:42:27 +0000 (UTC) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> Message-ID: On 2013-06-18, Antoon Pardon wrote: > Op 17-06-13 19:56, rurpy at yahoo.com schreef: >>> I don't see that much change in his style. He just admitted >>> not reading help files (because they are too technical for >>> him). So essentialy he is asking we give him a beginners >>> tutorial in everything he doesn't understand without much >>> effort of him trying to understand things on his own and >>> without much appreciation for the time of others. >> >> See my reply to ChrisA. > > Your reply doesn't address his unwillingness to read the > documentation which was IMO rather apparant. It's not only apparent, he explicitly stated that he refused to go read the references he has been provided because he prefers to have his questions answered by a "live" persion. IMO, anybody who behaves like doesn't deserve any more responses. -- Grant Edwards grant.b.edwards Yow! I guess you guys got at BIG MUSCLES from doing too gmail.com much STUDYING! From rurpy at yahoo.com Tue Jun 18 23:46:28 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Tue, 18 Jun 2013 20:46:28 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> Message-ID: On 06/18/2013 02:22 AM, Antoon Pardon wrote: > Op 17-06-13 19:56, rurpy at yahoo.com schreef: >> On 06/17/2013 02:15 AM, Antoon Pardon wrote: >>> Op 17-06-13 05:46, rurpy at yahoo.com schreef: >>>> On 06/16/2013 02:04 PM, Steven D'Aprano wrote: >>>>> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >>>>> is unproductive, it makes this a hostile, unpleasant place to be, it >>>>> ruins the environment for the rest of the community, it's off topic, and >>>>> it simply doesn't work to discourage trolls. >>>> The difficulty with trying to suppress such responses is that >>>> the flamers get just as much pleasure from having a target >>>> to unrestrainedly spew their pent up anger and vile at, as >>>> the troll gets from simulating that reaction. The result is >>>> a positive feedback loop. >>> Well if asocial behaviour of one provokes asocial behaviour in >>> others, you can't claim the problem is not the social behaviour >>> of the first. >> Sure I can. If you have a photodetector that activates a >> bright light when it detects a flash, you can blame the first >> flash for the fact that the bright light is on all the time. >> Or you can say that stray flashes are to be expected now >> and then in the environment of this system and the fault >> is responding to them with a bright light. > But that doesn't make sense. Your photodetector working as > it does, is just as expected as the happening of stray > flashes. There is no reason to differentiate between these > two in terms of being expected or not. I was using the photodetector/light system as a emotion-free analog of the troll/troll-feeders positive feedback system for which you claimed it was clearly the troll's fault for initiating the feedback condition. My intent was to point out that cause and effect are intertwined in feedback systems and it is equally valid to blame those responding to the troll for the end result as to blame the troll. And, since occasional trolls are to be expected, one is even justified in putting the preponderance of blame on the responders. >> As I said (and you disagree with below), I did see some >> attempts to adapt his behavior but it is not realistic to >> expect immediate acquiescence to every request made here, >> especially given that a lot of them were/are bullshit. > I don't care whether it is realistic or not. If he can't conform > his behaviour in a reasonable way, he doesn't belong here. It > is not realistic to expect someone who is just learing to swim > to survive a jump in the deep. So we expect those people not > to jump in the deep. We don't tolerate them jumping in the deep > on the expectation that others will pull them out. That is > wat Nikos keeps doing here, jumping in the deep. And a lot of > people feel it is time we let him (metaphorically drown). see "Drowning" below >>>> I speculate that half of his "bad behavior" is simple "I want >>>> now and don't care about your conventions". The rest is a >>>> reaction to "we're the alphas, your a beta" attitude expressed >>>> by many here and later, overt hostility directed at him. He >>>> has changed some things -- his posting method, he's made an >>>> effort to understand his encoding issues, etc.' >>> I don't see that much change in his style. He just admitted >>> not reading help files (because they are too technical for >>> him). So essentialy he is asking we give him a beginners >>> tutorial in everything he doesn't understand without much >>> effort of him trying to understand things on his own and >>> without much appreciation for the time of others. >> See my reply to ChrisA. > Your reply doesn't address his unwillingness to read the > documentation which was IMO rather apparant. My reply certainly did address that and did so explicitly. Now if you mean that you don't care *why* he doesn't want to read them, the only thing that matters is that he doesn't/won't, them we have different standard for evaluating people and I don't accept yours. To me the reason does matter as it affects my evaluation of how they may adapt in the future. >> My personal feeling is that he tends to ask on the list too >> quickly, but I suspect he also does more than you're giving >> him credit for. He seems to be naive (eg the password event), >> open and honest so when he says he has been trying to fix >> something for hours I am prone to believe him. > I don't care. In the end he is still jumping in the deep > expecting others to drag him out. I don't care how much > he does. Just as I don't care how much energy someone has > put into learning to swim. If your skills are not adequate > you don't jump into the deep. see "Drowning" below. >> I think his >> approach to fixing is to try making changes more or less at >> random, in part because he doesn't understand the docs (or >> doesn't look at them because they haven't made sense to him >> in the past) and in part because he hasn't developed any >> skill in debugging (a skill that I think most everyone here >> takes for granted but which doesn't come naturally to some >> people) and which also accounts for the poor formulation of >> his questions. > I don't care whether he has trouble developping debuging skills > or not. Just as I don't care if someone has trouble learning > to swim or not. If it is reasonable to expect those skill in > a specific environment, you are just rude if you enter without > those skill and expect others to get you out of the troubles > you probably will fall victim to. *Drowning: I can understand your feeling but being realistic (whether you care about that or not) it happens all the time and other aspects of society accept that. Around where I live we have mountain rescue units to retrieve both competent people who have had bad luck and total idiots who shouldn't be outside without a guardian. There are places the penalize the idiots in various ways but both the practice and the line between acceptable and unacceptable risk are controversial. I don't accept you drawing the line for me, especially when I have my own line formed by my own experience. >>> In the mean time you and steve can just killfile those you >>> think are just egging him on. >> Unfortunately it is not a symmetrical situation. >> Nikos responds only in his own threads and is more killable >> that many of the eggers who both more numerous and respond >> in many other threads that are of interest. > Can you explain how these people can egg Nikos on in threads > in which he doesn't participate? I also don't find your > assymmetry of much relevance. It is just happens how > history played out. There is no priciple difference. In both > cases we have people being annoyed by the behaviour of others. > I you want to advise others should somehow ignore the behaviour > they find annoying, you should expect to be given the same > advise. Those who are annoyed excessively by Nikos can (relatively) easily ignore him by filtering him and his threads and continue to participate in the group as it was before Nikos. However, those who aren't bothered (as much) by him and are willing to read or participate in his threads can not easily ignore anti-Nikos hate posts because they can't easily filter out those while leaving the non-hate ones and without also filtering non-Nikos threads. (Perhaps there are newsgroup readers that allow one to killfile an individual but only in certain threads but I doubt they are common.) Now its pretty clear that (in general) such hate-posts do not serve to drive away their target and often increase the volume and prolong the miscreant's stay. So their main utility is to drive away those who wish to participate in Nikos' threads. While you may consider that a good thing, I consider it coercion and an attempt to forcibly restrict my free choice. It is also the same behavior you accuse Nikos of -- being offensive to force others to do what you want. If you want me to go along with your proposal then convince me with rational arguments. The alternative (for you to filter Nikos) does not restrict your choice significantly -- indeed you are exercising your choice by filtering out what you don't want to see. Another asymmetric aspect is that the cure you propose can be implemented anytime -- if Nikos continues to be offensive your proposal is still available a month from now and likely with more support. This is not true of the alternate approach though -- you can't decide to try being helpful once someone is gone [*1]. So if there is any doubt about the best approach, prudence argues for delay. I hope this explains more clearly my mention of asymmetry and why it *is* relevant. >>> But not quiet enough for some people. They hope that somehow >>> punishing Nikos for his behaviour, although it may make the >>> environment even less nice in the short term, may help to >>> make the environment as nice again as it was before Nikos >>> started his quest for spoon feeders. While reinforcing bad >>> bahaviour provides no hope at all for that. >> Unfortunately if Nikos is a troll as you say, the "punishment" >> is positive reinforcement, not negative. And if I am reading >> Nikos right, he seems to be a "fuck you" type person: "if >> you're an asshole to me I'll be an asshole right back", so >> again, "punishment" is going to be counter productive. [*1] > It is all the same to me. I don't care much about what the most > adequate term would be for his kind of behaviour. And of course > he is too narcistic too realise he started with the asshole > behaviour. And in my opinion he will continue to be an asshole > as long as people continue to drag him out of the deep each time > he behaves like an asshole and jumps in without the necessary > skills. Fine, that is your opinion. And you may be right. But I don't find people who state with certainty what other people will do in the future to be very convincing. Nor does the exaggeration, fact-twisting and emotionalism in most of anti-Nikos posts make for a good case. People jump into lots of things without the necessary skills all the time. I have myself more than once. I see nothing wrong with lending a helping hand when possible and I don't feel qualified to sit as judge and jury as to whether he should or should not be running a web site. He says his clients are his friends. And after Chris' shenanigans, if they continue to stay with him, it is certainly their choice. As for community standards, I think you should have more faith in the participants here -- what will likely be effective in causing Nikos to leave, is not hate mail but inability to get help here -- and that will be the natural result if he continues to annoy people and, one by one, those willing to help give up and stop. There is no need for you to coerce those willing to try to deal with him to speed things up when you have the tools to mostly ignore him. ---- [*1] This assumes your approach is successful of course but then, that is what *you* are claiming it will be. From antoon.pardon at rece.vub.ac.be Wed Jun 19 06:57:04 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Wed, 19 Jun 2013 12:57:04 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> Message-ID: <51C18E80.2070107@rece.vub.ac.be> Op 19-06-13 05:46, rurpy at yahoo.com schreef: > On 06/18/2013 02:22 AM, Antoon Pardon wrote: >> Op 17-06-13 19:56, rurpy at yahoo.com schreef: > I was using the photodetector/light system as a emotion-free > analog of the troll/troll-feeders positive feedback system for > which you claimed it was clearly the troll's fault for initiating > the feedback condition. My intent was to point out that cause > and effect are intertwined in feedback systems and it is equally > valid to blame those responding to the troll for the end result > as to blame the troll. And, since occasional trolls are to > be expected, one is even justified in putting the preponderance > of blame on the responders. I don't remember making such a claim. What I do remember is you among others claiming that the problem was not (so much) the troll (Nikos) but the others. I only made the remark that you can't claim the troll is not a problem if he provokes behaviour you find problematic. And your last conclusion is unsound. You forget to include the fact that once a troll appeared, people reacting badly to the troll is also to be expected. So with regards to this aspect there is no difference between the troll and the responders, both being expected and so no ground to put the preponderance of blame on the responders. >> I don't care whether he has trouble developping debuging skills >> or not. Just as I don't care if someone has trouble learning >> to swim or not. If it is reasonable to expect those skill in >> a specific environment, you are just rude if you enter without >> those skill and expect others to get you out of the troubles >> you probably will fall victim to. > *Drowning: > I can understand your feeling but being realistic (whether > you care about that or not) it happens all the time and other > aspects of society accept that. Around where I live we have > mountain rescue units to retrieve both competent people who > have had bad luck and total idiots who shouldn't be outside > without a guardian. There are places the penalize the idiots > in various ways but both the practice and the line between > acceptable and unacceptable risk are controversial. I don't > accept you drawing the line for me, especially when I have > my own line formed by my own experience. Well others don't appreciate you drawing the lines for them either. If you think others have no business drawing the line for what is acceptable on this mailinglist/newsgroup then you have no business drawing such a line yourself. > Those who are annoyed excessively by Nikos can (relatively) > easily ignore him by filtering him and his threads and > continue to participate in the group as it was before Nikos. > > However, those who aren't bothered (as much) by him and are > willing to read or participate in his threads can not easily > ignore anti-Nikos hate posts because they can't easily filter > out those while leaving the non-hate ones and without also > filtering non-Nikos threads. (Perhaps there are newsgroup > readers that allow one to killfile an individual but only in > certain threads but I doubt they are common.) I find this a very one-sided view. Those annoyed excessively by Nikos can't easily ignore him without a cost. There may be people involved in such a tread they value and like to read. They can't easily filter the valuable contributions in such a thread from the nth repeated answer to the same question either. You ask of others they should tolerate this cost Nikos brings on for them but you protest when you have to take on this kind of cost yourself. As far as I see you have just the same options as those bothered by Nikos. Make some kind of cost benefit analysis and decide on that basis whether you consider it worth your while to continue reading/contributing to a particular thread. > Now its pretty clear that (in general) such hate-posts do not > serve to drive away their target and often increase the volume > and prolong the miscreant's stay. So their main utility is to > drive away those who wish to participate in Nikos' threads. I don't know it is that clear. I have the impression it can be rather effective in cases where the whole community makes it clear trolls are not welcome. Of course if part of the community is more bothered by those making trolls feel unwelcome than by the trolls themselves, such strive will of course attract them. > While you may consider that a good thing, I consider it coercion > and an attempt to forcibly restrict my free choice. It is also > the same behavior you accuse Nikos of -- being offensive to > force others to do what you want. If you want me to go along > with your proposal then convince me with rational arguments. No I don't particularly consider that a good thing. I just find your view one-sided. Yes indeed it is in some way the same behaviour I accuse Nikos of. What they are doing is upping the cost for you in participating in some threads, just as Nikos is upping the cost for them in participating in some threads. The main difference is for whom those costs go up. In the first case it is for the Nikos botherers and in the second case it is for you. And when the costs go up for others, you somehow thinks they should deal with the unpleasant choice life has dealt them, but when the costs goes up for you it suddenly is about coercion and forcibly restricting free choice. Personnaly once a troll shows up, I prefer others to make him feel unwelcome. There is nothing wrong with making someone feel unwelcome if he is behaving in a way that is annoying a substantial part of the community. And if others are somehow behaving in a way that will contribute to that annoying behaviour, there is nothing wrong in making those feel unconfortable in continuing with that, either. > The alternative (for you to filter Nikos) does not restrict your > choice significantly -- indeed you are exercising your choice by > filtering out what you don't want to see. I don't appreciate it when you decide for others which alternatives are restricting their choice significantly and which do not. Others can have a very different appreciation of things than you have. > Another asymmetric aspect is that the cure you propose can be > implemented anytime -- if Nikos continues to be offensive your > proposal is still available a month from now and likely with > more support. This is not true of the alternate approach > though -- you can't decide to try being helpful once someone > is gone [*1]. So if there is any doubt about the best approach, > prudence argues for delay. What I propose is to stop encouraging his trollish behaviour. In point of fact Steve has already began doing so by demanding Nikos somehow shows he has done relevant work himself before wanting to help him further. Which I am perfectly fine with. > >> It is all the same to me. I don't care much about what the most >> adequate term would be for his kind of behaviour. And of course >> he is too narcistic too realise he started with the asshole >> behaviour. And in my opinion he will continue to be an asshole >> as long as people continue to drag him out of the deep each time >> he behaves like an asshole and jumps in without the necessary >> skills. > Fine, that is your opinion. And you may be right. But I > don't find people who state with certainty what other people > will do in the future to be very convincing. Nor does the > exaggeration, fact-twisting and emotionalism in most of > anti-Nikos posts make for a good case. That can be true but I find a significant part of exaggeration, fact-twisting and emotionalism in those who want to deal with the Nikos bothered too. > People jump into lots of things without the necessary skills > all the time. I have myself more than once. I see nothing > wrong with lending a helping hand when possible and I don't > feel qualified to sit as judge and jury as to whether he should > or should not be running a web site. He says his clients are > his friends. And after Chris' shenanigans, if they continue > to stay with him, it is certainly their choice. Sometimes the best hand you can lend to someone is making it clear they are not ready because they lack the basics. Helping a hand in that case can help them muddy on somehow but can also move them into the direction of a bigger disaster than before you decided to lend a helping hand. And what about you lending a hand in behaviour that is annoying others? If someone is not fit to drive and doesn't know how to get the engine started, will you help him with that so that he can then annoy the others in traffic with his erratic driving? > As for community standards, I think you should have more faith > in the participants here -- what will likely be effective in > causing Nikos to leave, is not hate mail but inability to get > help here -- and that will be the natural result if he continues > to annoy people and, one by one, those willing to help give up > and stop. There is no need for you to coerce those willing to > try to deal with him to speed things up when you have the tools > to mostly ignore him. There is no need for those willing to help Nikos, to do so in a way that encourages his assholery behaviour. There is no need to coerse people into making a choice between leaving the thread and missing out on some valuable contributions on the one hand and staying and trying to find the worth while contributions on the other hand. Somehow this lack of need is not enough for you to stop but you do seem to expect it is enough for others to stop. -- Antoon Pardon From ian.g.kelly at gmail.com Wed Jun 19 14:40:15 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Wed, 19 Jun 2013 12:40:15 -0600 Subject: Don't feed the troll... In-Reply-To: <51C18E80.2070107@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> Message-ID: On Wed, Jun 19, 2013 at 4:57 AM, Antoon Pardon wrote: > I don't remember making such a claim. What I do remember is > you among others claiming that the problem was not (so much) > the troll (Nikos) but the others. Count me among those who feel this way. > And your last conclusion is unsound. You forget to include the > fact that once a troll appeared, people reacting badly to the > troll is also to be expected. So with regards to this aspect > there is no difference between the troll and the responders, > both being expected and so no ground to put the preponderance > of blame on the responders. No, I don't agree with that at all. Trolls are to be expected because there will always be those out in the world who want to have a little fun and have no regard for either the list or those who use it. There is nothing to be done about that. On the other hand, the flamers responding to the trolls are regular contributers to the list who presumably do care about keeping the list courteous, respectful, welcoming and enjoyable to participate in. Toward that end, I do not think it is at all unreasonable to expect posters not to throw those principles out the window just because a troll showed up. > Well others don't appreciate you drawing the lines for them > either. If you think others have no business drawing the line > for what is acceptable on this mailinglist/newsgroup then you > have no business drawing such a line yourself. Ultimately there is no enforcement on this list, and all of us must draw our own lines. The question then is: will one draw the line somewhere that is respectful of the list and promotes positive contributions, or somewhere that will push others toward kill-filing one and/or giving up on the list altogether? > I find this a very one-sided view. Those annoyed excessively > by Nikos can't easily ignore him without a cost. There may > be people involved in such a tread they value and like to > read. They can't easily filter the valuable contributions > in such a thread from the nth repeated answer to the same > question either. So their ideal solution is to flame him until he goes away, with the result being that the threads don't exist to begin with? If it's difficult to filter "valuable contributions" from a thread while trying to ignore every other post, think how much harder it will be to got those same "valuable contributions" from a thread that doesn't exist in the first place. Finding anything of value here is clearly not the goal of the flamers, and they might as well just kill the threads at their end -- it's the same net effect for a lot less work, and it doesn't impact the ability of anyone else to interact with those threads if they might wish to. > You ask of others they should tolerate this cost Nikos > brings on for them but you protest when you have to take > on this kind of cost yourself. It's a lot easier to ignore a thread than it is to ignore specific posters within specific threads. And per my response above, your argument that the flamers might not want to just ignore the thread doesn't fly. > I don't know it is that clear. I have the impression it can be > rather effective in cases where the whole community makes it > clear trolls are not welcome. Of course if part of the community > is more bothered by those making trolls feel unwelcome than by > the trolls themselves, such strive will of course attract them. I don't think you understand the troll mindset. They don't care whether the community does or does not welcome them, because they don't view themselves as part of the community. They just want affirmation and attention, which is exactly what they get when somebody flames them. They may even find it amusing that somebody can get so worked up over their disingenuous posts, which then spurs them on to continue trying to get the same reaction. From antoon.pardon at rece.vub.ac.be Thu Jun 20 05:41:57 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Thu, 20 Jun 2013 11:41:57 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> Message-ID: <51C2CE65.1090605@rece.vub.ac.be> Op 19-06-13 20:40, Ian Kelly schreef: > On Wed, Jun 19, 2013 at 4:57 AM, Antoon Pardon > wrote: >> I don't remember making such a claim. What I do remember is >> you among others claiming that the problem was not (so much) >> the troll (Nikos) but the others. > Count me among those who feel this way. Well You are entitled to your judgement, but so are those who feel differently. For now I don't see a reason to favor your judgement over others. >> And your last conclusion is unsound. You forget to include the >> fact that once a troll appeared, people reacting badly to the >> troll is also to be expected. So with regards to this aspect >> there is no difference between the troll and the responders, >> both being expected and so no ground to put the preponderance >> of blame on the responders. > No, I don't agree with that at all. Trolls are to be expected because > there will always be those out in the world who want to have a little > fun and have no regard for either the list or those who use it. There > is nothing to be done about that. On the other hand, the flamers > responding to the trolls are regular contributers to the list who > presumably do care about keeping the list courteous, respectful, > welcoming and enjoyable to participate in. Toward that end, I do not > think it is at all unreasonable to expect posters not to throw those > principles out the window just because a troll showed up. There are two problems with your reasoning. The first is that you are equivocating on "expect". "Expect" can mean you will be surprised if it doesn't happen but it can also mean you will feel indignant or disappointed or something similar when it doesn't happen. Now I won't feel surprise when a troll turns up and I also won't feel surprise when the troll attracts flamers and it is my guess this is the meaning you use when you write trolls are to be expected. I doubt you want to express indignation or disappointment with the prospect of no trolls showing up. But then you seem to switch meaning when you talk about the flamers. There it sure looks like you are expressing indignation at the prospect of community members not upholding the principles you find important. The second problem is that I find it a one sided view. If you want a courteous, respectful, welcoming and enjoyable to participate in list, shouldn't you also be careful in not encouraging trollish behaviour? Being courteous to or cooperating with someone behaving trollishly, is IMO enabling that kind of behaviour and so those doing so, seem to already throw those priciples out the window because they are cooperating with the troll who is making this list less courteous, respectful, welcoming and enjoyable to participate in for a significant number of people. There is also the aspect that you can only try to keep something if you have the feeling it is still present. If contributers start feeling this list is no longer the hospitable place it once was, they feel less inclined to do the effort themselves. If you'd like people not to throw out certain principles you'd better make sure they don't feel those principles have already been thrown out. >> Well others don't appreciate you drawing the lines for them >> either. If you think others have no business drawing the line >> for what is acceptable on this mailinglist/newsgroup then you >> have no business drawing such a line yourself. > Ultimately there is no enforcement on this list, and all of us must > draw our own lines. The question then is: will one draw the line > somewhere that is respectful of the list and promotes positive > contributions, or somewhere that will push others toward kill-filing > one and/or giving up on the list altogether? Indeed, and how is it promoting positive contributions if you answer trollish contributions about the same way as you do interesting contributions? > So their ideal solution is to flame him until he goes away, with the > result being that the threads don't exist to begin with? If it's > difficult to filter "valuable contributions" from a thread while > trying to ignore every other post, think how much harder it will be to > got those same "valuable contributions" from a thread that doesn't > exist in the first place. Those valuable contributions will then probably turn up in an other thread. One that isn't a resource hog for all contributors. >> I don't know it is that clear. I have the impression it can be >> rather effective in cases where the whole community makes it >> clear trolls are not welcome. Of course if part of the community >> is more bothered by those making trolls feel unwelcome than by >> the trolls themselves, such strive will of course attract them. > I don't think you understand the troll mindset. They don't care > whether the community does or does not welcome them, because they > don't view themselves as part of the community. They just want > affirmation and attention, which is exactly what they get when > somebody flames them. They may even find it amusing that somebody can > get so worked up over their disingenuous posts, which then spurs them > on to continue trying to get the same reaction. And why then should it be the flamers that are bothersome here? Isn't then any response getting the troll affirmation and attention? Why shouldn't the flamers be bothered by those feeding the troll and making this list thus a less hospitable place, just because they do it in a polite and enabling way? You are ignoring the fact that a lot of motivation behind the current flaming is what the flamers see as enabling behaviour from other contributors. If you want the flamers to stop with the behaviour you find annoying, I think you'd better feel some empathy about what makes them behave in such a way and make sure you are not contributing. That will make it more probable for them to take you serious. -- Antoon Pardon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.g.kelly at gmail.com Thu Jun 20 22:40:07 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Thu, 20 Jun 2013 20:40:07 -0600 Subject: Don't feed the troll... In-Reply-To: <51C2CE65.1090605@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> <51C2CE65.1090605@rece.vub.ac.be> Message-ID: On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon wrote: > There are two problems with your reasoning. The first is that you > are equivocating on "expect". "Expect" can mean you will be surprised > if it doesn't happen but it can also mean you will feel indignant or > disappointed or something similar when it doesn't happen. Perhaps I am, but it doesn't change my argument in any way. When a troll shows up I am not happy about it, but I am not disappointed either, because Trolls Happen. I am disappointed when members of the community act in ways that are detrimental to the community. Better? > The second problem is that I find it a one sided view. If you want > a courteous, respectful, welcoming and enjoyable to participate in > list, shouldn't you also be careful in not encouraging trollish > behaviour? Being courteous to or cooperating with someone behaving > trollishly, is IMO enabling that kind of behaviour and so those > doing so, seem to already throw those priciples out the window because > they are cooperating with the troll who is making this list less > courteous, respectful, welcoming and enjoyable to participate in > for a significant number of people. You'll note that I haven't engaged Nikos at all in some time. That's because I think he's a troll. I think though that those who are continuing to help him do so because they do not think that he is a troll. I am not going to try to thrust my own opinion of who is or is not a troll and who can or cannot be given help upon the list -- that is their opinion, they are entitled to it, and maybe they see something in the exchange that I don't. That is different in my eyes from somebody who does identify Nikos as a troll and then goes on to egg him on anyway, whether it be courteous or belligerent. From antoon.pardon at rece.vub.ac.be Fri Jun 21 05:18:02 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 21 Jun 2013 11:18:02 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> <51C2CE65.1090605@rece.vub.ac.be> Message-ID: <51C41A4A.2000605@rece.vub.ac.be> Op 21-06-13 04:40, Ian Kelly schreef: > On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon > wrote: >> There are two problems with your reasoning. The first is that you >> are equivocating on "expect". "Expect" can mean you will be surprised >> if it doesn't happen but it can also mean you will feel indignant or >> disappointed or something similar when it doesn't happen. > > Perhaps I am, but it doesn't change my argument in any way. When a > troll shows up I am not happy about it, but I am not disappointed > either, because Trolls Happen. I am disappointed when members of the > community act in ways that are detrimental to the community. Better? But that last one doesn't ring true. Enabling a troll is also acting in a way that is detrimental to the community. But I haven't seen you express disappointment in that. Those that expressed their disappointment with the enabling behaviour were more or less told they should deal with it. So tell me, why should your disappointment merrit more consideration? > >> The second problem is that I find it a one sided view. If you want >> a courteous, respectful, welcoming and enjoyable to participate in >> list, shouldn't you also be careful in not encouraging trollish >> behaviour? Being courteous to or cooperating with someone behaving >> trollishly, is IMO enabling that kind of behaviour and so those >> doing so, seem to already throw those priciples out the window because >> they are cooperating with the troll who is making this list less >> courteous, respectful, welcoming and enjoyable to participate in >> for a significant number of people. > > You'll note that I haven't engaged Nikos at all in some time. That's > because I think he's a troll. I think though that those who are > continuing to help him do so because they do not think that he is a > troll. I am not going to try to thrust my own opinion of who is or is > not a troll and who can or cannot be given help upon the list -- that > is their opinion, they are entitled to it, and maybe they see > something in the exchange that I don't. That doesn't change one bit of the fact they are enabling someone who exhibits assholery behaviour. Who since he started here has regularly changed his identity, yet these enablers keep suggesting that those who are bothered by him should just killfile him. If they were serious with that suggestion they at least could have told Nikos they were only going to reply to one specific identity. > That is different in my eyes from somebody who does identify Nikos as > a troll and then goes on to egg him on anyway, whether it be courteous > or belligerent. In my eyes that is a difference that only counts at the start of an exchange. Helping others allthough a fine goal by itself is not something that can be used to justify any means. If you learn that the person you are helping is showing assholery behaviour and how you are helping, sure looks like encouraging that assholery behaviour. When you decide to mostly ignore that, you are showing no concern for the other contributers on the list and are acting in a way that is detrimental to the community. If you want the python list to be a hospitable place, you have to be attentive for signals from other contributors that the level of hospitability is decreasing for them. If you ignore them or brush them off you then risk loosing them as cooperators to that goal. So if later you find the level of hospitability is decreasing for you, you are more likely to get ignored or brushed off too. -- Antoon Pardon From ian.g.kelly at gmail.com Fri Jun 21 12:19:01 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 21 Jun 2013 10:19:01 -0600 Subject: Don't feed the troll... In-Reply-To: <51C41A4A.2000605@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> <51C2CE65.1090605@rece.vub.ac.be> <51C41A4A.2000605@rece.vub.ac.be> Message-ID: On Fri, Jun 21, 2013 at 3:18 AM, Antoon Pardon wrote: > Op 21-06-13 04:40, Ian Kelly schreef: > >> On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon >> wrote: >>> There are two problems with your reasoning. The first is that you >>> are equivocating on "expect". "Expect" can mean you will be surprised >>> if it doesn't happen but it can also mean you will feel indignant or >>> disappointed or something similar when it doesn't happen. >> >> Perhaps I am, but it doesn't change my argument in any way. When a >> troll shows up I am not happy about it, but I am not disappointed >> either, because Trolls Happen. I am disappointed when members of the >> community act in ways that are detrimental to the community. Better? > > But that last one doesn't ring true. Enabling a troll is also acting > in a way that is detrimental to the community. But I haven't seen > you express disappointment in that. I've already explained why that is. First, it's less anguish to kill-file one troll than several vitriolic regulars (and I realize that he keeps changing his name, but fortunately I think he's only used three different /addresses/ in the time that he's been posting). Second, I don't want to bully anybody into not trying to help a user where they want to and believe that they can. It may be "enabling" for the troll, but it's unhealthy for the list in general. > Those that expressed their disappointment with the enabling behaviour > were more or less told they should deal with it. So tell me, why > should your disappointment merrit more consideration? When did I ever say that it should? I'm just putting my own opinions on the subject out there. > If you want the python list to be a hospitable place, you have > to be attentive for signals from other contributors that the > level of hospitability is decreasing for them. If you ignore > them or brush them off you then risk loosing them as cooperators > to that goal. So if later you find the level of hospitability > is decreasing for you, you are more likely to get ignored or > brushed off too. The level of hospitality is already decreasing for me. That's why I'm speaking up. From rustompmody at gmail.com Fri Jun 21 14:27:35 2013 From: rustompmody at gmail.com (rusi) Date: Fri, 21 Jun 2013 11:27:35 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> <51C2CE65.1090605@rece.vub.ac.be> <51C41A4A.2000605@rece.vub.ac.be> Message-ID: On Friday, June 21, 2013 9:49:01 PM UTC+5:30, Ian wrote: > > The level of hospitality is already decreasing for me. That's why I'm > speaking up. I believe that this can be a point of unanimity -- "The level of hospitality having gone down enough, I felt the need to speak up". And with the immediate factor(s) for this in abeyance for the last couple of days, maybe we can shelve this and move on? Just a suggestion and a request to all... From steve+comp.lang.python at pearwood.info Wed Jun 19 20:47:10 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 20 Jun 2013 00:47:10 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <51C18E80.2070107@rece.vub.ac.be> Message-ID: <51c2510d$0$29999$c3e8da3$5496439d@news.astraweb.com> On Wed, 19 Jun 2013 12:40:15 -0600, Ian Kelly wrote: > On the other hand, the flamers responding to the trolls are regular > contributers to the list who presumably do care about keeping the list > courteous, respectful, welcoming and enjoyable to participate in. > Toward that end, I do not think it is at all unreasonable to expect > posters not to throw those principles out the window just because a > troll showed up. +1000 -- Steven From rurpy at yahoo.com Wed Jun 19 17:13:27 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Wed, 19 Jun 2013 14:13:27 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> Message-ID: <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> On 06/19/2013 04:57 AM, Antoon Pardon wrote: > Op 19-06-13 05:46, rurpy at yahoo.com schreef: >> On 06/18/2013 02:22 AM, Antoon Pardon wrote: >>> Op 17-06-13 19:56, rurpy at yahoo.com schreef: >> I was using the photodetector/light system as a emotion-free >> analog of the troll/troll-feeders positive feedback system for >> which you claimed it was clearly the troll's fault for initiating >> the feedback condition. My intent was to point out that cause >> and effect are intertwined in feedback systems and it is equally >> valid to blame those responding to the troll for the end result >> as to blame the troll. And, since occasional trolls are to >> be expected, one is even justified in putting the preponderance >> of blame on the responders. > I don't remember making such a claim. What I do remember is > you among others claiming that the problem was not (so much) > the troll (Nikos) but the others. I only made the remark that > you can't claim the troll is not a problem if he provokes > behaviour you find problematic. > And your last conclusion is unsound. You forget to include the > fact that once a troll appeared, people reacting badly to the > troll is also to be expected. So with regards to this aspect > there is no difference between the troll and the responders, > both being expected and so no ground to put the preponderance > of blame on the responders. No, "blame" implies assumption of a particular point of view. From a troll's viewpoint, newsgroup participants that *don't* respond are to blame because they deprive the troll of his fun. Our viewpoint is that of newsgroup participants. We assume they have volition, else this whole thread is pointless. Since they have a choice of how to respond, then if they chose to respond in a way that produces an undesirable outcome, then it is fair "blame" them. The troll is outside the volition of the group and so his appearance is effectively an act of nature. >>> I don't care whether he has trouble developping debuging skills >>> or not. Just as I don't care if someone has trouble learning >>> to swim or not. If it is reasonable to expect those skill in >>> a specific environment, you are just rude if you enter without >>> those skill and expect others to get you out of the troubles >>> you probably will fall victim to. >> *Drowning: >> I can understand your feeling but being realistic (whether >> you care about that or not) it happens all the time and other >> aspects of society accept that. Around where I live we have >> mountain rescue units to retrieve both competent people who >> have had bad luck and total idiots who shouldn't be outside >> without a guardian. There are places the penalize the idiots >> in various ways but both the practice and the line between >> acceptable and unacceptable risk are controversial. I don't >> accept you drawing the line for me, especially when I have >> my own line formed by my own experience. > Well others don't appreciate you drawing the lines for them > either. If you think others have no business drawing the line > for what is acceptable on this mailinglist/newsgroup then you > have no business drawing such a line yourself. I am not "drawing the line for them", I am drawing it for me. I think you see a non-existent conflict because you are assume there is only one line. I do not make that assumption. If you think Nikos has crossed your line, then I acknowledge your right not to help him. I even acknowledge your right to flame him and encourage others to do so. My argument is that if you exercise your right (the flamage part) the results on the newsgroup, when considered on a best outcome for the most people basis, will be less good than if you choose not to exercise your right. >> Those who are annoyed excessively by Nikos can (relatively) >> easily ignore him by filtering him and his threads and >> continue to participate in the group as it was before Nikos. >> >> However, those who aren't bothered (as much) by him and are >> willing to read or participate in his threads can not easily >> ignore anti-Nikos hate posts because they can't easily filter >> out those while leaving the non-hate ones and without also >> filtering non-Nikos threads. (Perhaps there are newsgroup >> readers that allow one to killfile an individual but only in >> certain threads but I doubt they are common.) > I find this a very one-sided view. Those annoyed excessively > by Nikos can't easily ignore him without a cost. There may > be people involved in such a tread they value and like to > read. They can't easily filter the valuable contributions > in such a thread from the nth repeated answer to the same > question either. > You ask of others they should tolerate this cost Nikos > brings on for them but you protest when you have to take > on this kind of cost yourself. The costs are different in magnitude. Roughly: 1.People willing to read and possibly respond helpfully to Nikos. 2.People annoyed by Nikos who want him gone and don't want to see anything by him or in his threads. (and if people find you convincing) 3.People annoyed by Nikos but willing to read his threads in order to send antagonistic posts. If people ignore your call to spam Nikos with antagonistic posts (and stop the considerable amount of such activity already occurring) then the costs (difference compared to a no-Nikos newsgroup) might be: Group 1: 0 Group 2: 1 (killfile Nikos and kill or skip his new threads when encountered.) If people continue to send both unhelpful and antagonistic posts to Nikos: Group 1: 5 (can't killfile posters because they post in other non-Nikos threads. Have to skip large volume of junk posts based on visual peek at contents or recognition of poster as a vigilante.) Group 2: 1 (killfile Nikos and kill or skip his new threads when encountered.) As for those annoyed by Nikos but who > "can't easily filter the valuable contributions > in [a Nikos] thread from the nth repeated answer to the same > question" how is that different from any non-Nikos thread other than that your proposed action that makes it harder? Of course all the above is not to be taken seriously beyond the general point I'm trying to illustrate (that the costs are non-symmetrical). Nor taken as complete -- other factors like freedom of expression also need consideration. > As far as I see you have just the same options as those > bothered by Nikos. Make some kind of cost benefit analysis > and decide on that basis whether you consider it worth your > while to continue reading/contributing to a particular > thread. Of course. We all do that subconsciously every time we read a newsgroup. But that is not what we are discussing We are discussing the effects of two different policies of different interest groups on the newsgroup. You advocate a policy of not responding helpfully and responding aggressively to those exhibiting "undesirable" behavior where "undesirable" is defined by you or some vague group consensus. I advocate a policy not responding aggressively at all and responding helpfully or not at all based on a personal evaluation of the "undesirable" behavior. So the question to answer is: how do those different policies affect the cost/benefits of the different groups and which one leads to the greatest good for the most? >> Now its pretty clear that (in general) such hate-posts do not >> serve to drive away their target and often increase the volume >> and prolong the miscreant's stay. So their main utility is to >> drive away those who wish to participate in Nikos' threads. > I don't know it is that clear. I have the impression it can be > rather effective in cases where the whole community makes it > clear trolls are not welcome. Of course if part of the community > is more bothered by those making trolls feel unwelcome than by > the trolls themselves, such strive will of course attract them. Nothing involving human behavior is totally clear. There are certainly those who advocate responding aggressively to trolls. My impression, supported by the widespread use of the phrase "don't feed the troll", along with the rationality of the main argument for it, "trolls seek attention so not responding is the most effective way of getting them to leave", is that that is still the majority view. Of course that presupposes the goal is getting the troll to leave. I said, trolls can feed group participants too by providing an excuse to vent anger and it is possible to conceive of other goals that some might have as well. And in the current case, I am not convinced that Nikos is a troll although he does engage in behavior that comes across as trollish. >> While you may consider that a good thing, I consider it coercion >> and an attempt to forcibly restrict my free choice. It is also >> the same behavior you accuse Nikos of -- being offensive to >> force others to do what you want. If you want me to go along >> with your proposal then convince me with rational arguments. > No I don't particularly consider that a good thing. I just find > your view one-sided. Yes indeed it is in some way the same behaviour > I accuse Nikos of. What they are doing is upping the cost for you > in participating in some threads, just as Nikos is upping the cost > for them in participating in some threads. The main difference is > for whom those costs go up. In the first case it is for the Nikos > botherers and in the second case it is for you. Again no, my point was the costs are not the same. > And when the costs go up for others, you somehow thinks they should > deal with the unpleasant choice life has dealt them, but when > the costs goes up for you it suddenly is about coercion and forcibly > restricting free choice. It's coercion because its *only* significant effect is to raise the cost for me. > Personnaly once a troll shows up, I prefer others to make him feel > unwelcome. There is nothing wrong with making someone feel unwelcome > if he is behaving in a way that is annoying a substantial part of > the community. And if others are somehow behaving in a way that > will contribute to that annoying behaviour, there is nothing wrong > in making those feel unconfortable in continuing with that, either. Being somewhat anarchistic myself, I have a certain sympathy for that point of view. Of course you'll grant me the same right, yes? When another substantial part of the community is annoyed by your part's obnoxious and hostile posts you will accept our right to respond with obnoxious and hostile posts directed at your part, right? And I certainly will expect anyone annoyed by my posts to your part to respond in kind with lots of obnoxious posts to me and my part. And so on... Does that really sound to you like good policy to advocate? >> The alternative (for you to filter Nikos) does not restrict your >> choice significantly -- indeed you are exercising your choice by >> filtering out what you don't want to see. > I don't appreciate it when you decide for others which alternatives > are restricting their choice significantly and which do not. Others > can have a very different appreciation of things than you have. Right. Which is why tolerance is so important. Tolerance involves not reacting to every irritation with a hostile response likely to provoke more of the same. It also implies not assuming what seems like trolling to you is trolling to me. >> Another asymmetric aspect is that the cure you propose can be >> implemented anytime -- if Nikos continues to be offensive your >> proposal is still available a month from now and likely with >> more support. This is not true of the alternate approach >> though -- you can't decide to try being helpful once someone >> is gone [*1]. So if there is any doubt about the best approach, >> prudence argues for delay. > What I propose is to stop encouraging his trollish behaviour. > In point of fact Steve has already began doing so by demanding > Nikos somehow shows he has done relevant work himself before > wanting to help him further. Which I am perfectly fine with. No, What you were proposing was total boycott on any helpful responses to Nikos and to continue and to increase the flood of antagonistic posts to Nikos to drive him out. I too am fine with someone not responding to Nikos if unhappy with his method of interaction, either in general or on a post-by post basis. If fact, I think I've been saying that all along. >>> It is all the same to me. I don't care much about what the most >>> adequate term would be for his kind of behaviour. And of course >>> he is too narcistic too realise he started with the asshole >>> behaviour. And in my opinion he will continue to be an asshole >>> as long as people continue to drag him out of the deep each time >>> he behaves like an asshole and jumps in without the necessary >>> skills. >> Fine, that is your opinion. And you may be right. But I >> don't find people who state with certainty what other people >> will do in the future to be very convincing. Nor does the >> exaggeration, fact-twisting and emotionalism in most of >> anti-Nikos posts make for a good case. > That can be true but I find a significant part of exaggeration, > fact-twisting and emotionalism in those who want to deal with > the Nikos bothered too. I haven't noticed that so much but maybe that because the posts from those willing to deal with Nikos have been a tiny fraction of those from the vigilante side. >> People jump into lots of things without the necessary skills >> all the time. I have myself more than once. I see nothing >> wrong with lending a helping hand when possible and I don't >> feel qualified to sit as judge and jury as to whether he should >> or should not be running a web site. He says his clients are >> his friends. And after Chris' shenanigans, if they continue >> to stay with him, it is certainly their choice. > Sometimes the best hand you can lend to someone is making it > clear they are not ready because they lack the basics. > Helping a hand in that case can help them muddy on somehow > but can also move them into the direction of a bigger disaster > than before you decided to lend a helping hand. > And what about you lending a hand in behaviour that is annoying > others? If someone is not fit to drive and doesn't know how > to get the engine started, will you help him with that so that > he can then annoy the others in traffic with his erratic driving? As I said above, we all have our own lines. Your hypothetical would be over the line for me because of the high risk of death or injury to others. Someone creating new newsgroup threads that can be ignored does not rise to that level of seriousness and does not cross my line. Nor does the fact that he might create an insecure website when weighed with his right to try and (I hope eventually) learn. >> As for community standards, I think you should have more faith >> in the participants here -- what will likely be effective in >> causing Nikos to leave, is not hate mail but inability to get >> help here -- and that will be the natural result if he continues >> to annoy people and, one by one, those willing to help give up >> and stop. There is no need for you to coerce those willing to >> try to deal with him to speed things up when you have the tools >> to mostly ignore him. > > There is no need for those willing to help Nikos, to do so in a > way that encourages his assholery behaviour. But you've said you believe *any* helpful response to Nikos will "encourage his assholery behaviour". So there in no "need" to provide any helpful response to Nikos. But then, I guess that is a true statement for responding to anyone here, depending on what "need" means. > There is no need > to coerse people into making a choice between leaving the thread > and missing out on some valuable contributions on the one hand > and staying and trying to find the worth while contributions on > the other hand. And yet you are the one advocating diluting any valuable contributions in the thread with hostile and negative replies; your advocated action is the source of that coercion. > Somehow this lack of need is not enough for you to stop but > you do seem to expect it is enough for others to stop. It's not the lack of "need", it is the harmful consequent effects. From antoon.pardon at rece.vub.ac.be Fri Jun 21 15:32:41 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 21 Jun 2013 21:32:41 +0200 Subject: Don't feed the troll... In-Reply-To: <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> Message-ID: <51C4AA59.2020908@rece.vub.ac.be> Op 19-06-13 23:13, rurpy at yahoo.com schreef: > On 06/19/2013 04:57 AM, Antoon Pardon wrote: >> Op 19-06-13 05:46, rurpy at yahoo.com schreef: >>> On 06/18/2013 02:22 AM, Antoon Pardon wrote: >> I don't remember making such a claim. What I do remember is >> you among others claiming that the problem was not (so much) >> the troll (Nikos) but the others. I only made the remark that >> you can't claim the troll is not a problem if he provokes >> behaviour you find problematic. >> And your last conclusion is unsound. You forget to include the >> fact that once a troll appeared, people reacting badly to the >> troll is also to be expected. So with regards to this aspect >> there is no difference between the troll and the responders, >> both being expected and so no ground to put the preponderance >> of blame on the responders. > > No, "blame" implies assumption of a particular point of > view. From a troll's viewpoint, newsgroup participants that > *don't* respond are to blame because they deprive the troll > of his fun. > > Our viewpoint is that of newsgroup participants. We assume > they have volition, else this whole thread is pointless. > Since they have a choice of how to respond, then if they > chose to respond in a way that produces an undesirable outcome, > then it is fair "blame" them. > > The troll is outside the volition of the group and so his > appearance is effectively an act of nature. This seems a rather artificial division. Especially because the immediate cause that led to this discussion is Nikos. As the situation is now I see very little reason to exclude Nikos from the group. He has made a substantial number of contribution and has received a substantial number of replies. So on what grounds would you put Nikos outside the volition of this group? > I am not "drawing the line for them", I am drawing it for > me. I think you see a non-existent conflict because you are > assume there is only one line. I do not make that assumption. > > If you think Nikos has crossed your line, then I acknowledge > your right not to help him. I even acknowledge your right > to flame him and encourage others to do so. > > My argument is that if you exercise your right (the flamage > part) the results on the newsgroup, when considered on a > best outcome for the most people basis, will be less good > than if you choose not to exercise your right. Possibly. But I don't consider utiltarism such a good measuring stick for these kind of situations. Too easy to neglect the concerns of individuals or small groups. > The costs are different in magnitude. Roughly: > > 1.People willing to read and possibly respond helpfully > to Nikos. > 2.People annoyed by Nikos who want him gone and don't want to > see anything by him or in his threads. > (and if people find you convincing) > 3.People annoyed by Nikos but willing to read his threads in > order to send antagonistic posts. > > If people ignore your call to spam Nikos with antagonistic > posts (and stop the considerable amount of such activity > already occurring) then the costs (difference compared to > a no-Nikos newsgroup) might be: > > Group 1: 0 > Group 2: 1 (killfile Nikos and kill or skip his new threads > when encountered.) > > If people continue to send both unhelpful and antagonistic > posts to Nikos: > > Group 1: 5 (can't killfile posters because they post in other > non-Nikos threads. Have to skip large volume of junk > posts based on visual peek at contents or recognition > of poster as a vigilante.) > Group 2: 1 (killfile Nikos and kill or skip his new threads > when encountered.) I don't accept this as the way costs should be compared? Why are you adding the costs of the flamers together? Each flamer is an individual who should only be responsible for his own contribution. As such it seems that the cost each flamer is inducing is comparable to the cost Nikos is inducing. > As for those annoyed by Nikos but who > > "can't easily filter the valuable contributions > > in [a Nikos] thread from the nth repeated answer to the same > > question" > how is that different from any non-Nikos thread other than that > your proposed action that makes it harder? It is different because Non-Nikos threads in general don't contain so many repeated questions as Nikos threads. > Of course. We all do that subconsciously every time we > read a newsgroup. But that is not what we are discussing > > We are discussing the effects of two different policies > of different interest groups on the newsgroup. You advocate > a policy of not responding helpfully and responding aggressively > to those exhibiting "undesirable" behavior where "undesirable" > is defined by you or some vague group consensus. > > I advocate a policy not responding aggressively at all and > responding helpfully or not at all based on a personal evaluation > of the "undesirable" behavior. > > So the question to answer is: how do those different policies > affect the cost/benefits of the different groups and which one > leads to the greatest good for the most? And I don't think that is the right question. It leads to people who are less annoyed by this kind of behaviour to ignore or brush of people who are more annoyed and attempts by the former to make the latter shoulder the full burden while not bearing any costs themselves and even behaving in such a way as to increase the annoyance of the latter group. > It's coercion because its *only* significant effect is to > raise the cost for me. That seems a non sequitur to me. >>> The alternative (for you to filter Nikos) does not restrict your >>> choice significantly -- indeed you are exercising your choice by >>> filtering out what you don't want to see. >> I don't appreciate it when you decide for others which alternatives >> are restricting their choice significantly and which do not. Others >> can have a very different appreciation of things than you have. > > Right. Which is why tolerance is so important. > > Tolerance involves not reacting to every irritation with > a hostile response likely to provoke more of the same. > It also implies not assuming what seems like trolling to > you is trolling to me. This hardly seems fair. We are not talking about some one who did a faux pas and was instantly flamed. We are talking about someone who ignored multiple attemps pointing out where his behaviour was unacceptable, who even seemed to think we should just accept his antisocial behaviour because his intention were good but showed no concern for the frustration he was causing. Even with those who were willing to help him. Trying to frame those that reacted to all this with flames, as people with low tolerance who react to every irritation with a hostile response doesn't look like an accurate description. >> What I propose is to stop encouraging his trollish behaviour. >> In point of fact Steve has already began doing so by demanding >> Nikos somehow shows he has done relevant work himself before >> wanting to help him further. Which I am perfectly fine with. > > No, What you were proposing was total boycott on any helpful > responses to Nikos and to continue and to increase the flood > of antagonistic posts to Nikos to drive him out. I have said something that can be interpretted as the first. But I made it clear because Nikos had allready receiced a ton of help like links of which he showed very little interest in actually reading. My boycot was meant for until he could show some results of him actively trying to solve his problems instead of us keeping to spoon feed him. > I too am fine with someone not responding to Nikos if unhappy > with his method of interaction, either in general or on a post-by > post basis. If fact, I think I've been saying that all along. But that is not enough for me. If someone is behaving in a trollish way, those continuing to help this person even after it has been shown he is insensitive to attempts to correct his behaviour, are becoming part of the problem. We are now talking of people in the community enabling trollish behaviour and so are contributing to the discomfort of a substantial part of the group. You can't ask restrain from this subgroup of people for the good of the whole group while at the same time showing no concerns for the discomfort of this subgroup you are contributing to. >> There is no need for those willing to help Nikos, to do so in a >> way that encourages his assholery behaviour. > > But you've said you believe *any* helpful response to Nikos > will "encourage his assholery behaviour". So there in no "need" > to provide any helpful response to Nikos. But then, I guess > that is a true statement for responding to anyone here, > depending on what "need" means. People could make it clear that they will only answer contributions of Nikos in which he doesn't behave like an asshole. In that case behaving like an asshole would not be encouraged and Nikos would still have a chance of having his questions answerd. As it was a number of people seemed too eager to help Nikos no matter how much he was behaving like an asshole. Like for the upteenth time changing his identity, thwarting all persons who killfiled him. From rurpy at yahoo.com Sun Jun 23 10:29:39 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Sun, 23 Jun 2013 07:29:39 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> Message-ID: On 06/21/2013 01:32 PM, Antoon Pardon wrote: > Op 19-06-13 23:13, rurpy at yahoo.com schreef: >> On 06/19/2013 04:57 AM, Antoon Pardon wrote: >>> Op 19-06-13 05:46, rurpy at yahoo.com schreef: >>> I don't remember making such a claim. What I do remember is >>> you among others claiming that the problem was not (so much) >>> the troll (Nikos) but the others. I only made the remark that >>> you can't claim the troll is not a problem if he provokes >>> behaviour you find problematic. >>> And your last conclusion is unsound. You forget to include the >>> fact that once a troll appeared, people reacting badly to the >>> troll is also to be expected. So with regards to this aspect >>> there is no difference between the troll and the responders, >>> both being expected and so no ground to put the preponderance >>> of blame on the responders. >> >> No, "blame" implies assumption of a particular point of >> view. From a troll's viewpoint, newsgroup participants that >> *don't* respond are to blame because they deprive the troll >> of his fun. >> >> Our viewpoint is that of newsgroup participants. We assume >> they have volition, else this whole thread is pointless. >> Since they have a choice of how to respond, then if they >> chose to respond in a way that produces an undesirable outcome, >> then it is fair "blame" them. >> >> The troll is outside the volition of the group and so his >> appearance is effectively an act of nature. > > This seems a rather artificial division. Especially because the > immediate cause that led to this discussion is Nikos. As the > situation is now I see very little reason to exclude Nikos > from the group. He has made a substantial number of contribution > and has received a substantial number of replies. So on what > grounds would you put Nikos outside the volition of this group? "made contributions"? I think you mean "asked questions". He has not (as far as I tell) been a participant here in the past, has not tried to help or participated in any other threads, seems to be interested only in getting his own problems solved, and not shown many signs of concern with any form of group consensus(es), not responded to requests. Isn't all that in large part the basis of your objection to him? "Outside the volition of this group" seems like a reasonable description to me. >> I am not "drawing the line for them", I am drawing it for >> me. I think you see a non-existent conflict because you are >> assume there is only one line. I do not make that assumption. >> >> If you think Nikos has crossed your line, then I acknowledge >> your right not to help him. I even acknowledge your right >> to flame him and encourage others to do so. >> >> My argument is that if you exercise your right (the flamage >> part) the results on the newsgroup, when considered on a >> best outcome for the most people basis, will be less good >> than if you choose not to exercise your right. > > Possibly. But I don't consider utiltarism such a good measuring > stick for these kind of situations. Too easy to neglect the > concerns of individuals or small groups. And your alternative that doesn't "neglect concerns of individuals or small groups" would be what? Something that neglects the concerns of the majority? I would love to see a proposed solution that satisfies the concerns of every individual and group here. And of course since you maintain above that trolls themselves are legitimate members of the newsgroup, it should also satisfy their desires as well. But sadly, in the real world there are conflicting desires so I don't think your alternative exists. >> The costs are different in magnitude. Roughly: >> >> 1.People willing to read and possibly respond helpfully >> to Nikos. >> 2.People annoyed by Nikos who want him gone and don't want to >> see anything by him or in his threads. >> (and if people find you convincing) >> 3.People annoyed by Nikos but willing to read his threads in >> order to send antagonistic posts. >> >> If people ignore your call to spam Nikos with antagonistic >> posts (and stop the considerable amount of such activity >> already occurring) then the costs (difference compared to >> a no-Nikos newsgroup) might be: >> >> Group 1: 0 >> Group 2: 1 (killfile Nikos and kill or skip his new threads >> when encountered.) >> >> If people continue to send both unhelpful and antagonistic >> posts to Nikos: >> >> Group 1: 5 (can't killfile posters because they post in other >> non-Nikos threads. Have to skip large volume of junk >> posts based on visual peek at contents or recognition >> of poster as a vigilante.) >> Group 2: 1 (killfile Nikos and kill or skip his new threads >> when encountered.) > > I don't accept this as the way costs should be compared? Why are > you adding the costs of the flamers together? Each flamer is > an individual who should only be responsible for his own > contribution. I haven't a clue what you mean by this. What does "responsible" have to do with it? They are "added" because each flame post imposes a cost to skip so the total cost is roughly the sum of the individual posts skipped. > As such it seems that the cost each flamer > is inducing is comparable to the cost Nikos is inducing. Each post by Nikos stimulates several flames so the aggregate cost of the flame posts is several times Nikos' posts. And if you've killfiled Nikos the cost of Nikos' posts are roughly zero. >> As for those annoyed by Nikos but who >> > "can't easily filter the valuable contributions >> > in [a Nikos] thread from the nth repeated answer to the same >> > question" >> how is that different from any non-Nikos thread other than that >> your proposed action that makes it harder? > > It is different because Non-Nikos threads in general don't contain > so many repeated questions as Nikos threads. But whatever that difference is, your proposed solution increases the cost since it raises the ratio of garbage posts to valuable posts. Whatever the ratio was before the intervention of your vigilantes, it will be higher after. >> Of course. We all do that subconsciously every time we >> read a newsgroup. But that is not what we are discussing >> >> We are discussing the effects of two different policies >> of different interest groups on the newsgroup. You advocate >> a policy of not responding helpfully and responding aggressively >> to those exhibiting "undesirable" behavior where "undesirable" >> is defined by you or some vague group consensus. >> >> I advocate a policy not responding aggressively at all and >> responding helpfully or not at all based on a personal evaluation >> of the "undesirable" behavior. >> >> So the question to answer is: how do those different policies >> affect the cost/benefits of the different groups and which one >> leads to the greatest good for the most? > > And I don't think that is the right question. It leads to people > who are less annoyed by this kind of behaviour to ignore or brush > of people who are more annoyed and attempts by the former to > make the latter shoulder the full burden while not bearing any > costs themselves and even behaving in such a way as to increase > the annoyance of the latter group. Addressed in more detail below. No "brushing off" involved, only an attempt at the most reasonable tradeoff for everybody (which means not agreeing to the vigilantes desire to engage in flame wars with people that annoy them.) >> It's coercion because its *only* significant effect is to >> raise the cost for me. > > That seems a non sequitur to me. Sorry, it was out of order. It was in response to: >>> And when the costs go up for others, you somehow thinks they should >>> deal with the unpleasant choice life has dealt them, but when >>> the costs goes up for you it suddenly is about coercion and forcibly >>> restricting free choice. which was snipped in your quote. I.e., responding to your assertion that my characterization of the effect of your "flame 'em to hell" policy as coercion was just a rhetorical trick. No, there is legitimate reason to call it coercion. >>>> The alternative (for you to filter Nikos) does not restrict your >>>> choice significantly -- indeed you are exercising your choice by >>>> filtering out what you don't want to see. >>> I don't appreciate it when you decide for others which alternatives >>> are restricting their choice significantly and which do not. Others >>> can have a very different appreciation of things than you have. >> >> Right. Which is why tolerance is so important. >> >> Tolerance involves not reacting to every irritation with >> a hostile response likely to provoke more of the same. >> It also implies not assuming what seems like trolling to >> you is trolling to me. > > This hardly seems fair. We are not talking about some one who > did a faux pas and was instantly flamed. We are talking about > someone who ignored multiple attemps pointing out where his > behaviour was unacceptable, who even seemed to think we should > just accept his antisocial behaviour because his intention > were good but showed no concern for the frustration he was > causing. Even with those who were willing to help him. > Trying to frame those that reacted to all this with flames, > as people with low tolerance who react to every irritation > with a hostile response doesn't look like an accurate description. >>> What I propose is to stop encouraging his trollish behaviour. >>> In point of fact Steve has already began doing so by demanding >>> Nikos somehow shows he has done relevant work himself before >>> wanting to help him further. Which I am perfectly fine with. >> >> No, What you were proposing was total boycott on any helpful >> responses to Nikos and to continue and to increase the flood >> of antagonistic posts to Nikos to drive him out. > > I have said something that can be interpretted as the first. > But I made it clear because Nikos had allready receiced a > ton of help like links of which he showed very little interest > in actually reading. My boycot was meant for until he could > show some results of him actively trying to solve his problems > instead of us keeping to spoon feed him. What you see as a "ton of help like links" I submit did not seem that way to Nikos. Consider the "help" in one thread: |> This is all you need to read: |> http://docs.python.org/2/reference/expressions.html#boolean-operations Ignoring that the link is to Python2 while Nikos was using Python3 (and clearly did understand enough about the differences to assume it was still relevant), the contents start with "In the context of Boolean operations..." when Nikos' confusion (IIRC) was due to not understanding even the concept of a "boolean context" and the distinction between True/False and true/false (which is not even documented there but rather in http://docs.python.org/2/library/stdtypes.html#truth-value-testing although not too clearly if you don't already get it.) As I pointed out previously the Python docs are not a good reference for people who don't understand the basic concepts or terminology. Same is true of Wikipedia which is great for citations to support claims or for looking up specific facts if you know what you want, but as a learning resource is awful. And when he replies explicitly that he found the links "too technical" that is interpreted as "refused to read". [*1] Even serious attempts to help are often not helpful since it is difficult for someone with a lot of experience to adopt the mindset a beginner, possibly one who does even understand basic programming concepts or things like how to isolate a problem. But when the recipient of the help still doesn't understand, they are told, "it has been explained to you multiple times, you must be trolling". Similarly when they fail to do something because they don't understand the point of doing it or because they resist being commanded to do it, or the reason was explained in a way that made no sense to them. As for other links like esr's Smart Questions, it has some good advise but it is also in some places a very elitist and abrasive document. Offering it as something to be read, fine. Insisting that someone acknowledge and adhere to every point therein -- I too might well respond hostily to such a demand. Besides the inappropriate technical level of much of the "help" is also the question of english ability. These days that can be an issue with many posters, both with their understanding of answers and in phrasing responses that don't meet the "respectfulness" standards demanded by some here. And there are personality issues like Aspergers and dyslexia and other traits. There are cultural differences with the nature and expectation of politeness being varied. So what is obvious "help" to you may not be so much so to the recipient and in the face of all these differences IMO tolerance is very helpful. Again I'm not claiming that my interpretation of Nikos' responses must be correct; I may be wrong and he may be reading this and laughing his ass off at my naivete, but I reject your certainty that your reading as pure troll is the only correct one. And even if I am wrong in this particular case, I think tolerance is helpful for maintaining a non- hostile environment in general. >> I too am fine with someone not responding to Nikos if unhappy >> with his method of interaction, either in general or on a post-by >> post basis. If fact, I think I've been saying that all along. > > But that is not enough for me. If someone is behaving in a trollish > way, those continuing to help this person even after it has been > shown he is insensitive to attempts to correct his behaviour, are > becoming part of the problem. We are now talking of people in the > community enabling trollish behaviour and so are contributing to > the discomfort of a substantial part of the group. > You can't ask restrain from this subgroup of people for the good of > the whole group while at the same time showing no concerns for the > discomfort of this subgroup you are contributing to. Which, were it true, applicable equally to you of course. But you are again misrepresenting things in claiming I have "no concern". Of course I do. That after thinking about various options and concluding that the one I favor will have overall the best results, and that yours won't, in no way means I have "no concern". >>> There is no need for those willing to help Nikos, to do so in a >>> way that encourages his assholery behaviour. >> >> But you've said you believe *any* helpful response to Nikos >> will "encourage his assholery behaviour". So there in no "need" >> to provide any helpful response to Nikos. But then, I guess >> that is a true statement for responding to anyone here, >> depending on what "need" means. > > People could make it clear that they will only answer contributions > of Nikos in which he doesn't behave like an asshole. You are not stating clearly what you mean. I am guessing that you want *everyone* here to not answer *any* questions until *all* behavior you and the vigilantes define as "asshole" behavior by the miscreant stops. And of course in the meantime you and the vigilantes will engage in a flame war against the miscreant. While you object to some people "enabling" trolls by trying to be helpful, you seem to see nothing wrong with you and fellow vigilantes enabling trolls by engaging in insult, ridicule and pseudo-help flame wars with them. And you seem to have no concern for the many people who will be discomforted by the large volume of negative and unpleasant posts your enabling produces [*2]. I get that you believe what you say, but the way to see it implemented is to convince me and others that you are right by making a good logical case for it, something I think you are failing at. The way not to do it is with intimidating responses to those who disagree with you, like, "you have been asked not to enable (by our definition) trolls, and if you persist, we will treat you as a troll." > In that case > behaving like an asshole would not be encouraged and Nikos would > still have a chance of having his questions answerd. As it was > a number of people seemed too eager to help Nikos no matter how > much he was behaving like an asshole. Like for the upteenth time > changing his identity, thwarting all persons who killfiled him. Looking at a few samples it looks to me like he has posted under only two identities: support at superhost.gr and nikos.gr33k at gmail.com. Many people here do the same (eg from work and home for example). I don't think you have grounds to complain about that. As for him changing his display name all the time, yes it is a problem for those of us using inferior tools like Google Groups that show only the name without email address. One could respond the same way I have often been responded to: use a decent tool. But I don't consider that a legitimate response so I agree with you and had intended to ask Nikos to stop changing the name the next occasion I had to interact with him. But one has a choice of how to do that. 1. "You keep changing your email account. Use one account and stop being an asshole, troll!" 2. "Stop changing your email name." 3. "There are people here want to be able to filter out your threads but it is hard to do because you often change your email name. Would you please just pick one or two names and use them consistently? Not only will that help reduce the number of people who make angry posts because they are pissed off but you are likely to get more helpful answers because the people reading your threads are people willing to look at your issues." (1) is wrong, unfair, aggressive and provocative and likely to result in more flamage in response and no change in behavior. (2) is aggressive. The poster has no authority to order Nikos or anyone else here to do something. (This kind of response is unfortunately common here and I wish the people doing it would stop.) (3) is IMO the most likely to be effective, particularly if combined with a serious attempt to provide a helpful answer. It may have to be repeated more than once. And it might well be ineffective if there are also a lot of (1) and (2) type responses. Of course if the behavior persists, particularly without any attempt to explain why, then one ups the "trollness" rating a few notches and when it exceeds one's threshold, stops trying to help. Soon, with neither help nor flamage to respond to there is no reason for the troll to remain. Problem solved but with less overall disruption and negativity (since you've been filtering his threads having made the troll determination earlier than me). ---- [*1] https://groups.google.com/d/msg/comp.lang.python/car7cJJjZdE/ib3p8-uHz9oJ [*2] There was an entire thread on the issue a short time ago: "Aggressive language on python-list", 2012-10-13 https://groups.google.com/d/topic/comp.lang.python/RfhmqYgBxu8/discussion From antoon.pardon at rece.vub.ac.be Mon Jun 24 09:37:33 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 24 Jun 2013 15:37:33 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> Message-ID: <51C84B9D.1050703@rece.vub.ac.be> Op 23-06-13 16:29, rurpy at yahoo.com schreef: > On 06/21/2013 01:32 PM, Antoon Pardon wrote: >> Op 19-06-13 23:13, rurpy at yahoo.com schreef: >>> The troll is outside the volition of the group and so his >>> appearance is effectively an act of nature. >> >> This seems a rather artificial division. Especially because the >> immediate cause that led to this discussion is Nikos. As the >> situation is now I see very little reason to exclude Nikos >> from the group. He has made a substantial number of contribution >> and has received a substantial number of replies. So on what >> grounds would you put Nikos outside the volition of this group? > > "made contributions"? I think you mean "asked questions". > He has not (as far as I tell) been a participant here in > the past, has not tried to help or participated in any other > threads, seems to be interested only in getting his own > problems solved, and not shown many signs of concern with > any form of group consensus(es), not responded to requests. > Isn't all that in large part the basis of your objection > to him? "Outside the volition of this group" seems like > a reasonable description to me. What do you mean with not a participant in the past? As far as I can see his first appearance was in dec 2011. That is over a year ago. It also seems that he always find people willing to engage with him. Is how the group treats him not also an aspect in deciding whether he belongs or not? But if you want to classify Nikos as somehow incorrigible and hope for better from others, I can understand that. I just have a harder time understanding why you seem to make it some kind of priority that people in the group should still be able to communicate with this person with only a minimum of hassle. >> Possibly. But I don't consider utiltarism such a good measuring >> stick for these kind of situations. Too easy to neglect the >> concerns of individuals or small groups. > > And your alternative that doesn't "neglect concerns of individuals > or small groups" would be what? Something that neglects the concerns > of the majority? I would love to see a proposed solution that > satisfies the concerns of every individual and group here. And > of course since you maintain above that trolls themselves are > legitimate members of the newsgroup, it should also satisfy their > desires as well. But sadly, in the real world there are conflicting > desires so I don't think your alternative exists. Are you trying to have a meaningful conversation or going for debating points? I didn't claim to have a solution that will satisfy everyone. But I do think there are better ways in handling this kind of situation other than one group of people by some kind of introspection coming to a conclusion of how best to deal with it, simply trying to argue others into compliance. Especially if this solution puts none of the burden on their own shoulders but all on others. >>> So the question to answer is: how do those different policies >>> affect the cost/benefits of the different groups and which one >>> leads to the greatest good for the most? >> >> And I don't think that is the right question. It leads to people >> who are less annoyed by this kind of behaviour to ignore or brush >> of people who are more annoyed and attempts by the former to >> make the latter shoulder the full burden while not bearing any >> costs themselves and even behaving in such a way as to increase >> the annoyance of the latter group. > > Addressed in more detail below. No "brushing off" involved, > only an attempt at the most reasonable tradeoff for everybody > (which means not agreeing to the vigilantes desire to engage > in flame wars with people that annoy them.) Yes, brushing off. Your attempt seems to consist solely on some kind of intropspection in which you came to some kind of conclusion and attempts to argue people into compliance. As far as I can see you didn't try to understand the view of others but just tried to convice them of the truth of your conclusion. That looks like brushing off to me. >> I have said something that can be interpretted as the first. >> But I made it clear because Nikos had allready receiced a >> ton of help like links of which he showed very little interest >> in actually reading. My boycot was meant for until he could >> show some results of him actively trying to solve his problems >> instead of us keeping to spoon feed him. > > What you see as a "ton of help like links" I submit did > not seem that way to Nikos. Consider the "help" in one > thread: > |> This is all you need to read: > |> http://docs.python.org/2/reference/expressions.html#boolean-operations > Ignoring that the link is to Python2 while Nikos was > using Python3 (and clearly did understand enough about the > differences to assume it was still relevant), the contents > start with "In the context of Boolean operations..." when > Nikos' confusion (IIRC) was due to not understanding even > the concept of a "boolean context" and the distinction > between True/False and true/false (which is not even > documented there but rather in > http://docs.python.org/2/library/stdtypes.html#truth-value-testing > although not too clearly if you don't already get it.) > > As I pointed out previously the Python docs are not a good > reference for people who don't understand the basic > concepts or terminology. Same is true of Wikipedia which > is great for citations to support claims or for looking up > specific facts if you know what you want, but as a learning > resource is awful. > > And when he replies explicitly that he found the links "too > technical" that is interpreted as "refused to read". [*1] > > Even serious attempts to help are often not helpful since > it is difficult for someone with a lot of experience to > adopt the mindset a beginner, possibly one who does even > understand basic programming concepts or things like how to > isolate a problem. But when the recipient of the help still > doesn't understand, they are told, "it has been explained to > you multiple times, you must be trolling". Similarly when > they fail to do something because they don't understand > the point of doing it or because they resist being commanded > to do it, or the reason was explained in a way that made > no sense to them. > > As for other links like esr's Smart Questions, it has some > good advise but it is also in some places a very elitist > and abrasive document. Offering it as something to be read, > fine. Insisting that someone acknowledge and adhere to > every point therein -- I too might well respond hostily > to such a demand. > > Besides the inappropriate technical level of much of > the "help" is also the question of english ability. > These days that can be an issue with many posters, both > with their understanding of answers and in phrasing > responses that don't meet the "respectfulness" standards > demanded by some here. And there are personality issues > like Aspergers and dyslexia and other traits. There are > cultural differences with the nature and expectation of > politeness being varied. > > So what is obvious "help" to you may not be so much so to > the recipient and in the face of all these differences > IMO tolerance is very helpful. > > Again I'm not claiming that my interpretation of Nikos' > responses must be correct; I may be wrong and he may be > reading this and laughing his ass off at my naivete, but > I reject your certainty that your reading as pure troll is > the only correct one. And even if I am wrong in this particular > case, I think tolerance is helpful for maintaining a non- > hostile environment in general. What certainty? I don't claim certainty in Nikos being a pure troll. I state that it doesn't matter to me. As I said earlier intend is not magic and even if Nikos would not be a troll but still behaves largely as one, especially after over one year of presence I wonder what meaningful difference there is between a real troll and someone who just behave very troll like? You raise a number of valid concerns. And maybe a number of people were jumping to conclusions but that is a risk people like Nikos will run when they continue to behave in a way that wears peoples patience thin. And somehow you seem to expect we should tolerate Nikos wearing peoples patience thin, but then you have little patience yourself for those people whose patience ran out. >>> I too am fine with someone not responding to Nikos if unhappy >>> with his method of interaction, either in general or on a post-by >>> post basis. If fact, I think I've been saying that all along. >> >> But that is not enough for me. If someone is behaving in a trollish >> way, those continuing to help this person even after it has been >> shown he is insensitive to attempts to correct his behaviour, are >> becoming part of the problem. We are now talking of people in the >> community enabling trollish behaviour and so are contributing to >> the discomfort of a substantial part of the group. >> You can't ask restrain from this subgroup of people for the good of >> the whole group while at the same time showing no concerns for the >> discomfort of this subgroup you are contributing to. > > Which, were it true, applicable equally to you of course. > > But you are again misrepresenting things in claiming I have > "no concern". Of course I do. That after thinking about > various options and concluding that the one I favor will > have overall the best results, and that yours won't, in no > way means I have "no concern". You should read more carefully. First of all, you can have many concerns and still have no concern for a specific group. The concerns you mentioned above, doesn't contradict you having no concerns for the flamers. Second having concerns and showing them are two different things. It may be possible that you have a lot of concerns for the flamers, that doesn't mean you actually showed them. So I'll stand by my statement that you show no concern for the discomfort of this group you are contributing to. As far as I can see your only concern is make them behave according to the solution, you arrived at without any contribution from themselves. >> >> People could make it clear that they will only answer contributions >> of Nikos in which he doesn't behave like an asshole. > > You are not stating clearly what you mean. I am guessing > that you want *everyone* here to not answer *any* questions > until *all* behavior you and the vigilantes define as > "asshole" behavior by the miscreant stops. I would already be content when the specific contributions in which he behaves like an asshole would be largely ignored or responded too in a way that made it clear he has to get his act together if he wished to be helped. > And of course in the meantime you and the vigilantes > will engage in a flame war against the miscreant. > > While you object to some people "enabling" trolls by trying > to be helpful, you seem to see nothing wrong with you and > fellow vigilantes enabling trolls by engaging in insult, > ridicule and pseudo-help flame wars with them. You see that wrong. I don't mind people enabling trolls that much. You can go right ahead. Just don't complain about others enabling trolls just because it annoys you. Or complain as much as you like, I'll just ignore you. I just think that if you would like others to stop certain kinds of behaviour you have to be willing to empathies with the reason of the behaviour, be willing to look at your role in causing this behaviour and show a willingness to help those others in behaving in a way you find more agreeable. I may have missed it, but I haven't seen you showing any kind of willingness in these regards. > And you seem > to have no concern for the many people who will be discomforted > by the large volume of negative and unpleasant posts your > enabling produces [*2]. I see no reason to show concern for those who show very little of it themselves. > I get that you believe what you say, but the way to see it > implemented is to convince me and others that you are right > by making a good logical case for it, something I think > you are failing at. I don't care that much for a good logical case in these kind of circumstances. Too many people having trouble looking at things from an other perspective, causing them to be overcomfident in their assumptions and thus resulting in them taking too much stock in their conclusions. > The way not to do it is with intimidating responses to those > who disagree with you, like, "you have been asked not to enable > (by our definition) trolls, and if you persist, we will treat > you as a troll." I don't think that just stating that some group of people are somehow to blame according to some conclusion that logically followed from assumptions you could choose, and that thus this other group has to adapt its behaviour while you can carry on as usual, is such a good way either. >> In that case >> behaving like an asshole would not be encouraged and Nikos would >> still have a chance of having his questions answerd. As it was >> a number of people seemed too eager to help Nikos no matter how >> much he was behaving like an asshole. Like for the upteenth time >> changing his identity, thwarting all persons who killfiled him. > > Looking at a few samples it looks to me like he has > posted under only two identities: support at superhost.gr and > nikos.gr33k at gmail.com. Many people here do the same (eg from > work and home for example). I don't think you have grounds > to complain about that. You have missed at least nikos.kouras at gmail.com and nagia.retsina at gmail.com. > As for him changing his display name all the time, yes it > is a problem for those of us using inferior tools like Google > Groups that show only the name without email address. One > could respond the same way I have often been responded to: > use a decent tool. > > But I don't consider that a legitimate response so I agree > with you and had intended to ask Nikos to stop changing the > name the next occasion I had to interact with him. I appreciate that. > But one has a choice of how to do that. > > 1. "You keep changing your email account. Use one account and > stop being an asshole, troll!" > > 2. "Stop changing your email name." > > 3. "There are people here want to be able to filter out your threads > but it is hard to do because you often change your email name. > Would you please just pick one or two names and use them > consistently? Not only will that help reduce the number of > people who make angry posts because they are pissed off but > you are likely to get more helpful answers because the people > reading your threads are people willing to look at your issues." > > (1) is wrong, unfair, aggressive and provocative and likely to > result in more flamage in response and no change in behavior. > > (2) is aggressive. The poster has no authority to order Nikos > or anyone else here to do something. (This kind of response is > unfortunately common here and I wish the people doing it would > stop.) > > (3) is IMO the most likely to be effective, particularly if > combined with a serious attempt to provide a helpful answer. > It may have to be repeated more than once. And it might > well be ineffective if there are also a lot of (1) and (2) > type responses. You sure seem awful careful with regards to someone you view as being outside the volition of the group while a the same time seeing nothing wrong with being very blunt about some subgroup of people you seem to consider inside the volition of the group, and whith which you have a particular problem. -- Antoon Pardon From ian.g.kelly at gmail.com Tue Jun 25 13:25:55 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Tue, 25 Jun 2013 11:25:55 -0600 Subject: Don't feed the troll... In-Reply-To: <51C84B9D.1050703@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51C84B9D.1050703@rece.vub.ac.be> Message-ID: On Mon, Jun 24, 2013 at 7:37 AM, Antoon Pardon wrote: > What do you mean with not a participant in the past? As far > as I can see his first appearance was in dec 2011. That is > over a year ago. It also seems that he always find people > willing to engage with him. Is how the group treats him > not also an aspect in deciding whether he belongs or not? Although it's true that he's been around for a while, it has in my mind only been very recently that his posts have started to become a problem. From antoon.pardon at rece.vub.ac.be Wed Jun 26 14:18:55 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Wed, 26 Jun 2013 20:18:55 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51C84B9D.1050703@rece.vub.ac.be> Message-ID: <51CB308F.30806@rece.vub.ac.be> Op 25-06-13 19:25, Ian Kelly schreef: > On Mon, Jun 24, 2013 at 7:37 AM, Antoon Pardon > wrote: >> What do you mean with not a participant in the past? As far >> as I can see his first appearance was in dec 2011. That is >> over a year ago. It also seems that he always find people >> willing to engage with him. Is how the group treats him >> not also an aspect in deciding whether he belongs or not? > > Although it's true that he's been around for a while, it has in my > mind only been very recently that his posts have started to become a > problem. Fine. All the more reason to regard him as part of the group rather than outside the group IMO. -- Antoon Pardon From rurpy at yahoo.com Tue Jun 25 11:56:59 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Tue, 25 Jun 2013 08:56:59 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> Message-ID: On 06/24/2013 07:37 AM, Antoon Pardon wrote: > Op 23-06-13 16:29, rurpy at yahoo.com schreef: >> On 06/21/2013 01:32 PM, Antoon Pardon wrote: >>> Op 19-06-13 23:13, rurpy at yahoo.com schreef: >[...] Note: although I clipped the "group volition" paragraphs, thank you for pointing out that Nikos posts go back to dec 2011. I was not aware of that. >>> Possibly. But I don't consider utiltarism such a good measuring >>> stick for these kind of situations. Too easy to neglect the >>> concerns of individuals or small groups. >> >> And your alternative that doesn't "neglect concerns of individuals >> or small groups" would be what? Something that neglects the concerns >> of the majority? I would love to see a proposed solution that >> satisfies the concerns of every individual and group here. And >> of course since you maintain above that trolls themselves are >> legitimate members of the newsgroup, it should also satisfy their >> desires as well. But sadly, in the real world there are conflicting >> desires so I don't think your alternative exists. > > Are you trying to have a meaningful conversation or going for debating > points? I didn't claim to have a solution that will satisfy everyone. > But I do think there are better ways in handling this kind of situation > other than one group of people by some kind of introspection coming to > a conclusion of how best to deal with it, simply trying to argue others > into compliance. Especially if this solution puts none of the burden on > their own shoulders but all on others. I put forward what I thought was a rational way of thinking about the problem that balances the competing desires. You reject it with, "too easy to neglect the concerns of individuals or small groups". I point out that I don't see any way of satisfying the concerns of "individuals or small groups" and the majority and you accuse me "going for debating points". If you don't wish to address the issue directly then, please do so indirectly by telling how your solution, to inundate the offender (and group in general) with a deluge of flames, somehow satisfies the "concerns of individuals or small groups" and of the majority. The only rational conclusion I can draw is that you either don't care about the majority or you think the majority of people here have no problem with masses of flamage and hostile and aggressive posts. >>>> So the question to answer is: how do those different policies >>>> affect the cost/benefits of the different groups and which one >>>> leads to the greatest good for the most? >>> >>> And I don't think that is the right question. It leads to people >>> who are less annoyed by this kind of behaviour to ignore or brush >>> of people who are more annoyed and attempts by the former to >>> make the latter shoulder the full burden while not bearing any >>> costs themselves and even behaving in such a way as to increase >>> the annoyance of the latter group. >> >> Addressed in more detail below. No "brushing off" involved, >> only an attempt at the most reasonable tradeoff for everybody >> (which means not agreeing to the vigilantes desire to engage >> in flame wars with people that annoy them.) > > Yes, brushing off. Your attempt seems to consist solely on > some kind of intropspection in which you came to some kind > of conclusion and attempts to argue people into compliance. > > As far as I can see you didn't try to understand the view > of others but just tried to convice them of the truth of > your conclusion. That looks like brushing off to me. This is a "no concern" argument. Many of your following points are effectively the same argument, so I will mark them all with the preceding sentence and address them all at the end. >[...snip ...] >> So what is obvious "help" to you may not be so much so to >> the recipient and in the face of all these differences >> IMO tolerance is very helpful. >> >> Again I'm not claiming that my interpretation of Nikos' >> responses must be correct; I may be wrong and he may be >> reading this and laughing his ass off at my naivete, but >> I reject your certainty that your reading as pure troll is >> the only correct one. And even if I am wrong in this particular >> case, I think tolerance is helpful for maintaining a non- >> hostile environment in general. > > What certainty? I don't claim certainty in Nikos being a pure > troll. I state that it doesn't matter to me. Yes, my mistake. > As I said earlier > intend is not magic and even if Nikos would not be a troll > but still behaves largely as one, especially after over one > year of presence I wonder what meaningful difference there is > between a real troll and someone who just behave very troll > like? Different kinds of trolls (with different motivations) one can guess will respond differently. A classic troll motivated almost exclusively by a desire to get attention and instigate discord will be energized by the hostile responses you propose. However someone like Nikos who is actually looking for help and some of who's "trolling" may be reaction to hostility received, might react positively to more genuine attempts to help and less hostility. And if not, the help will dry up, ending the problem without the flamage and disruption you propose. > You raise a number of valid concerns. And maybe a number > of people were jumping to conclusions but that is a risk > people like Nikos will run when they continue to behave in > a way that wears peoples patience thin. > > And somehow you seem to expect we should tolerate Nikos > wearing peoples patience thin, but then you have little > patience yourself for those people whose patience ran out. This is a "no concern" argument. Additionally... Again you are not only wrong, but making stuff up. I have not responded to anyone responding to trolls or other "asshole" posters with flames or demands they stop doing that. I have practiced what I've been preaching -- for the most part I patiently ignore them, exactly I am suggesting you do to people who annoy you, and only occasionally respond with what I hope is a helpful contribution to the discussion. [*1] >>>> I too am fine with someone not responding to Nikos if unhappy >>>> with his method of interaction, either in general or on a post-by >>>> post basis. If fact, I think I've been saying that all along. >>> >>> But that is not enough for me. If someone is behaving in a trollish >>> way, those continuing to help this person even after it has been >>> shown he is insensitive to attempts to correct his behaviour, are >>> becoming part of the problem. We are now talking of people in the >>> community enabling trollish behaviour and so are contributing to >>> the discomfort of a substantial part of the group. >>> You can't ask restrain from this subgroup of people for the good of >>> the whole group while at the same time showing no concerns for the >>> discomfort of this subgroup you are contributing to. >> >> Which, were it true, applicable equally to you of course. >> >> But you are again misrepresenting things in claiming I have >> "no concern". Of course I do. That after thinking about >> various options and concluding that the one I favor will >> have overall the best results, and that yours won't, in no >> way means I have "no concern". > > You should read more carefully. First of all, you can have many > concerns and still have no concern for a specific group. The > concerns you mentioned above, doesn't contradict you having > no concerns for the flamers. This (and following 2 paragraphs) is a "no concern" argument. Additionally... I can't tell if you are being deliberately disingenuous or you just wrote that too quickly. I used "concern" in the context of your statement, "showing no concerns for the discomfort of this subgroup [you and the flamers]", How could you possibly think me to mean some other kind of concern? To make it explicit, yes I was talking about the same concern you were. Sheesh, you wouldn't even get debating points for that. > Second having concerns and showing them are two different things. > It may be possible that you have a lot of concerns for the flamers, > that doesn't mean you actually showed them. If you need some sort of public "show", then I will publicly state that I too have been very frustrated with many of Nikos' posts and I am greatly sympathetic to the desire to tell the SOB to go take a flying fuck. That not withstanding I believe that responding that way does not help anything and is destructive. > So I'll stand by my statement that you show no concern for the > discomfort of this group you are contributing to. As far as I > can see your only concern is make them behave according to the > solution, you arrived at without any contribution from themselves. The operative part there is: as far as you can see. >>> People could make it clear that they will only answer contributions >>> of Nikos in which he doesn't behave like an asshole. >> >> You are not stating clearly what you mean. I am guessing >> that you want *everyone* here to not answer *any* questions >> until *all* behavior you and the vigilantes define as >> "asshole" behavior by the miscreant stops. > > I would already be content when the specific contributions > in which he behaves like an asshole would be largely ignored > or responded too in a way that made it clear he has to get > his act together if he wished to be helped. Then you seem to be moving closer to what I think is best. Unless of course by "made clear" you mean the kind of emotional hostile aggressive flamage that you originally seemed to be defending. >> And of course in the meantime you and the vigilantes >> will engage in a flame war against the miscreant. >> >> While you object to some people "enabling" trolls by trying >> to be helpful, you seem to see nothing wrong with you and >> fellow vigilantes enabling trolls by engaging in insult, >> ridicule and pseudo-help flame wars with them. > > You see that wrong. I don't mind people enabling trolls that > much. You can go right ahead. Just don't complain about others > enabling trolls just because it annoys you. Or complain as > much as you like, I'll just ignore you. I am not complaining -- I am (and have been) pointing out a predictable response of responding to trolls with flames and hostility, and pointing out that many people, not just here and now but across the internet and through 30 years of internet history, consider the result unpleasant. You are free to ignore that and do what you want. But remember to tell me again how *I* have no concern for others. > I just think > that if you would like others to stop certain kinds of behaviour > you have to be willing to empathies with the reason of the > behaviour, be willing to look at your role in causing this behaviour > and show a willingness to help those others in behaving in a > way you find more agreeable. > > I may have missed it, but I haven't seen you showing any kind > of willingness in these regards. This is a "no concern" argument. Additionally... 1. I showed empathy above. 2. I've looked at my role (I've attempted, unsuccessfully, to help Nikos a couple times) and determined although my action might have irritated a few people, probably not most, that showing that not everyone here was hostile might possibly result is a change for the better. A justifiable balance. 3. I've spent an unconscionable amount of time on these emails to try and build a reasonable case for tolerance and non-flaming as the best response for both discouraging trolls and no maintaining a non-hostile, negative atmosphere here. That is to "help those others in behaving" better. >> And you seem >> to have no concern for the many people who will be discomforted >> by the large volume of negative and unpleasant posts your >> enabling produces [*2]. > > I see no reason to show concern for those who show very little > of it themselves. This is a "no concern" argument. >> I get that you believe what you say, but the way to see it >> implemented is to convince me and others that you are right >> by making a good logical case for it, something I think >> you are failing at. > > I don't care that much for a good logical case in these kind > of circumstances. Too many people having trouble looking at > things from an other perspective, causing them to be overcomfident > in their assumptions and thus resulting in them taking too much > stock in their conclusions. If you reject logic and rationality as a basis for discussion, then I guess we a really are on different planets. >> The way not to do it is with intimidating responses to those >> who disagree with you, like, "you have been asked not to enable >> (by our definition) trolls, and if you persist, we will treat >> you as a troll." > > I don't think that just stating that some group of people > are somehow to blame according to some conclusion that logically > followed from assumptions you could choose, and that thus this > other group has to adapt its behaviour while you can carry on > as usual, is such a good way either. You persist in presenting the situation as though I am just making things up to justify a proposal that makes my own use of the group easier. You ignore the rational I gave and the experience of countless internet users over the history of the internet. >>> In that case >>> behaving like an asshole would not be encouraged and Nikos would >>> still have a chance of having his questions answerd. As it was >>> a number of people seemed too eager to help Nikos no matter how >>> much he was behaving like an asshole. Like for the upteenth time >>> changing his identity, thwarting all persons who killfiled him. >> >> Looking at a few samples it looks to me like he has >> posted under only two identities: support at superhost.gr and >> nikos.gr33k at gmail.com. Many people here do the same (eg from >> work and home for example). I don't think you have grounds >> to complain about that. > > You have missed at least nikos.kouras at gmail.com and nagia.retsina at gmail.com. I did miss them, thanks. >> As for him changing his display name all the time, yes it >> is a problem for those of us using inferior tools like Google >> Groups that show only the name without email address. >[...] >> (3) [a non-emotional, explanation of the problem with a polite request to change] >> is IMO the most likely to be effective, particularly if >> combined with a serious attempt to provide a helpful answer. >> It may have to be repeated more than once. And it might >> well be ineffective if there are also a lot of (1) and (2) >> type responses. > > You sure seem awful careful with regards to someone you view as being > outside the volition of the group while a the same time seeing nothing > wrong with being very blunt about some subgroup of people you seem to > consider inside the volition of the group, and whith which you have > a particular problem. Again this is an "no concern" argument. Additionally... It is wrong. I've not advocated "being very blunt" to those who aggravate the situation by responding to trolling with flames and more aggression. On the contrary I've advocated responding just as to a troll or other problem poster -- helpfully or not at all. Now...addressing all your "no concern" arguments... A disproportionate number of your arguments above are that I am not concerned about those (including you) who are deeply frustrated with Nikos' bad behavior. First, what my internal emotions (concern) are or are not is irrelevant -- what I have expressed in my opinion on how certain type of behavior will affect the climate of this newsgroup and the pleasure and usefulness various participant get from it. You can ascribe my motives to whatever you want including the influence of extra-terrestrials; it has nothing to do with the actual arguments I've made. Second, I *am* concerned in that I find a lot of Nikos's responses frustrating and I realize other people feel the same. But that does not mean that giving into emotion and filling this group up with all sort of negative hostile hate-mail is the right thing to do. Silence is a better option overall (IMO). There are three decades of internet experience that agree. >From the amount of rehashing and "as I said"s above I would say we are getting into, "yes it is", "no it isn't" territory. Unless you have something significantly new to add I don't think that continuing this is very productive. ---- [*1] I'm sure you can find something I've posted sometime that is not consistent with what I wrote. Nevertheless I think the majority of my posts (and non-posts) to trolls do. From antoon.pardon at rece.vub.ac.be Wed Jun 26 15:46:27 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Wed, 26 Jun 2013 21:46:27 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> Message-ID: <51CB4513.6060201@rece.vub.ac.be> Op 25-06-13 17:56, rurpy at yahoo.com schreef: > On 06/24/2013 07:37 AM, Antoon Pardon wrote: >> Op 23-06-13 16:29, rurpy at yahoo.com schreef: >>> On 06/21/2013 01:32 PM, Antoon Pardon wrote: >>>> Op 19-06-13 23:13, rurpy at yahoo.com schreef: >> [...] > I put forward what I thought was a rational way of thinking > about the problem that balances the competing desires. You > reject it with, "too easy to neglect the concerns of individuals > or small groups". I point out that I don't see any way of > satisfying the concerns of "individuals or small groups" and > the majority and you accuse me "going for debating points". But you didn't even go to the trouble of trying to find out what those concerns would be and how strong people feel about them. You just took your assumptions about those concerns for granted and proceeded from there. >> Second having concerns and showing them are two different things. >> It may be possible that you have a lot of concerns for the flamers, >> that doesn't mean you actually showed them. > > If you need some sort of public "show", then I will publicly > state that I too have been very frustrated with many of > Nikos' posts and I am greatly sympathetic to the desire to > tell the SOB to go take a flying fuck. That not withstanding > I believe that responding that way does not help anything > and is destructive. You really should learn the difference between telling and showing. >> So I'll stand by my statement that you show no concern for the >> discomfort of this group you are contributing to. As far as I >> can see your only concern is make them behave according to the >> solution, you arrived at without any contribution from themselves. > > The operative part there is: as far as you can see. There seem to be two options. Either there is nothing to see or I missed it, in which case this would have been a very good opportunity to point it out. > You are free to ignore that and do what you want. > But remember to tell me again how *I* have no concern for > others. This is not a competion in trying to make the other look less concerned than the other. I don't care whether or not you have concerns for others. I'm just pointing out that if you would like to influence the behaviour of others in a direction you'd prefer, then you'd better show concerns about what drives them to that behaviour. >> I don't think that just stating that some group of people >> are somehow to blame according to some conclusion that logically >> followed from assumptions you could choose, and that thus this >> other group has to adapt its behaviour while you can carry on >> as usual, is such a good way either. > > You persist in presenting the situation as though I am just > making things up to justify a proposal that makes my own > use of the group easier. You ignore the rational I gave and > the experience of countless internet users over the history > of the internet. Why should I care about the rational you gave. It is based on your own assumptions, on how you weight the possible outcomes against each other. Someone who doesn't care about trolls or even may enjoy observing a heated exchange may come to an entirely different conclusion on what behaviour is good for the group in case he extrapolated his own preferences on the group. And you may not have purposely made things up to justify your proposal, but how you went about it, that is probably what you actually did. Because that is what we as humans generally do in this kind of situations. >> You sure seem awful careful with regards to someone you view as being >> outside the volition of the group while a the same time seeing nothing >> wrong with being very blunt about some subgroup of people you seem to >> consider inside the volition of the group, and whith which you have >> a particular problem. > > Again this is an "no concern" argument. > Additionally... > It is wrong. > > I've not advocated "being very blunt" to those who aggravate > the situation by responding to trolling with flames and more > aggression. I didn't mean you advocated it. I mean that you actually have been blunt about these people. These are you words: ] The primary problem is a (relatively small) number of people ] who respond to every post by Nikos with a barrage of insults, ] demands, (what they think are) witty repartee, hints intended ] to "make" Nikos learn something, useless (to Nikos) links, ] new threads to discuss the "Nikos problem", and other trash ] that is far more obnoxious that anything Nikos posts and just ] serves to egg him on. Now as far as I am concerned you can be as blunt as you want to be. I just don't understand why you think you should be so careful to Nikos, while at the same time you saw no need for careful wording here. > A disproportionate number of your arguments above are that I am > not concerned about those (including you) who are deeply frustrated > with Nikos' bad behavior. No, I point out that your behaviour doesn't *show* any such concern. > First, what my internal emotions (concern) are or are not is > irrelevant -- what I have expressed in my opinion on how certain > type of behavior will affect the climate of this newsgroup and > the pleasure and usefulness various participant get from it. > You can ascribe my motives to whatever you want including the > influence of extra-terrestrials; it has nothing to do with the > actual arguments I've made. Your argument is next to useless. You rarely make people change behaviour by showing your argument is correct. If your goal is influencing people into behaving more as you would like, focussing on your argument instead of empathising on their frustration is more likely to antagonise the people whose behaviour you would like to change than to get them to cooperate. > Second, I *am* concerned in that I find a lot of Nikos's responses > frustrating and I realize other people feel the same. Stop telling you are concerned. Start showing. > But that > does not mean that giving into emotion and filling this group > up with all sort of negative hostile hate-mail is the right thing > to do. Silence is a better option overall (IMO). There are three > decades of internet experience that agree. Do you have mumbers on that? Otherwise those three decades of internet don't mean much. -- Antoon Pardon From ian.g.kelly at gmail.com Wed Jun 26 17:02:40 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Wed, 26 Jun 2013 15:02:40 -0600 Subject: Don't feed the troll... In-Reply-To: <51CB4513.6060201@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> Message-ID: On Wed, Jun 26, 2013 at 1:46 PM, Antoon Pardon wrote: > But you didn't even go to the trouble of trying to find out > what those concerns would be and how strong people feel about > them. You just took your assumptions about those concerns for > granted and proceeded from there. Jumping back in here, I for one don't give a hoot about their concerns, beyond the basic assumption that they feel the same way I do about Nikos' threads and wish that he would leave. I just want to maintain a positive and welcoming atmosphere around here. I expect that most of the posters here are adults and can fend for themselves regarding their own concerns, and I'm not interested in being the list mom. You on the other hand seem to want to treat the list like a playground. If that's what you want to do, then by all means go for it; just leave me out of it. >> If you need some sort of public "show", then I will publicly >> state that I too have been very frustrated with many of >> Nikos' posts and I am greatly sympathetic to the desire to >> tell the SOB to go take a flying fuck. That not withstanding >> I believe that responding that way does not help anything >> and is destructive. > > > You really should learn the difference between telling and showing. Copy... > Why should I care about the rational you gave. It is based on > your own assumptions, on how you weight the possible outcomes against > each other. Someone who doesn't care about trolls or even may > enjoy observing a heated exchange may come to an entirely different > conclusion on what behaviour is good for the group in case he > extrapolated his own preferences on the group. > > And you may not have purposely made things up to justify your > proposal, but how you went about it, that is probably what you > actually did. Because that is what we as humans generally do > in this kind of situations. "Made things up"? This response to the situation is not just our own assumptions at work, but the collective experience of the Internet, going back decades. http://rationalwiki.org/wiki/Don%27t_feed_the_Troll > Now as far as I am concerned you can be as blunt as you want to > be. I just don't understand why you think you should be so > careful to Nikos, while at the same time you saw no need for > careful wording here. Nobody is suggesting that we should make any effort to try to avoid hurting Nikos' feelings, contrary to what you seem to be implying here. Be as blunt as you want with him, but please recognize that troll baiting /does not work/ as a means of making the troll go away and only serves to further degrade the list. Nor do I think that it is a bad thing to be blunt about it with those who are dampening the environment. As I said above, the posters here are mostly adults, most of whom I think are not so emotionally fragile that they would wilt because of a simple reprimand on the Internet (or if they really /can't/ take it, then perhaps they should have thought about that before they started dishing it). > Your argument is next to useless. You rarely make people change behaviour by > showing your argument is correct. If your goal is influencing people into > behaving more as you would like, focussing > on your argument instead of empathising on their frustration is > more likely to antagonise the people whose behaviour you would > like to change than to get them to cooperate. ...paste. "You really should learn the difference between telling and showing." >> Second, I *am* concerned in that I find a lot of Nikos's responses >> frustrating and I realize other people feel the same. > > Stop telling you are concerned. Start showing. How? By joining in with the flaming and being just as counter-productive? I'm not going to try to "show" my concern because it is not important to me whether others can see it. >> But that >> does not mean that giving into emotion and filling this group >> up with all sort of negative hostile hate-mail is the right thing >> to do. Silence is a better option overall (IMO). There are three >> decades of internet experience that agree. > > Do you have mumbers on that? Otherwise those three decades of internet > don't mean much. The only actual study on the topic that I'm aware of is this one: http://www.guardian.co.uk/education/2011/jun/13/internet-trolls-improbable-research From antoon.pardon at rece.vub.ac.be Thu Jun 27 14:13:13 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Thu, 27 Jun 2013 20:13:13 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> Message-ID: <51CC80B9.5090501@rece.vub.ac.be> Op 26-06-13 23:02, Ian Kelly schreef: > On Wed, Jun 26, 2013 at 1:46 PM, Antoon Pardon > wrote: >> But you didn't even go to the trouble of trying to find out >> what those concerns would be and how strong people feel about >> them. You just took your assumptions about those concerns for >> granted and proceeded from there. > > Jumping back in here, I for one don't give a hoot about their > concerns, beyond the basic assumption that they feel the same way I do > about Nikos' threads and wish that he would leave. I just want to > maintain a positive and welcoming atmosphere around here. So what do you think would be a good approach towards people who are behaving in conflict with this wish of yours? Just bluntly call them worse than the troll or try to approach them in a way that is less likely to antangonize them? > I expect > that most of the posters here are adults and can fend for themselves > regarding their own concerns, and I'm not interested in being the list > mom. It is not about being the list's mom. It's about approaching people, whom you would like to influence in changing their behaviour, in a way that is more likely to gain you their good will towards you. If what you want is indeed a positive and welcoming atmosphere, I would say such an approach would be more effective in getting it. >> Why should I care about the rational you gave. It is based on >> your own assumptions, on how you weight the possible outcomes against >> each other. Someone who doesn't care about trolls or even may >> enjoy observing a heated exchange may come to an entirely different >> conclusion on what behaviour is good for the group in case he >> extrapolated his own preferences on the group. >> >> And you may not have purposely made things up to justify your >> proposal, but how you went about it, that is probably what you >> actually did. Because that is what we as humans generally do >> in this kind of situations. > > "Made things up"? This response to the situation is not just our own > assumptions at work, but the collective experience of the Internet, > going back decades. The collective experience of theachers is that punishment for bad performance works, despite research showing otherwise. Besides I was talking about rurpy's basic assumptions about what the costs would be for various subgroups in different scenario's. These were all based on his own interpretations. What he did was trying to imagine how costly it would feel for him, should he have be in a particular situation with a particular preference. As far as I can see he didn't ask other people what their preference was and how costly particular situations would feel to them. So yes he made those up. Now I accept he was trying to get at an honest estimation of factors involved, but human biases working as they do, there is little reason to think his result is in any way objective or useful. >> Now as far as I am concerned you can be as blunt as you want to >> be. I just don't understand why you think you should be so >> careful to Nikos, while at the same time you saw no need for >> careful wording here. > > Nobody is suggesting that we should make any effort to try to avoid > hurting Nikos' feelings, contrary to what you seem to be implying > here. I am implying nothing. I'm just pointing out the difference between how rurpy explains we should behave towards Nikos and how he behaved towards the flamers. If there is some sort of implication it is with rurpy in that difference and not with me in me pointing it out. > Be as blunt as you want with him, but please recognize that > troll baiting /does not work/ as a means of making the troll go away > and only serves to further degrade the list. It's not clear to me what you are precisely saying here. Do you think being blunt is a form of troll baiting or not? Because my impression of those who are bothered by the flamers, was that being blunt was just a form of troll baiting and would just cause similar kind of list degradation. Do you think being blunt is a good way in keeping a welcoming and postive atmosphere in this group? >>> Second, I *am* concerned in that I find a lot of Nikos's responses >>> frustrating and I realize other people feel the same. >> >> Stop telling you are concerned. Start showing. > > How? By joining in with the flaming and being just as > counter-productive? I am not so sure it would be counter-productive. A joint flaming of a troll can be an effective way to increase coherence in a group. > I'm not going to try to "show" my concern because > it is not important to me whether others can see it. I doubt that is a good way in keeping this group positive and welcoming. But it is your choice. >> Do you have mumbers on that? Otherwise those three decades of internet >> don't mean much. > > The only actual study on the topic that I'm aware of is this one: > > http://www.guardian.co.uk/education/2011/jun/13/internet-trolls-improbable-research Thanks for this. Unfortunatly there is not much to rely on. The only thing I can get from this, is that there can be more ways than one to handle trolls. -- Antoon Pardon From ian.g.kelly at gmail.com Fri Jun 28 13:20:03 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Fri, 28 Jun 2013 11:20:03 -0600 Subject: Don't feed the troll... In-Reply-To: <51CC80B9.5090501@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> <51CC80B9.5090501@rece.vub.ac.be> Message-ID: On Thu, Jun 27, 2013 at 12:13 PM, Antoon Pardon wrote: > So what do you think would be a good approach towards people > who are behaving in conflict with this wish of yours? Just > bluntly call them worse than the troll or try to approach them > in a way that is less likely to antangonize them? Inform them that their behavior is damaging the list atmosphere, and ask them to please knock it off. Shaming the behavior works too, but I'd prefer to go with the former. > The collective experience of theachers is that punishment for bad > performance works, despite research showing otherwise. Flaming a troll is not punishing to them. >>> Now as far as I am concerned you can be as blunt as you want to >>> be. I just don't understand why you think you should be so >>> careful to Nikos, while at the same time you saw no need for >>> careful wording here. >> >> >> Nobody is suggesting that we should make any effort to try to avoid >> hurting Nikos' feelings, contrary to what you seem to be implying >> here. > > > I am implying nothing. I'm just pointing out the difference between > how rurpy explains we should behave towards Nikos and how he behaved > towards the flamers. If there is some sort of implication it is with > rurpy in that difference and not with me in me pointing it out. Your statement "I just don't understand why you think you should be so careful to Nikos" implies that somebody thinks we should be careful to Nikos, i.e. be careful to not hurt his feelings. At least that is how I read it, and I don't think it is true. >> Be as blunt as you want with him, but please recognize that >> troll baiting /does not work/ as a means of making the troll go away >> and only serves to further degrade the list. > > It's not clear to me what you are precisely saying here. Do you think > being blunt is a form of troll baiting or not? Because my impression > of those who are bothered by the flamers, was that being blunt was just > a form of troll baiting and would just cause similar kind of list > degradation. No. Flaming carries an emotional response, which signals to the troll that they've struck a nerve and can help incite them. A blunt, non-emotional response is less likely to end up functioning as positive reinforcement in that way. That said, the best response to a troll is still no response at all. > Do you think being blunt is a good way in keeping a welcoming and > postive atmosphere in this group? I think it's better than being openly hostile. And speaking for myself, if somebody has a problem with my own behavior then I would prefer that they be blunt about it than cover it up with a false friendliness. > I am not so sure it would be counter-productive. A joint flaming > of a troll can be an effective way to increase coherence in a > group. Well, if flaming ever becomes the prevailing culture of the list, then I'm out. From antoon.pardon at rece.vub.ac.be Sun Jun 30 13:25:42 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Sun, 30 Jun 2013 19:25:42 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> <51CC80B9.5090501@rece.vub.ac.be> Message-ID: <51D06A16.5060803@rece.vub.ac.be> Op 28-06-13 19:20, Ian Kelly schreef: > On Thu, Jun 27, 2013 at 12:13 PM, Antoon Pardon > wrote: >> So what do you think would be a good approach towards people >> who are behaving in conflict with this wish of yours? Just >> bluntly call them worse than the troll or try to approach them >> in a way that is less likely to antangonize them? > > Inform them that their behavior is damaging the list atmosphere, and > ask them to please knock it off. Shaming the behavior works too, but > I'd prefer to go with the former. That is a bit odd. Rurpy seemed to consider it a big nono if others used methods that would coerce him to change his behaviour. But here you see shaming as an option which seems a coercive method. So if some group views the response to trollish behaviour as too willing in cooperating with bad behaviour and as such damaging to the list, this group can then inform the cooperators that their behaviour is damaging the list atmosphere and ask to please knock it off. And they can consider more coercive methods too? >> The collective experience of theachers is that punishment for bad >> performance works, despite research showing otherwise. > > Flaming a troll is not punishing to them. I see I didn't make my point clear. This was my response to your remark about the collective experience going back decades. The collective experience often enough doesn't carry over wisdom but myth. To illustrate that, I gave the example of teachers whose collective experience is contradicted by the research. So if the only thing you can rely on is the collective experience of the group your knowledge isn't very relyable. I also find it somewhat odd that you talk about a troll here. AFAIU the people who are most annoyed by those flaming/protesting Nikos, don't seem to consider Nikos a troll. But if Nikos is not a troll then protesting Nikos's behaviour can't be protested against on the ground that it would be troll feeding. >> I am implying nothing. I'm just pointing out the difference between >> how rurpy explains we should behave towards Nikos and how he behaved >> towards the flamers. If there is some sort of implication it is with >> rurpy in that difference and not with me in me pointing it out. > > Your statement "I just don't understand why you think you should be so > careful to Nikos" implies that somebody thinks we should be careful to > Nikos, i.e. be careful to not hurt his feelings. At least that is how > I read it, and I don't think it is true. What Rurpy's motivation would be for being careful to Nikos, you have to ask him. I'm only pointing out that in contrast to the blunt statement he made about those flaming/protesting Nikos, how he explained we should behave towards Nikos can accurately be described as careful. ... >> Do you think being blunt is a good way in keeping a welcoming and >> postive atmosphere in this group? > > I think it's better than being openly hostile. And speaking for > myself, if somebody has a problem with my own behavior then I would > prefer that they be blunt about it than cover it up with a false > friendliness. Sure, but there is a difference between telling people you have a problem with their behaviour and telling people their behaviour is wrong or damaging. Yet when you have trouble with particular behaviour you go for the latter instead for the former. >> I am not so sure it would be counter-productive. A joint flaming >> of a troll can be an effective way to increase coherence in a >> group. > > Well, if flaming ever becomes the prevailing culture of the list, then I'm out. Sure, I can understand that. But doesn't this contradict somewhat that this is about others damaging this group. Increasing coherence would IMO be positive for a group, but you would still not like it. So it seems more about keeping an atmosphere that you prefer. There is nothing qrong with that, but if you can keep that in mind, your approach is more likely to be fruitful. -- Antoon Pardon. From ian.g.kelly at gmail.com Sun Jun 30 13:50:16 2013 From: ian.g.kelly at gmail.com (Ian Kelly) Date: Sun, 30 Jun 2013 11:50:16 -0600 Subject: Don't feed the troll... In-Reply-To: <51D06A16.5060803@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> <51CC80B9.5090501@rece.vub.ac.be> <51D06A16.5060803@rece.vub.ac.be> Message-ID: On Sun, Jun 30, 2013 at 11:25 AM, Antoon Pardon wrote: >>> So what do you think would be a good approach towards people >>> who are behaving in conflict with this wish of yours? Just >>> bluntly call them worse than the troll or try to approach them >>> in a way that is less likely to antangonize them? >> >> >> Inform them that their behavior is damaging the list atmosphere, and >> ask them to please knock it off. Shaming the behavior works too, but >> I'd prefer to go with the former. > > > That is a bit odd. Rurpy seemed to consider it a big nono if others > used methods that would coerce him to change his behaviour. But here > you see shaming as an option which seems a coercive method. Well, if it didn't work the first time, I wouldn't keep at it. I don't consider that coercive. From antoon.pardon at rece.vub.ac.be Sun Jun 30 13:56:31 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Sun, 30 Jun 2013 19:56:31 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <96ed14e3-79dd-40c2-8063-aa58a42c7b57@googlegroups.com> <744948f6-85dd-4de3-a886-8282ca903816@googlegroups.com> <3207a22f-846a-41a8-8165-79c25e3c4285@googlegroups.com> <51CB4513.6060201@rece.vub.ac.be> <51CC80B9.5090501@rece.vub.ac.be> <51D06A16.5060803@rece.vub.ac.be> Message-ID: <51D0714F.3030006@rece.vub.ac.be> Op 30-06-13 19:50, Ian Kelly schreef: > On Sun, Jun 30, 2013 at 11:25 AM, Antoon Pardon >> >> That is a bit odd. Rurpy seemed to consider it a big nono if others >> used methods that would coerce him to change his behaviour. But here >> you see shaming as an option which seems a coercive method. > > Well, if it didn't work the first time, I wouldn't keep at it. I > don't consider that coercive. That is a fair point. -- Antoon Pardon From antoon.pardon at rece.vub.ac.be Mon Jun 17 03:31:53 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 09:31:53 +0200 Subject: Don't feed the troll... In-Reply-To: <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BEBB69.40604@rece.vub.ac.be> Op 16-06-13 22:04, Steven D'Aprano schreef: > On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: > >> You are trying to get it both ways. On the one hand you try to argue >> that there are no boundaries > I have never, ever argued that there are no boundaries. I have repeatedly > made it clear to Nikos when I thought he was behaving improperly. And > I've done the same to others when they've acted improperly. That doesn't mean much. People can and do contradict themselves. So the fact that you made it clear to Nikos that he behaved improperly doesn't contradict you arguing somewhere else in a way that strongly suggest there are no boudaries. But I'll take note that you assert there are boundaries. So I'll take it that there is nothing wrong with playing Internet Police and taking people to task who transgress this boundaries? One thing I would like to make clear, is that I find you making it clear he behaviour is improper, to be inadequate for the reason that it ignores the possibility that you are playing a troll game. To make an analogy. Suppose someone want to play a game of troll-chess with you. The rules of troll-chess are the following. You are allowed any kind of piece movement or you can utter the statement: TIC (That is cheating). So in troll-chess you are allowed to move your bisshops like a queen. The only thing is, that if you do a move that is illegal in ordinary chess and your opponent answers with TIC, you must take back that move and make a move that is legal ordinary chess. So you make think you are making it clear to your troll-chess opponent that he is cheating for your troll-chess opponet you are just participating in his game. Now it is possible that your opponent is not in fact playing troll chess but just doesn't know enough of the game to know what is a legal move and what is not. In my opinion that doesn't matter. If your opponent doesn't want to invest the time needed to at least have a reasonable idea of what moves are legal and so in practice is hardly distinguishable from those who's intent it is to play troll chess, the end result is the same. >> to what is acceptable by calling people who >> do try to enforce such boundaries the Internet Police. On the other hand >> you do suggest that playing Internet Police is out of bound behaviour. > Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It > is unproductive, it makes this a hostile, unpleasant place to be, it > ruins the environment for the rest of the community, it's off topic, and > it simply doesn't work to discourage trolls. > I'm sorry but again I find that you are trying to have it both ways. IMO, and I suspect I'm not alone in that judgement, the threads that Nikos starts are in general, boring, repetitive, unproductive and draining. Not only that they are having an effect on the mailing list as a whole making it an unpleasant place. To the people who come with that complain, your respons, seems to be that if those people would just ignore the nikos-threads. They don't have to experience this unpleasantnes. But now that you start to experience unpleasantness, this unproductiveness and unpleasantness is cause for you to label behaviour unacceptable. But the same remedy is available here. Just ignore threads with behaviour that you find unacceptable and you (and others) don't have to experience this hostility and unpleasantness. Those you accuse of ruining the environment, find this environment already partly ruined by nikos and those that enable him. -- Antoon Pardon From steve+comp.lang.python at pearwood.info Mon Jun 17 19:02:36 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 17 Jun 2013 23:02:36 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51bf958b$0$29872$c3e8da3$5496439d@news.astraweb.com> On Mon, 17 Jun 2013 09:31:53 +0200, Antoon Pardon wrote: > Op 16-06-13 22:04, Steven D'Aprano schreef: >> On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: >> >>> You are trying to get it both ways. On the one hand you try to argue >>> that there are no boundaries >> I have never, ever argued that there are no boundaries. I have >> repeatedly made it clear to Nikos when I thought he was behaving >> improperly. And I've done the same to others when they've acted >> improperly. > > That doesn't mean much. People can and do contradict themselves. So the > fact that you made it clear to Nikos that he behaved improperly doesn't > contradict you arguing somewhere else in a way that strongly suggest > there are no boudaries. Except that I have never, ever argued or suggested or even hinted that there are no boundaries. The most you might legitimately accuse me of is failing to be sufficiently vigilant at enforcing boundaries, according to *your* idea of what is sufficient. > But I'll take note that you assert there are boundaries. So I'll take it > that there is nothing wrong with playing Internet Police and taking > people to task who transgress this boundaries? There is an enormous difference between doing what I, and others, have done, which is to *politely* and *fairly* tell Nikos when he has transgressed, and what the flame-warriors have done, which is just fire off invective and insults. Not long ago I got taken to task, politely, off-list for responding to Ranting Rick with sarcasm. Sometimes the momentary pleasure of a flame outweighs the knowledge that it probably isn't doing any good and may be doing harm. I get that and don't hold it against anyone if they succumb to temptation once in a while. (Those like Peter Otten, who have been regulars here for *years* while still showing the patience of a saint, never fail to astonish me. If I could be even half as good.) But continuing to flame after being asked not to, and defending flamers, that crosses the line from "spirit is willing, flesh is weak" into *willfully bad* territory. Contrast Chris Angelico's recent email telling Nikos that he *actually should feel bad* about not reading the documentation. That is reasonable. It's not just a stream of insults. It doesn't just try to bully him into going away or shutting up in order to avoid being shouted at. If Nikos fails to learn from it, that is Nikos' failure, not Chris'. > One thing I would like to make clear, is that I find you making it clear > he behaviour is improper, to be inadequate for the reason that it > ignores the possibility that you are playing a troll game. Oh my, that's funny. But seriously, don't do that. I won't put up with that sort of thing. You rarely contribute in this community, and now here you are trying to take the moral high ground by defending flaming and criticising those who give actual helpful, on-topic advice. I won't be called a troll by you. Do it again, and you're plonked. -- Steven From antoon.pardon at rece.vub.ac.be Tue Jun 18 05:02:15 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Tue, 18 Jun 2013 11:02:15 +0200 Subject: Don't feed the troll... In-Reply-To: <51bf958b$0$29872$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <51bcc094$0$29997$c3e8da3$5496439d@news.astraweb.com> <51be1a42$0$29966$c3e8da3$5496439d@news.astraweb.com> <51bf958b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51C02217.1080405@rece.vub.ac.be> Op 18-06-13 01:02, Steven D'Aprano schreef: > On Mon, 17 Jun 2013 09:31:53 +0200, Antoon Pardon wrote: > >> Op 16-06-13 22:04, Steven D'Aprano schreef: >>> On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: >>> >>>> You are trying to get it both ways. On the one hand you try to argue >>>> that there are no boundaries >>> I have never, ever argued that there are no boundaries. I have >>> repeatedly made it clear to Nikos when I thought he was behaving >>> improperly. And I've done the same to others when they've acted >>> improperly. >> That doesn't mean much. People can and do contradict themselves. So the >> fact that you made it clear to Nikos that he behaved improperly doesn't >> contradict you arguing somewhere else in a way that strongly suggest >> there are no boudaries. > Except that I have never, ever argued or suggested or even hinted that > there are no boundaries. The most you might legitimately accuse me of is > failing to be sufficiently vigilant at enforcing boundaries, according to > *your* idea of what is sufficient. > > >> But I'll take note that you assert there are boundaries. So I'll take it >> that there is nothing wrong with playing Internet Police and taking >> people to task who transgress this boundaries? > There is an enormous difference between doing what I, and others, have > done, which is to *politely* and *fairly* tell Nikos when he has > transgressed, and what the flame-warriors have done, which is just fire > off invective and insults. I disagree. You have been polite to the person who is ruining it for a lot of other people. What good is it to politely and fairly tell someone he is transgressing, when he will just continue in the same way. At some point you keeping to be polite and answering his questions, becomes enabling behaviour. Your politely and fairly pointing out his transgressions just becomes a way in cooperating with his annoying behaviour. You keeping it polite and fair doens't mean much. It isn't that difficult to act as an asshole while presenting oneself as being polite and fair. And no I don't want to imply you are an asshole. I just want to make it clear I don't put much weight is being polite and fair. > Not long ago I got taken to task, politely, off-list for responding to > Ranting Rick with sarcasm. Sometimes the momentary pleasure of a flame > outweighs the knowledge that it probably isn't doing any good and may be > doing harm. I get that and don't hold it against anyone if they succumb > to temptation once in a while. (Those like Peter Otten, who have been > regulars here for *years* while still showing the patience of a saint, > never fail to astonish me. If I could be even half as good.) > > But continuing to flame after being asked not to, and defending flamers, > that crosses the line from "spirit is willing, flesh is weak" into > *willfully bad* territory. You were asked not to continue encouraging Nikos's assholery behaviour. So it seems you are in that *willfully bad* territory yourself. And no, politely and fairly telling Nikos he is transgressing doesn't cut it. If he keeps acting like an asshole and you keep helping him you are encouraging his assholery behaviour no matter how many times you politely and fairly point out his transgressions. >> One thing I would like to make clear, is that I find you making it clear >> he behaviour is improper, to be inadequate for the reason that it >> ignores the possibility that you are playing a troll game. > Oh my, that's funny. > > But seriously, don't do that. I won't put up with that sort of thing. You > rarely contribute in this community, and now here you are trying to take > the moral high ground by defending flaming and criticising those who give > actual helpful, on-topic advice. I won't be called a troll by you. Do it > again, and you're plonked. > I didn't call you a troll. I just wanted you to consider you might be participating in what is essentially a troll game. And that what you see as pointing out a transgression, is just a kind of move in the game of the troll. -- Antoon Pardon From rurpy at yahoo.com Sat Jun 15 15:54:26 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Sat, 15 Jun 2013 12:54:26 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> Message-ID: <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> On 06/15/2013 12:18 PM, rusi wrote: > On Jun 15, 10:52 pm, Steven D'Aprano +comp.lang.pyt... at pearwood.info> wrote: >> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: >> > With you as our spamming-guru, Onward! Sky is the limit! >> >> If you're going to continue making unproductive, off-topic, inflammatory >> posts that prolong these already excessively large threads, Nikos won't >> be the only one kill-filed. > > At least two people -- Alex and Antoon -- have told you that by > supporting Nikos, when everyone else wants him off list, you are part > of the problem. Nikos is only secondarily the problem, Steven not at all. The primary problem is a (relatively small) number of people who respond to every post by Nikos with a barrage of insults, demands, (what they think are) witty repartee, hints intended to "make" Nikos learn something, useless (to Nikos) links, new threads to discuss the "Nikos problem", and other trash that is far more obnoxious that anything Nikos posts and just serves to egg him on. Steven's advice on how to deal with Nikos was probably the most sensible thing I've seen posted here on the subject. I suggest that if you can and want to answer Nikos' question, do so directly and with a serious attempt address what it is he seems not to get, or killfile him and shut the fuck up. >[...] > Everyone is exasperated and talking of kill-filing him. Don't be silly. You don't know what "everyone" (the vast majority of whom read and don't post) here think. From support at superhost.gr Sat Jun 15 16:04:31 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 23:04:31 +0300 Subject: Don't feed the troll... In-Reply-To: <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: On 15/6/2013 10:54 ??, rurpy at yahoo.com wrote: > On 06/15/2013 12:18 PM, rusi wrote: >> On Jun 15, 10:52 pm, Steven D'Aprano > +comp.lang.pyt... at pearwood.info> wrote: >>> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: >>>> With you as our spamming-guru, Onward! Sky is the limit! >>> >>> If you're going to continue making unproductive, off-topic, inflammatory >>> posts that prolong these already excessively large threads, Nikos won't >>> be the only one kill-filed. >> >> At least two people -- Alex and Antoon -- have told you that by >> supporting Nikos, when everyone else wants him off list, you are part >> of the problem. > > Nikos is only secondarily the problem, Steven not at all. > > The primary problem is a (relatively small) number of people > who respond to every post by Nikos with a barrage of insults, > demands, (what they think are) witty repartee, hints intended > to "make" Nikos learn something, useless (to Nikos) links, > new threads to discuss the "Nikos problem", and other trash > that is far more obnoxious that anything Nikos posts and just > serves to egg him on. > > Steven's advice on how to deal with Nikos was probably the > most sensible thing I've seen posted here on the subject. > > I suggest that if you can and want to answer Nikos' question, > do so directly and with a serious attempt address what it is > he seems not to get, > or > killfile him and shut the fuck up. > >> [...] >> Everyone is exasperated and talking of kill-filing him. > > Don't be silly. You don't know what "everyone" (the vast > majority of whom read and don't post) here think. > Thank you ruspy. -- What is now proved was at first only imagined! From support at superhost.gr Sat Jun 15 16:04:31 2013 From: support at superhost.gr (Nick the Gr33k) Date: Sat, 15 Jun 2013 23:04:31 +0300 Subject: Don't feed the troll... In-Reply-To: <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: On 15/6/2013 10:54 ??, rurpy at yahoo.com wrote: > On 06/15/2013 12:18 PM, rusi wrote: >> On Jun 15, 10:52 pm, Steven D'Aprano > +comp.lang.pyt... at pearwood.info> wrote: >>> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: >>>> With you as our spamming-guru, Onward! Sky is the limit! >>> >>> If you're going to continue making unproductive, off-topic, inflammatory >>> posts that prolong these already excessively large threads, Nikos won't >>> be the only one kill-filed. >> >> At least two people -- Alex and Antoon -- have told you that by >> supporting Nikos, when everyone else wants him off list, you are part >> of the problem. > > Nikos is only secondarily the problem, Steven not at all. > > The primary problem is a (relatively small) number of people > who respond to every post by Nikos with a barrage of insults, > demands, (what they think are) witty repartee, hints intended > to "make" Nikos learn something, useless (to Nikos) links, > new threads to discuss the "Nikos problem", and other trash > that is far more obnoxious that anything Nikos posts and just > serves to egg him on. > > Steven's advice on how to deal with Nikos was probably the > most sensible thing I've seen posted here on the subject. > > I suggest that if you can and want to answer Nikos' question, > do so directly and with a serious attempt address what it is > he seems not to get, > or > killfile him and shut the fuck up. > >> [...] >> Everyone is exasperated and talking of kill-filing him. > > Don't be silly. You don't know what "everyone" (the vast > majority of whom read and don't post) here think. > Thank you ruspy. -- What is now proved was at first only imagined! From rurpy at yahoo.com Sat Jun 15 16:12:20 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Sat, 15 Jun 2013 13:12:20 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: <51e2ad65-df3f-4951-a520-341a1c125803@googlegroups.com> On Saturday, June 15, 2013 2:04:31 PM UTC-6, ???????? ?????? wrote: > Thank you ruspy. Don't thank me. You are not contributing in a positive way to the situation. From antoon.pardon at rece.vub.ac.be Sun Jun 16 14:39:56 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Sun, 16 Jun 2013 20:39:56 +0200 Subject: Don't feed the troll... In-Reply-To: <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: <51BE067C.5050900@rece.vub.ac.be> Op 15-06-13 21:54, rurpy at yahoo.com schreef: > On 06/15/2013 12:18 PM, rusi wrote: >> On Jun 15, 10:52 pm, Steven D'Aprano> +comp.lang.pyt... at pearwood.info> wrote: >>> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: >>>> With you as our spamming-guru, Onward! Sky is the limit! >>> >>> If you're going to continue making unproductive, off-topic, inflammatory >>> posts that prolong these already excessively large threads, Nikos won't >>> be the only one kill-filed. >> >> At least two people -- Alex and Antoon -- have told you that by >> supporting Nikos, when everyone else wants him off list, you are part >> of the problem. > > Nikos is only secondarily the problem, Steven not at all. > > The primary problem is a (relatively small) number of people > who respond to every post by Nikos with a barrage of insults, > demands, (what they think are) witty repartee, hints intended > to "make" Nikos learn something, useless (to Nikos) links, > new threads to discuss the "Nikos problem", and other trash > that is far more obnoxious that anything Nikos posts and just > serves to egg him on. Sorry but this is IMO a false equivallence. It ignores the important distinction between action and reaction. Does this number of people post a barrage of insult to no matter who? And you may find those responses more obnoxious they propbably are the reactions of people who are utterly fed up and think that if nobody is concerned about their annoyance they don't have to b econcerned about the annoyance of others either. > Steven's advice on how to deal with Nikos was probably the > most sensible thing I've seen posted here on the subject. Most sensible for what purpose? As far as I can see Steven's advice will just prolong the cycle of Nikos continuing to ask for spoonfeeding, showing very litle signs of understanding and keeping to hop from one problem/bug to the next until the mailing list has finished his project at which point he will probably start something new. If nikos's project was a college project we would have told him he has to make his homework himself. But now he is earning money with it, you seem to find it acceptable his job is done for him. > I suggest that if you can and want to answer Nikos' question, > do so directly and with a serious attempt address what it is > he seems not to get, > or > killfile him and shut the fuck up. I suggest that if you want this to continue being a hospitable place, you don't encourage asocial behaviour. His behaviour may not bother you so much, but that shouldn't be the norm because others are less bothered with the barrage of insults Nikos is now receiving than with Nikos vampirizing this list, because they consider those insults deserved. -- Antoon Pardon From joel.goldstick at gmail.com Mon Jun 17 11:53:57 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Mon, 17 Jun 2013 11:53:57 -0400 Subject: Don't feed the troll... In-Reply-To: <51BE067C.5050900@rece.vub.ac.be> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <51BE067C.5050900@rece.vub.ac.be> Message-ID: On Sun, Jun 16, 2013 at 2:39 PM, Antoon Pardon wrote: > Op 15-06-13 21:54, rurpy at yahoo.com schreef: > > On 06/15/2013 12:18 PM, rusi wrote: >> >>> On Jun 15, 10:52 pm, Steven D'Aprano>> +comp.lang.pyt... at pearwood.**info > >>> wrote: >>> >>>> On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: >>>> >>>>> With you as our spamming-guru, Onward! Sky is the limit! >>>>> >>>> >>>> If you're going to continue making unproductive, off-topic, inflammatory >>>> posts that prolong these already excessively large threads, Nikos won't >>>> be the only one kill-filed. >>>> >>> >>> At least two people -- Alex and Antoon -- have told you that by >>> supporting Nikos, when everyone else wants him off list, you are part >>> of the problem. >>> >> >> Nikos is only secondarily the problem, Steven not at all. >> >> The primary problem is a (relatively small) number of people >> who respond to every post by Nikos with a barrage of insults, >> demands, (what they think are) witty repartee, hints intended >> to "make" Nikos learn something, useless (to Nikos) links, >> new threads to discuss the "Nikos problem", and other trash >> that is far more obnoxious that anything Nikos posts and just >> serves to egg him on. >> > > Sorry but this is IMO a false equivallence. It ignores the > important distinction between action and reaction. Does > this number of people post a barrage of insult to no matter > who? And you may find those responses more obnoxious they > propbably are the reactions of people who are utterly fed > up and think that if nobody is concerned about their annoyance > they don't have to b econcerned about the annoyance of others > either. > > > Steven's advice on how to deal with Nikos was probably the >> most sensible thing I've seen posted here on the subject. >> > > Most sensible for what purpose? As far as I can see Steven's > advice will just prolong the cycle of Nikos continuing to ask > for spoonfeeding, showing very litle signs of understanding > and keeping to hop from one problem/bug to the next until > the mailing list has finished his project at which point > he will probably start something new. > > If nikos's project was a college project we would have told > him he has to make his homework himself. But now he is earning > money with it, you seem to find it acceptable his job is done > for him. > > > I suggest that if you can and want to answer Nikos' question, >> do so directly and with a serious attempt address what it is >> he seems not to get, >> or >> killfile him and shut the fuck up. >> > > I suggest that if you want this to continue being a hospitable > place, you don't encourage asocial behaviour. His behaviour > may not bother you so much, but that shouldn't be the norm > because others are less bothered with the barrage of insults > Nikos is now receiving than with Nikos vampirizing this list, > because they consider those insults deserved. > > > -- > Antoon Pardon > -- > http://mail.python.org/**mailman/listinfo/python-list > I'm with Antoon on this. If you look at this group, it almost completely revolves around the guy from Greece with 3 or 4 or 5 different email addresses. His area of interest is repetitive: 1. Get me out of the Unicode hell that is my own making 2. Do my linux sys admin for me 3. I can't be bothered with understanding what more there is to making software other than cutting and pasting code that other people are willing to write for me 4. Go back to [1] and start again. If you need to understand unicode and or hex notation, or binary notation (and most likely you will if you write code for a living), then go learn about those things. If you are unwilling to do that, then go away. If you think its best to help this person, and be kind to him, and encourage him to become a better citizen, please remember that being inviting to a person who ruins the party for everyone is not being respectful of everyone else. All the while monopolizing many threads >From my perspective there seems to be some interesting people here with a wide array of experience and knowledge, whose understand and opinions I find fun and useful to read. All of that is drowned out by the freight train from superhost.gr -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Mon Jun 17 01:52:53 2013 From: rustompmody at gmail.com (rusi) Date: Sun, 16 Jun 2013 22:52:53 -0700 (PDT) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: <09706955-0705-4b67-b1ae-096625eb14b5@rh15g2000pbb.googlegroups.com> On Jun 16, 12:54?am, ru... at yahoo.com wrote: > > ... killfile him and shut the fuck up. Ok. Advice taken. Thanks. From support at superhost.gr Mon Jun 17 12:03:19 2013 From: support at superhost.gr (Simpleton) Date: Mon, 17 Jun 2013 19:03:19 +0300 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: On 16/6/2013 9:39 ??, Antoon Pardon wrote: > If nikos's project was a college project we would have told > him he has to make his homework himself. This is where you all mistaken. You see, my website could be done ina CMS like (Joomla or Drupal) or even in DreamWeaver. I choosed Python because i like Python. Mny of my friends and clients told me hey man your website is very simple, how not Joomla-lize it with cool animation effects and stuff? Well, i could, but i dont want to because: 1. i want to learn Python 2. i want to have full control of my webisite, knowing each and every lien does, since i'm writing it. > But now he is earning > money with it, you seem to find it acceptable his job is done > for him. No. I first try and inevitably i fail. Than i ask, and ask not only to be shown to the correct way of handling the code, but i want to be informed of how you thought of implementing the situation at hand. This way i learn from your experience and iam getting better and better every day as we speak, which in turn make me fond of Python increasingly. -- What is now proved was at first only imagined! From invalid at invalid.invalid Mon Jun 17 12:14:17 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Mon, 17 Jun 2013 16:14:17 +0000 (UTC) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: On 2013-06-17, Simpleton wrote: > On 16/6/2013 9:39 ????, Antoon Pardon wrote: >> If nikos's project was a college project we would have told >> him he has to make his homework himself. > > This is where you all mistaken. > > You see, my website could be done ina CMS like (Joomla or Drupal) or > even in DreamWeaver. > > I choosed Python because i like Python. > Mny of my friends and clients told me hey man your website is very > simple, how not Joomla-lize it with cool animation effects and stuff? > > Well, i could, but i dont want to because: > > 1. i want to learn Python > 2. i want to have full control of my webisite, knowing each and every > line does, since i'm writing it. > > > But now he is earning > > money with it, you seem to find it acceptable his job is done > > for him. > > No. I first try and inevitably i fail. But failing _isn't_ inevitible. If you take the time to actually learn Python by reading the references people provide, by studying small examples, and by experimenting with Python code, there's no reason why you should fail. -- Grant Edwards grant.b.edwards Yow! MY income is ALL at disposable! gmail.com From support at superhost.gr Mon Jun 17 12:19:14 2013 From: support at superhost.gr (Simpleton) Date: Mon, 17 Jun 2013 19:19:14 +0300 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: On 17/6/2013 7:14 ??, Grant Edwards wrote: > But failing _isn't_ inevitible. If you take the time to actually > learn Python by reading the references people provide, by studying > small examples, and by experimenting with Python code, there's no > reason why you should fail. I'am and i feel better expressing my questions to a live human being that read help file after help file to find some answer to a problem i have to deal with. Of course i spent you guys reply-time but many others(even experts) benefit from all this experience, not only me. Also what i have learned here the last month would have taken me way longer if i was researching for my self from doc=>doc reference until i was able to understand something. I like things to be put up simple and i'am not trolling this group. I respect this group. -- What is now proved was at first only imagined! From wuwei23 at gmail.com Tue Jun 18 00:39:19 2013 From: wuwei23 at gmail.com (alex23) Date: Mon, 17 Jun 2013 21:39:19 -0700 (PDT) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> Message-ID: <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> On Jun 18, 2:19?am, Simpleton wrote: > I like things to be put up simple and i'am not trolling this group. > I respect this group. There are a number of things you could to do confirm this: 1. Stop changing your name. 2. Stop bumping your threads if no one responds. 3. Stop exaggerating the "benefit" your threads have for others. 4. Stop posting code chunks and saying "What now?" Show what you've tried to debug the problem. 5. Stop ignoring requests to modify your behaviour while simultaneously demanding that others here do. 6. Read the links people provide you and then ask further questions using the content of those links as a basis. tl;dr Stop acting like a troll and we'll stop perceiving you as such. From rosuav at gmail.com Tue Jun 18 03:21:46 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 18 Jun 2013 17:21:46 +1000 Subject: Don't feed the troll... In-Reply-To: <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> Message-ID: On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: > tl;dr Stop acting like a troll and we'll stop perceiving you as such. This being Python-list, we duck-type. You don't have to declare that you're a troll, like you would in C; you just react like a troll and we'll treat you as one. We never ask "are you a troll", we just ask "do you quack like a troll". ChrisA From invalid at invalid.invalid Tue Jun 18 09:38:40 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Tue, 18 Jun 2013 13:38:40 +0000 (UTC) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> Message-ID: On 2013-06-18, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: >> tl;dr Stop acting like a troll and we'll stop perceiving you as such. > > This being Python-list, we duck-type. You don't have to declare that > you're a troll, like you would in C; you just react like a troll and > we'll treat you as one. We never ask "are you a troll", we just ask > "do you quack like a troll". Indeed. The "is he a troll" question is a discussion about internals. And like many Python users, some of us do like to discuss questions about internals (though we hopefully know enough not to depend on the answers being the same tomorrow). -- Grant Edwards grant.b.edwards Yow! What I want to find at out is -- do parrots know gmail.com much about Astro-Turf? From invalid at invalid.invalid Tue Jun 18 23:57:26 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Wed, 19 Jun 2013 03:57:26 +0000 (UTC) Subject: Don't feed the troll... References: <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> Message-ID: On 2013-06-18, Dennis Lee Bieber wrote: > On Tue, 18 Jun 2013 13:38:40 +0000 (UTC), Grant Edwards >>On 2013-06-18, Chris Angelico wrote: >>> On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: >>>> tl;dr Stop acting like a troll and we'll stop perceiving you as such. >>> >>> This being Python-list, we duck-type. You don't have to declare that >>> you're a troll, like you would in C; you just react like a troll and >>> we'll treat you as one. We never ask "are you a troll", we just ask >>> "do you quack like a troll". >> >>Indeed. The "is he a troll" question is a discussion about internals. >>And like many Python users, some of us do like to discuss questions >>about internals (though we hopefully know enough not to depend on the >>answers being the same tomorrow). > > And suddenly I have visions of a Druidical reading of the entrails... Well, that might explain how some of the code I've seen recently in this newsgroup was written. -- Grant From rurpy at yahoo.com Tue Jun 18 23:49:19 2013 From: rurpy at yahoo.com (rurpy at yahoo.com) Date: Tue, 18 Jun 2013 20:49:19 -0700 (PDT) Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> Message-ID: <661962dd-a89f-427d-8954-e795a0207678@googlegroups.com> On 06/18/2013 01:21 AM, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: >> tl;dr Stop acting like a troll and we'll stop perceiving you as such. > > This being Python-list, we duck-type. You don't have to declare that > you're a troll, like you would in C; you just react like a troll and > we'll treat you as one. We never ask "are you a troll", we just ask > "do you quack like a troll". People are much more complex than Python objects. While duck-typing is a useful heuristic it does not guarantee accurate results. And keep in mind that stereotyping and racial profiling are forms of duck typing. You need to be careful when duck-typing people. From rosuav at gmail.com Wed Jun 19 03:07:28 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 19 Jun 2013 17:07:28 +1000 Subject: Don't feed the troll... In-Reply-To: <661962dd-a89f-427d-8954-e795a0207678@googlegroups.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> <661962dd-a89f-427d-8954-e795a0207678@googlegroups.com> Message-ID: On Wed, Jun 19, 2013 at 1:49 PM, wrote: > On 06/18/2013 01:21 AM, Chris Angelico wrote: >> On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: >>> tl;dr Stop acting like a troll and we'll stop perceiving you as such. >> >> This being Python-list, we duck-type. You don't have to declare that >> you're a troll, like you would in C; you just react like a troll and >> we'll treat you as one. We never ask "are you a troll", we just ask >> "do you quack like a troll". > > People are much more complex than Python objects. While > duck-typing is a useful heuristic it does not guarantee > accurate results. And keep in mind that stereotyping and > racial profiling are forms of duck typing. You need to > be careful when duck-typing people. On the contrary, stereotyping is "You are-a , therefore you will behave in ". This is the opposite: "You behave like a troll, therefore you are equivalent to a troll". Imagine if we treated all those with green skin who live under bridges as trolls, no matter how good their contributions... ChrisA From steve+comp.lang.python at pearwood.info Wed Jun 19 03:27:16 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 19 Jun 2013 07:27:16 GMT Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> <661962dd-a89f-427d-8954-e795a0207678@googlegroups.com> Message-ID: <51c15d54$0$29973$c3e8da3$5496439d@news.astraweb.com> On Wed, 19 Jun 2013 17:07:28 +1000, Chris Angelico wrote: > On the contrary, stereotyping is "You are-a , therefore you > will behave in ". I don't think that's how stereotypes usually work. "He wears a turban, therefore he's an Arab terrorist." "He's wearing black, has pale skin, listens to that weird goth music I don't like, therefore he's a school-shooter." "She's good looking and wears short skirts, therefore she's a slut." "He's wearing a police uniform, therefore he's a policeman." -- Steven From rosuav at gmail.com Wed Jun 19 03:33:31 2013 From: rosuav at gmail.com (Chris Angelico) Date: Wed, 19 Jun 2013 17:33:31 +1000 Subject: Don't feed the troll... In-Reply-To: <51c15d54$0$29973$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <6dc5124d-3b00-4d53-a555-b7f31765abd7@ow4g2000pbc.googlegroups.com> <51bca9eb$0$29997$c3e8da3$5496439d@news.astraweb.com> <35734e52-2396-4ec2-938f-d5b0f592adf5@4g2000pbf.googlegroups.com> <74df2815-b197-44ea-a3bb-ad27ea81862a@googlegroups.com> <3fd3be2f-a4fc-4212-ac10-e5f50567a297@ow4g2000pbc.googlegroups.com> <661962dd-a89f-427d-8954-e795a0207678@googlegroups.com> <51c15d54$0$29973$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Wed, Jun 19, 2013 at 5:27 PM, Steven D'Aprano wrote: > On Wed, 19 Jun 2013 17:07:28 +1000, Chris Angelico wrote: > >> On the contrary, stereotyping is "You are-a , therefore you >> will behave in ". > > I don't think that's how stereotypes usually work. > > "He wears a turban, therefore he's an Arab terrorist." Right, my terminology was a little sloppy but I was thinking more in terms of one of the most common forms of stereotyping: racism. "You have skin of this colour, therefore you are inferior or a criminal or whatever". The is something visible, and the expectation/assumption is utterly unrelated to it. ChrisA From torriem at gmail.com Sat Jun 15 13:49:41 2013 From: torriem at gmail.com (Michael Torrie) Date: Sat, 15 Jun 2013 11:49:41 -0600 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BCA935.2030106@gmail.com> On 06/15/2013 11:30 AM, Nick the Gr33k wrote: > You are spamming my thread. No he's not. The subject is changed on this branch of the thread, so it's easy to see in any good e-mail reader that this sub-thread or branch is diverting. This is proper list etiquette. From breamoreboy at yahoo.co.uk Sat Jun 15 13:45:52 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Sat, 15 Jun 2013 18:45:52 +0100 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 15/06/2013 18:30, Nick the Gr33k wrote: > On 15/6/2013 7:41 ??, Chris ?Kwpolska? Warrick wrote: >> On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano >> wrote: >>> On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: >>> >>>> I suggested including the poster that you are replying to. >>> >>> In the name of all that's good and decent in the world, why on earth >>> would you do that when replying to a mailing list??? They're already >>> getting a reply. Sending them TWO identical replies is just rude. >> >> Mailman is intelligent enough not to send a second copy in that case. >> This message was sent with a CC, and you got only one copy. >> >> -- >> Kwpolska | GPG KEY: 5EAAEA16 >> stop html mail | always bottom-post >> http://asciiribbon.org | http://caliburn.nl/topposting.html >> > You are spamming my thread. > Funniest thing I've read in years, try taking up writing comedy instead of anything involving computing. -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From andipersti at gmail.com Sat Jun 15 13:58:21 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Sat, 15 Jun 2013 19:58:21 +0200 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130615195821.6fd89eec@Hof> Nick the Gr33k wrote: >You are spamming my thread. Well, you don't own this thread. In fact nobody owns it. This is a public forum and thus anybody can answer to any post as he likes. Bye, Andreas From invalid at invalid.invalid Mon Jun 17 10:39:56 2013 From: invalid at invalid.invalid (Grant Edwards) Date: Mon, 17 Jun 2013 14:39:56 +0000 (UTC) Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 2013-06-15, Chris ???Kwpolska??? Warrick wrote: > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano > wrote: >> On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: >> >>> I suggested including the poster that you are replying to. >> >> In the name of all that's good and decent in the world, why on earth >> would you do that when replying to a mailing list??? They're already >> getting a reply. Sending them TWO identical replies is just rude. > > Mailman is intelligent enough not to send a second copy in that case. > This message was sent with a CC, and you got only one copy. I don't want _any_ copies from from Mailman. I don't subscribe to whatever mailing list you're talking about. I'm reading this via an NNTP server. Keep replies in the group or on the list. -- Grant Edwards grant.b.edwards Yow! I just remembered at something about a TOAD! gmail.com From darcy at druid.net Mon Jun 17 12:35:48 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Mon, 17 Jun 2013 12:35:48 -0400 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130617123548.47281099@imp> On Mon, 17 Jun 2013 14:39:56 +0000 (UTC) Grant Edwards wrote: > I don't want _any_ copies from from Mailman. I don't subscribe to > whatever mailing list you're talking about. I'm reading this via an > NNTP server. Keep replies in the group or on the list. And that is part of the problem. I have always argued that gatewaying the mailing list to newgroups is wrong. If this was only a mailing list there are many things we could do to reduce abuse but because of the gateway they can't be done. Not that it matters to me any more. I have finally decided that this list is just more noise to signal than I care to deal with. If anyone has any comments for me you will have to Cc me as I am outa here. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From oscar.j.benjamin at gmail.com Mon Jun 17 13:42:47 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Mon, 17 Jun 2013 18:42:47 +0100 Subject: Don't feed the troll... In-Reply-To: <20130617123548.47281099@imp> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130617123548.47281099@imp> Message-ID: On 17 June 2013 17:35, D'Arcy J.M. Cain wrote: > On Mon, 17 Jun 2013 14:39:56 +0000 (UTC) > Grant Edwards wrote: >> I don't want _any_ copies from from Mailman. I don't subscribe to >> whatever mailing list you're talking about. I'm reading this via an >> NNTP server. Keep replies in the group or on the list. > > And that is part of the problem. I have always argued that gatewaying > the mailing list to newgroups is wrong. If this was only a mailing > list there are many things we could do to reduce abuse but because of > the gateway they can't be done. There is a very simple solution used by many mailing lists which is to set the Reply-To header to point back to the mailing list. That way any old email client on any OS/computer/phone/website etc. has the required button to reply to the list without CCing anyone. It also reduces the chance of accidentally replying off-list. Anyone who wants to reply off-list or to deliberately CC someone (as I did here) can still do so but it will rarely happen accidentally. Oscar From ben+python at benfinney.id.au Tue Jun 18 08:21:58 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Tue, 18 Jun 2013 22:21:58 +1000 Subject: Don't feed the troll... References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130617123548.47281099@imp> Message-ID: <7whagv1ue1.fsf@benfinney.id.au> Oscar Benjamin writes: > There is a very simple solution used by many mailing lists Yes, that solution is described in RFC 2369: the ?List-Post? field in the header of every message sent through the mailing list. > which is to set the Reply-To header to point back to the mailing list. That is not a solution, since the ?Reply-To? field already has a different purpose contrary to your intent. It is to be set by the person sending the message, if they choose. It is not for some intermediary to interfere with. It is a field for the sender to direct *individual* responses back to themselves ? and, if they don't set that field, no intermediary should abuse it. > That way any old email client on any OS/computer/phone/website etc. > has the required button to reply to the list without CCing anyone. By breaking the standard ?reply to author? behaviour. This is not a solution. The ?List-Post? field has been standard for more than a decade. If anyone is using an MUA that doesn't use it, please imrpove that situation: pressure your vendor to fix that deficiency, and/or switch to a better mail client until then. > It also reduces the chance of accidentally replying off-list. What damage is done by accidentally replying off-list? At worst, you merely need to send the message again to the list. The damage is minimal, and easily rectified. Your proposed interference with the ?Reply-To? field, though, invites much more serious errors: it sets up a person to send a message to people they did *not* intend, when using a function (?reply to author?, often simply called ?reply?) specifically for reaching the sender *only*. If your message contains information only intended to be seen by the author to whom they are replying, the standard behaviour for ?Reply-To? gives the reasonable expectation it will go only to the author. But if a broken mailing list that munges ?Reply-To? to direct your reply to the whole mailing list, that is damage which can't be un-done. Please don't propose breaking standard behaviour by interfering with the meaning of standard fields. We have exactly the fields we need already: the RFC 2369 fields are in the header of every message from the mailing list. The ?List-Post? field, saying where mail should be directed to reach the mailing list, is exactly what is needed. -- \ ?Ours is a world where people don't know what they want and are | `\ willing to go through hell to get it.? ?Donald Robert Perry | _o__) Marquis | Ben Finney From support at superhost.gr Mon Jun 17 13:52:36 2013 From: support at superhost.gr (=?UTF-8?B?zp3Or866zr/Pgg==?=) Date: Mon, 17 Jun 2013 20:52:36 +0300 Subject: Don't feed the troll... In-Reply-To: References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> <20130617123548.47281099@imp> Message-ID: On 17/6/2013 8:42 ??, Oscar Benjamin wrote: > On 17 June 2013 17:35, D'Arcy J.M. Cain wrote: >> On Mon, 17 Jun 2013 14:39:56 +0000 (UTC) >> Grant Edwards wrote: >>> I don't want _any_ copies from from Mailman. I don't subscribe to >>> whatever mailing list you're talking about. I'm reading this via an >>> NNTP server. Keep replies in the group or on the list. >> >> And that is part of the problem. I have always argued that gatewaying >> the mailing list to newgroups is wrong. If this was only a mailing >> list there are many things we could do to reduce abuse but because of >> the gateway they can't be done. > > There is a very simple solution used by many mailing lists which is to > set the Reply-To header to point back to the mailing list. That way > any old email client on any OS/computer/phone/website etc. has the > required button to reply to the list without CCing anyone. It also > reduces the chance of accidentally replying off-list. Anyone who wants > to reply off-list or to deliberately CC someone (as I did here) can > still do so but it will rarely happen accidentally. > > > Oscar Yes please anyone do so, so we dont get 2 notification in both our mail reader and news reader at the same time. just repley only to the list. -- What is now proved was at first only imagined! From darcy at druid.net Sat Jun 15 13:04:10 2013 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Sat, 15 Jun 2013 13:04:10 -0400 Subject: Don't feed the troll... In-Reply-To: <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <7wfvwkcihf.fsf@benfinney.id.au> <20130615020957.GA72426@cskk.homeip.net> <7w61xfa9y8.fsf@benfinney.id.au> <51bc8af2$0$29997$c3e8da3$5496439d@news.astraweb.com> Message-ID: <20130615130410.19d52747@imp> On 15 Jun 2013 15:40:35 GMT Steven D'Aprano wrote: > On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: > > I suggested including the poster that you are replying to. > > In the name of all that's good and decent in the world, why on earth > would you do that when replying to a mailing list??? They're already > getting a reply. Sending them TWO identical replies is just rude. You may disagree with my reasoning but I have presented it a few times. By the way, I did reply just to the list this time as you obviously disagree but I may forget in the future. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net From support at superhost.gr Fri Jun 14 05:32:56 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 12:32:56 +0300 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 14/6/2013 12:06 ??, Heiko Wundram wrote: > Am 14.06.2013 10:37, schrieb Nick the Gr33k: >> So everything we see like: >> >> 16474 >> nikos >> abc123 >> >> everything is a string and nothing is a number? not even number 1? > > Come on now, this is _so_ obviously trolling, it's not even remotely > funny anymore. Why doesn't killfiling work with the mailing list version > of the python list? :-( > I'mm not trolling man, i just have hard time understanding why numbers acts as strings. -- What is now proved was at first only imagined! From modelnine at modelnine.org Fri Jun 14 06:15:11 2013 From: modelnine at modelnine.org (Heiko Wundram) Date: Fri, 14 Jun 2013 12:15:11 +0200 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BAED2F.6080909@modelnine.org> Am 14.06.2013 11:32, schrieb Nick the Gr33k: > I'mm not trolling man, i just have hard time understanding why numbers > acts as strings. If you can't grasp the conceptual differences between numbers and their/a representation, it's probably best if you stayed away from programming alltogether. I don't think you're actually as thick as you sound, but rather either you're simply too damn lazy to take the time to inform yourself from all the hints/links/information you've been given, or you're trolling. I'm still leaning towards the second. -- --- Heiko. From antoon.pardon at rece.vub.ac.be Fri Jun 14 07:09:03 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 13:09:03 +0200 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BAF9CF.8080705@rece.vub.ac.be> Op 14-06-13 11:32, Nick the Gr33k schreef: > I'mm not trolling man, i just have hard time understanding why numbers > acts as strings. They don't. No body claimed numbers acted like strings. What was explained, was that when numbers are displayed, they are converted into a notational string, which is then displayed. This to clear you of your confusion between numerals and numbers which you displayed by writing something like "the binary representation as a number" -- Antoon Pardon From support at superhost.gr Fri Jun 14 08:36:11 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 15:36:11 +0300 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 14/6/2013 2:09 ??, Antoon Pardon wrote: > Op 14-06-13 11:32, Nick the Gr33k schreef: > >> I'mm not trolling man, i just have hard time understanding why numbers >> acts as strings. > They don't. No body claimed numbers acted like strings. What was explained, > was that when numbers are displayed, they are converted into a notational > string, which is then displayed. This to clear you of your confusion between > numerals and numbers which you displayed by writing something like "the > binary representation as a number" > Hold on. number = an abstract sense numeral = ? notation = ? represenation = ? -- What is now proved was at first only imagined! From joel.goldstick at gmail.com Fri Jun 14 08:44:11 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Fri, 14 Jun 2013 08:44:11 -0400 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: go away Nick. Go far away. You are not a good person. You are not even a good Troll. You are just nick the *ick. You should take up something you can do better than this.. like maybe sleeping On Fri, Jun 14, 2013 at 8:36 AM, Nick the Gr33k wrote: > On 14/6/2013 2:09 ??, Antoon Pardon wrote: > >> Op 14-06-13 11:32, Nick the Gr33k schreef: >> >> I'mm not trolling man, i just have hard time understanding why numbers >>> acts as strings. >>> >> They don't. No body claimed numbers acted like strings. What was >> explained, >> >> was that when numbers are displayed, they are converted into a notational >> string, which is then displayed. This to clear you of your confusion >> between >> numerals and numbers which you displayed by writing something like "the >> binary representation as a number" >> >> Hold on. > > number = an abstract sense > numeral = ? > notation = ? > represenation = ? > > > -- > What is now proved was at first only imagined! > -- > http://mail.python.org/**mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoon.pardon at rece.vub.ac.be Fri Jun 14 09:25:27 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 15:25:27 +0200 Subject: Don't feed the troll... In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BB19C7.5080903@rece.vub.ac.be> Op 14-06-13 14:36, Nick the Gr33k schreef: > On 14/6/2013 2:09 ??, Antoon Pardon wrote: >> Op 14-06-13 11:32, Nick the Gr33k schreef: >>> I'mm not trolling man, i just have hard time understanding why numbers >>> acts as strings. >> They don't. No body claimed numbers acted like strings. What was explained, >> was that when numbers are displayed, they are converted into a notational >> string, which is then displayed. This to clear you of your confusion between >> numerals and numbers which you displayed by writing something like "the >> binary representation as a number" > Hold on. > number = an abstract sense > numeral = ? > notation = ? > represenation = ? I already explained these in previous responses. I am not going to repeat myself. IMO you are out of place here. You belong in a tutor class about basical computing concepts. There you can aquire the knowledge that is more or less expected of those who want to contribute here. I don't mind the occasional gap in knowledge but with you it seems more there is an occasional grain of knowledge in a sea of ignorance. To remedy the former a single explanation is mostly sufficient. To remedy the latter you need a tutorial course. Now there is nothing wrong in being ignorant. The question is how do you proceed from there. The answer is not by starting a project that is far above your ability and pestering the experts in the hope they will spoon feed you. From neilc at norwich.edu Fri Jun 14 11:54:06 2013 From: neilc at norwich.edu (Neil Cerutti) Date: 14 Jun 2013 15:54:06 GMT Subject: Don't feed the troll... References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 2013-06-14, Antoon Pardon wrote: > Now there is nothing wrong in being ignorant. The question is > how do you proceed from there. The answer is not by starting a > project that is far above your ability and pestering the > experts in the hope they will spoon feed you. A major issue is this: the spoon-feeding he does receive is unefficacious. Smart, well-meaning, articulate people's time is getting squandered. I read the responses. I've learned things from them. But Nikos has not. And once a discussion devolves to reitteration even that value is lost. And perhaps worst of all, there's none of the closure or vicarious catharsis that usually comes from a well-designed educational transaction. -- Neil Cerutti From nobody at nowhere.com Fri Jun 14 18:50:44 2013 From: nobody at nowhere.com (Guy Scree) Date: Fri, 14 Jun 2013 18:50:44 -0400 Subject: Don't feed the troll... References: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <3h7nr890f3nf4eau4cmo29jlq8k6ik8faf@4ax.com> Your best bet would be to keep an eye on www.edx.org for the next offerring of Introduction to Computer Science and Programming 6.00x (probably starts in Sept). It's a no-cost way to take a Python course. On Fri, 14 Jun 2013 12:32:56 +0300, Nick the Gr33k wrote: >On 14/6/2013 12:06 ??, Heiko Wundram wrote: >> Am 14.06.2013 10:37, schrieb Nick the Gr33k: >>> So everything we see like: >>> >>> 16474 >>> nikos >>> abc123 >>> >>> everything is a string and nothing is a number? not even number 1? >> >> Come on now, this is _so_ obviously trolling, it's not even remotely >> funny anymore. Why doesn't killfiling work with the mailing list version >> of the python list? :-( >> > >I'mm not trolling man, i just have hard time understanding why numbers >acts as strings. From denismfmcmahon at gmail.com Sat Jun 15 02:31:56 2013 From: denismfmcmahon at gmail.com (Denis McMahon) Date: Sat, 15 Jun 2013 06:31:56 +0000 (UTC) Subject: Don't feed the troll... References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Fri, 14 Jun 2013 12:32:56 +0300, Nick the Gr33k wrote: > I'mm not trolling man, i just have hard time understanding why numbers > acts as strings. It depends on the context. -- Denis McMahon, denismfmcmahon at gmail.com From nobody at nowhere.com Mon Jun 17 16:15:10 2013 From: nobody at nowhere.com (Guy Scree) Date: Mon, 17 Jun 2013 16:15:10 -0400 Subject: Don't feed the troll... References: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: I recommend that all participants in this thread, especially Alex and Anton, research the term "Pathological Altruism" From rosuav at gmail.com Mon Jun 17 17:46:28 2013 From: rosuav at gmail.com (Chris Angelico) Date: Tue, 18 Jun 2013 07:46:28 +1000 Subject: Don't feed the troll... In-Reply-To: References: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On Tue, Jun 18, 2013 at 6:15 AM, Guy Scree wrote: > I recommend that all participants in this thread, especially Alex and > Anton, research the term "Pathological Altruism" I don't intend to buy a book about it, but based on flipping through a few Google results and snippets, I'm thinking that this is the "Paladin fault" that I know from Dungeons & Dragons. :) ChrisA From cs at zip.com.au Fri Jun 14 06:19:16 2013 From: cs at zip.com.au (Cameron Simpson) Date: Fri, 14 Jun 2013 20:19:16 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <20130614101916.GA31029@cskk.homeip.net> On 14Jun2013 11:37, Nikos as SuperHost Support wrote: | On 14/6/2013 11:22 ??, Antoon Pardon wrote: | | >>Python prints numbers: | >No it doesn't, numbers are abstract concepts that can be represented in | >various notations, these notations are strings. Those notaional strings | >end up being printed. As I said before we are so used in using the | >decimal notation that we often use the notation and the number interchangebly | >without a problem. But when we are working with multiple notations that | >can become confusing and we should be careful to seperate numbers from their | >representaions/notations. | | How do we separate a number then from its represenation-natation? Shrug. When you "print" a number, Python transcribes a string representation of it to your terminal. | What is a notation anywat? is it a way of displayment? but that | would be a represeantion then.... Yep. Same thing. A "notation" is a particulart formal method of representation. | No it doesn't, numbers are abstract concepts that can be represented in | various notations | | >>but when we need a decimal integer | > | >There are no decimal integers. There is only a decimal notation of the number. | >Decimal, octal etc are not characteristics of the numbers themselves. | | So everything we see like: | | 16474 | nikos | abc123 | | everything is a string and nothing is a number? not even number 1? Everything you see like that is textual information. Internally to Python, various types are used: strings, bytes, integers etc. But when you print something, text is output. Cheers, -- Cameron Simpson A long-forgotten loved one will appear soon. Buy the negatives at any price. From antoon.pardon at rece.vub.ac.be Fri Jun 14 06:50:14 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 12:50:14 +0200 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BAF566.7050605@rece.vub.ac.be> Op 14-06-13 10:37, Nick the Gr33k schreef: > On 14/6/2013 11:22 ??, Antoon Pardon wrote: > >>> Python prints numbers: >> No it doesn't, numbers are abstract concepts that can be represented in >> various notations, these notations are strings. Those notaional strings >> end up being printed. As I said before we are so used in using the >> decimal notation that we often use the notation and the number >> interchangebly >> without a problem. But when we are working with multiple notations that >> can become confusing and we should be careful to seperate numbers >> from their >> representaions/notations. > > How do we separate a number then from its represenation-natation? What do you mean? Internally there is no representation linked to the number, so there is nothing to be seperated. Only when a number needs to be printed, is a representation for that number built and displayed. > What is a notation anywat? is it a way of displayment? but that would > be a represeantion then.... Yes a notation is a representation. However "represenation" is also a bit of python jargon that has a specific meaning. So in order to not confuse with multiple possible meanings for "representation" I chose to use "notation" >> There are no decimal integers. There is only a decimal notation of >> the number. >> Decimal, octal etc are not characteristics of the numbers themselves. > > > So everything we see like: > > 16474 > nikos > abc123 > > everything is a string and nothing is a number? not even number 1? There is a difference between "everything we see" as you write earlier and just plain "eveything" as you write later. Python works with numbers, but at the moment it has to display such a number it has to produce something that is printable. So it will build a string that can be used as a notation for that number, a numeral. And that is what will be displayed. -- Antoon. From support at superhost.gr Fri Jun 14 08:41:25 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 15:41:25 +0300 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: On 14/6/2013 1:19 ??, Cameron Simpson wrote: > On 14Jun2013 11:37, Nikos as SuperHost Support wrote: > | On 14/6/2013 11:22 ??, Antoon Pardon wrote: > | > | >>Python prints numbers: > | >No it doesn't, numbers are abstract concepts that can be represented in > | >various notations, these notations are strings. Those notaional strings > | >end up being printed. As I said before we are so used in using the > | >decimal notation that we often use the notation and the number interchangebly > | >without a problem. But when we are working with multiple notations that > | >can become confusing and we should be careful to seperate numbers from their > | >representaions/notations. > | > | How do we separate a number then from its represenation-natation? > > Shrug. When you "print" a number, Python transcribes a string > representation of it to your terminal. >>> 16 16 So the output 16 is in fact a string representation of the number 16 ? Then in what 16 and '16; differ to? > > | What is a notation anywat? is it a way of displayment? but that > | would be a represeantion then.... > > Yep. Same thing. A "notation" is a particulart formal method of > representation. Can you elaborate please? > | No it doesn't, numbers are abstract concepts that can be represented in > | various notations > | > | >>but when we need a decimal integer > | > > | >There are no decimal integers. There is only a decimal notation of the number. > | >Decimal, octal etc are not characteristics of the numbers themselves. > | > | So everything we see like: > | > | 16474 > | nikos > | abc123 > | > | everything is a string and nothing is a number? not even number 1? > > Everything you see like that is textual information. Internally to > Python, various types are used: strings, bytes, integers etc. But > when you print something, text is output. > > Cheers, > Thanks! -- What is now proved was at first only imagined! From support at superhost.gr Fri Jun 14 08:59:01 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 15:59:01 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: On 14/6/2013 1:50 ??, Antoon Pardon wrote: > Python works with numbers, but at the moment > it has to display such a number it has to produce something > that is printable. So it will build a string that can be > used as a notation for that number, a numeral. And that > is what will be displayed. so a number is just a number but when this number needs to be displayed into a monitor, then the printed form of that number we choose to call it a numeral? So, a numeral = a string representation of a number. Is this correct? -- What is now proved was at first only imagined! From antoon.pardon at rece.vub.ac.be Fri Jun 14 09:52:38 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Fri, 14 Jun 2013 15:52:38 +0200 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51BB2026.2040702@rece.vub.ac.be> Op 14-06-13 14:59, Nick the Gr33k schreef: > On 14/6/2013 1:50 ??, Antoon Pardon wrote: >> Python works with numbers, but at the moment >> it has to display such a number it has to produce something >> that is printable. So it will build a string that can be >> used as a notation for that number, a numeral. And that >> is what will be displayed. > so a number is just a number but when this number needs to be displayed > into a monitor, then the printed form of that number we choose to call > it a numeral? > So, a numeral = a string representation of a number. Is this correct? Yes, when you print an integer, what actually happens is something along the following algorithm (python 2 code): def write_int(out, nr): ord0 = ord('0') lst = [] negative = False if nr < 0: negative = True nr = -nr while nr: digit = nr % 10 lst.append(chr(digit + ord0)) nr /= 10 if negative: lst.append('-') lst.reverse() if not lst: lst.append('0') numeral = ''.join(lst) out.write(numeral) -- Antoon Pardon From cs at zip.com.au Fri Jun 14 20:28:29 2013 From: cs at zip.com.au (Cameron Simpson) Date: Sat, 15 Jun 2013 10:28:29 +1000 Subject: A few questiosn about encoding In-Reply-To: References: Message-ID: <20130615002829.GA20314@cskk.homeip.net> On 14Jun2013 15:59, Nikos as SuperHost Support wrote: | So, a numeral = a string representation of a number. Is this correct? No, a numeral is an individual digit from the string representation of a number. So: 65 requires two numerals: '6' and '5'. -- Cameron Simpson In life, you should always try to know your strong points, but this is far less important than knowing your weak points. Martin Fitzpatrick From antoon.pardon at rece.vub.ac.be Mon Jun 17 02:49:44 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 08:49:44 +0200 Subject: A few questiosn about encoding In-Reply-To: <20130615002829.GA20314@cskk.homeip.net> References: <20130615002829.GA20314@cskk.homeip.net> Message-ID: <51BEB188.6020809@rece.vub.ac.be> Op 15-06-13 02:28, Cameron Simpson schreef: > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: > | So, a numeral = a string representation of a number. Is this correct? > > No, a numeral is an individual digit from the string representation of a number. > So: 65 requires two numerals: '6' and '5'. Wrong context. A numeral as an individual digit is when you are talking about individual characters in a font. In such a context the set of glyphs that represent a digit are the numerals. However in a context of programming, numerals in general refer to the set of strings that represent a number. -- Antoon. From cs at zip.com.au Mon Jun 17 03:08:12 2013 From: cs at zip.com.au (Cameron Simpson) Date: Mon, 17 Jun 2013 17:08:12 +1000 Subject: A few questiosn about encoding In-Reply-To: <51BEB188.6020809@rece.vub.ac.be> References: <51BEB188.6020809@rece.vub.ac.be> Message-ID: <20130617070812.GA52332@cskk.homeip.net> On 17Jun2013 08:49, Antoon Pardon wrote: | Op 15-06-13 02:28, Cameron Simpson schreef: | > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: | > | So, a numeral = a string representation of a number. Is this correct? | > | > No, a numeral is an individual digit from the string representation of a number. | > So: 65 requires two numerals: '6' and '5'. | | Wrong context. A numeral as an individual digit is when you are talking about | individual characters in a font. In such a context the set of glyphs that | represent a digit are the numerals. | | However in a context of programming, numerals in general refer to the set of | strings that represent a number. No, those are just "numbers" or "numeric strings" (if you're being overt about them being strings at all). They're "numeric strings" because they're composed of "numerals". If you think otherwise your vocabulary needs adjusting. A numeral is a single digit. -- Cameron Simpson English is a living language, but simple illiteracy is no basis for linguistic evolution. - Dwight MacDonald From antoon.pardon at rece.vub.ac.be Mon Jun 17 04:29:35 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 10:29:35 +0200 Subject: A few questiosn about encoding In-Reply-To: <20130617070812.GA52332@cskk.homeip.net> References: <51BEB188.6020809@rece.vub.ac.be> <20130617070812.GA52332@cskk.homeip.net> Message-ID: <51BEC8EF.4010909@rece.vub.ac.be> Op 17-06-13 09:08, Cameron Simpson schreef: > On 17Jun2013 08:49, Antoon Pardon wrote: > | Op 15-06-13 02:28, Cameron Simpson schreef: > | > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: > | > | So, a numeral = a string representation of a number. Is this correct? > | > > | > No, a numeral is an individual digit from the string representation of a number. > | > So: 65 requires two numerals: '6' and '5'. > | > | Wrong context. A numeral as an individual digit is when you are talking about > | individual characters in a font. In such a context the set of glyphs that > | represent a digit are the numerals. > | > | However in a context of programming, numerals in general refer to the set of > | strings that represent a number. > > No, those are just "numbers" or "numeric strings" (if you're being > overt about them being strings at all). They're "numeric strings" > because they're composed of "numerals". If you think otherwise your > vocabulary needs adjusting. A numeral is a single digit. From antoon.pardon at rece.vub.ac.be Mon Jun 17 04:33:00 2013 From: antoon.pardon at rece.vub.ac.be (Antoon Pardon) Date: Mon, 17 Jun 2013 10:33:00 +0200 Subject: A few questiosn about encoding In-Reply-To: <20130617070812.GA52332@cskk.homeip.net> References: <51BEB188.6020809@rece.vub.ac.be> <20130617070812.GA52332@cskk.homeip.net> Message-ID: <51BEC9BC.2060808@rece.vub.ac.be> Op 17-06-13 09:08, Cameron Simpson schreef: > On 17Jun2013 08:49, Antoon Pardon wrote: > | Op 15-06-13 02:28, Cameron Simpson schreef: > | > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: > | > | So, a numeral = a string representation of a number. Is this correct? > | > > | > No, a numeral is an individual digit from the string representation of a number. > | > So: 65 requires two numerals: '6' and '5'. > | > | Wrong context. A numeral as an individual digit is when you are talking about > | individual characters in a font. In such a context the set of glyphs that > | represent a digit are the numerals. > | > | However in a context of programming, numerals in general refer to the set of > | strings that represent a number. > > No, those are just "numbers" or "numeric strings" (if you're being > overt about them being strings at all). They're "numeric strings" > because they're composed of "numerals". If you think otherwise your > vocabulary needs adjusting. A numeral is a single digit. Just because you are unfamiliar with a context in which "numeral" means a representation of a number, doesn't imply my vocabularly needs adjusting. -- Antoon Pardon From rantingrickjohnson at gmail.com Wed Jun 19 21:46:59 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Wed, 19 Jun 2013 18:46:59 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> Message-ID: <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> On Thursday, June 13, 2013 2:11:08 AM UTC-5, Steven D'Aprano wrote: > Gah! That's twice I've screwed that up. > Sorry about that! Yeah, and your difficulty explaining the Unicode implementation reminds me of a passage from the Python zen: "If the implementation is hard to explain, it's a bad idea." From steve+comp.lang.python at pearwood.info Thu Jun 20 02:26:17 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 20 Jun 2013 06:26:17 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> Message-ID: <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> On Wed, 19 Jun 2013 18:46:59 -0700, Rick Johnson wrote: > On Thursday, June 13, 2013 2:11:08 AM UTC-5, Steven D'Aprano wrote: > >> Gah! That's twice I've screwed that up. Sorry about that! > > Yeah, and your difficulty explaining the Unicode implementation reminds > me of a passage from the Python zen: > > "If the implementation is hard to explain, it's a bad idea." The *implementation* is easy to explain. It's the names of the encodings which I get tangled up in. ASCII: Supports exactly 127 code points, each of which takes up exactly 7 bits. Each code point represents a character. Latin-1, Latin-2, MacRoman, MacGreek, ISO-8859-7, Big5, Windows-1251, and about a gazillion other legacy charsets, all of which are mutually incompatible: supports anything from 127 to 65535 different code points, usually under 256. UCS-2: Supports exactly 65535 code points, each of which takes up exactly two bytes. That's fewer than required, so it is obsoleted by: UTF-16: Supports all 1114111 code points in the Unicode charset, using a variable-width system where the most popular characters use exactly two- bytes and the remaining ones use a pair of characters. UCS-4: Supports exactly 4294967295 code points, each of which takes up exactly four bytes. That is more than needed for the Unicode charset, so this is obsoleted by: UTF-32: Supports all 1114111 code points, using exactly four bytes each. Code points outside of the range 0 through 1114111 inclusive are an error. UTF-8: Supports all 1114111 code points, using a variable-width system where popular ASCII characters require 1 byte, and others use 2, 3 or 4 bytes as needed. Ignoring the legacy charsets, only UTF-16 is a terribly complicated implementation, due to the surrogate pairs. But even that is not too bad. The real complication comes from the interactions between systems which use different encodings, and that's nothing to do with Unicode. -- Steven From python at mrabarnett.plus.com Thu Jun 20 07:43:28 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 20 Jun 2013 12:43:28 +0100 Subject: A few questiosn about encoding In-Reply-To: <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51C2EAE0.9020200@mrabarnett.plus.com> On 20/06/2013 07:26, Steven D'Aprano wrote: > On Wed, 19 Jun 2013 18:46:59 -0700, Rick Johnson wrote: > >> On Thursday, June 13, 2013 2:11:08 AM UTC-5, Steven D'Aprano wrote: >> >>> Gah! That's twice I've screwed that up. Sorry about that! >> >> Yeah, and your difficulty explaining the Unicode implementation reminds >> me of a passage from the Python zen: >> >> "If the implementation is hard to explain, it's a bad idea." > > The *implementation* is easy to explain. It's the names of the encodings > which I get tangled up in. > You're off by one below! > > ASCII: Supports exactly 127 code points, each of which takes up exactly 7 > bits. Each code point represents a character. > 128 codepoints. > Latin-1, Latin-2, MacRoman, MacGreek, ISO-8859-7, Big5, Windows-1251, and > about a gazillion other legacy charsets, all of which are mutually > incompatible: supports anything from 127 to 65535 different code points, > usually under 256. > 128 to 65536 codepoints. > UCS-2: Supports exactly 65535 code points, each of which takes up exactly > two bytes. That's fewer than required, so it is obsoleted by: > 65536 codepoints. etc. > UTF-16: Supports all 1114111 code points in the Unicode charset, using a > variable-width system where the most popular characters use exactly two- > bytes and the remaining ones use a pair of characters. > > UCS-4: Supports exactly 4294967295 code points, each of which takes up > exactly four bytes. That is more than needed for the Unicode charset, so > this is obsoleted by: > > UTF-32: Supports all 1114111 code points, using exactly four bytes each. > Code points outside of the range 0 through 1114111 inclusive are an error. > > UTF-8: Supports all 1114111 code points, using a variable-width system > where popular ASCII characters require 1 byte, and others use 2, 3 or 4 > bytes as needed. > > > Ignoring the legacy charsets, only UTF-16 is a terribly complicated > implementation, due to the surrogate pairs. But even that is not too bad. > The real complication comes from the interactions between systems which > use different encodings, and that's nothing to do with Unicode. > > From rantingrickjohnson at gmail.com Thu Jun 20 09:40:14 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 20 Jun 2013 06:40:14 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> Message-ID: <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> On Thursday, June 20, 2013 1:26:17 AM UTC-5, Steven D'Aprano wrote: > The *implementation* is easy to explain. It's the names of > the encodings which I get tangled up in. Well, ignoring the fact that you're last explanation is still buggy, you have not actually described an "implementation", no, you've merely generalized ( and quite vaguely i might add) the technical specification of a few encoding. Let's ask Wikipedia to enlighten us on the subject of "implementation": ############################################################ # Define: Implementation # ############################################################ # In computer science, an implementation is a realization # # of a technical specification or algorithm as a program, # # software component, or other computer system through # # computer programming and deployment. Many # # implementations may exist for a given specification or # # standard. For example, web browsers contain # # implementations of World Wide Web Consortium-recommended # # specifications, and software development tools contain # # implementations of programming languages. # ############################################################ Do you think someone could reliably implement the alphabet of a new language in Unicode by using the general outline you provided? -- again, ignoring your continual fumbling when explaining that simple generalization :-) Your generalization is analogous to explaining web browsers as: "software that allows a user to view web pages in the range www.*" Do you think someone could implement a web browser from such limited specification? (if that was all they knew?). ============================================================ Since we're on the subject of Unicode: ============================================================ One the most humorous aspects of Unicode is that it has encodings for Braille characters. Hmm, this presents a conundrum of sorts. RIDDLE ME THIS?! Since Braille is a type of "reading" for the blind by utilizing the sense of touch (therefore DEMANDING 3 dimensions) and glyphs derived from Unicode are restrictively two dimensional, because let's face it people, Unicode exists in your computer, and computer screens are two dimensional... but you already knew that -- i think?, then what is the purpose of a Unicode Braille character set? That should haunt your nightmares for some time. From robotsondrugs at gmail.com Thu Jun 20 10:04:50 2013 From: robotsondrugs at gmail.com (Andrew Berg) Date: Thu, 20 Jun 2013 09:04:50 -0500 Subject: A few questiosn about encoding In-Reply-To: <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> Message-ID: <51C30C02.4080009@gmail.com> On 2013.06.20 08:40, Rick Johnson wrote: > One the most humorous aspects of Unicode is that it has > encodings for Braille characters. Hmm, this presents a > conundrum of sorts. RIDDLE ME THIS?! > > Since Braille is a type of "reading" for the blind by > utilizing the sense of touch (therefore DEMANDING 3 > dimensions) and glyphs derived from Unicode are > restrictively two dimensional, because let's face it people, > Unicode exists in your computer, and computer screens are > two dimensional... but you already knew that -- i think?, > then what is the purpose of a Unicode Braille character set? Two dimensional characters can be made into 3 dimensional shapes. Building numbers are a good example of this. We already have one Unicode troll; do we really need you too? -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 From rantingrickjohnson at gmail.com Thu Jun 20 11:12:18 2013 From: rantingrickjohnson at gmail.com (Rick Johnson) Date: Thu, 20 Jun 2013 08:12:18 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> Message-ID: <0f045970-7c77-4d66-81cf-214f111232c3@googlegroups.com> On Thursday, June 20, 2013 9:04:50 AM UTC-5, Andrew Berg wrote: > On 2013.06.20 08:40, Rick Johnson wrote: > > then what is the purpose of a Unicode Braille character set? > Two dimensional characters can be made into 3 dimensional shapes. Yes in the real world. But what about on your computer screen? How do you plan on creating tactile representations of braille glyphs on my monitor? Hey, if you can already do this, please share, as it sure would make internet porn more interesting! > Building numbers are a good example of this. Either the matrix is reality or you must live inside your computer as a virtual being. Is your name Tron? Are you a pawn of Master Control? He's such a tyrant! From rosuav at gmail.com Thu Jun 20 11:26:20 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 21 Jun 2013 01:26:20 +1000 Subject: A few questiosn about encoding In-Reply-To: <0f045970-7c77-4d66-81cf-214f111232c3@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> <0f045970-7c77-4d66-81cf-214f111232c3@googlegroups.com> Message-ID: On Fri, Jun 21, 2013 at 1:12 AM, Rick Johnson wrote: > On Thursday, June 20, 2013 9:04:50 AM UTC-5, Andrew Berg wrote: >> On 2013.06.20 08:40, Rick Johnson wrote: > >> > then what is the purpose of a Unicode Braille character set? >> Two dimensional characters can be made into 3 dimensional shapes. > > Yes in the real world. But what about on your computer > screen? How do you plan on creating tactile representations of > braille glyphs on my monitor? Hey, if you can already do this, > please share, as it sure would make internet porn more > interesting! I had a device for creating embossed text. It predated Unicode by a couple of years at least (not sure how many, because I was fairly young at the time). It was made by a company called Epson, it plugged into the computer via a 25-pin plug, and when it was properly functioning, it had a ribbon of ink that it would bash through to darken the underside of the embossed text. But sometimes that ribbon slipped out of position, and we had beautifully-hammered ASCII text, unsullied by ink. And since the device did graphics too, it could be used for the entire Unicode character set if you wanted. Not sure that it would improve your porn any, but I've no doubt you could try if you wanted. ChrisA From jpiitula at ling.helsinki.fi Thu Jun 20 13:25:03 2013 From: jpiitula at ling.helsinki.fi (Jussi Piitulainen) Date: 20 Jun 2013 20:25:03 +0300 Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> <0f045970-7c77-4d66-81cf-214f111232c3@googlegroups.com> Message-ID: Rick Johnson writes: > On Thursday, June 20, 2013 9:04:50 AM UTC-5, Andrew Berg wrote: > > On 2013.06.20 08:40, Rick Johnson wrote: > > > > then what is the purpose of a Unicode Braille character set? > > Two dimensional characters can be made into 3 dimensional shapes. > > Yes in the real world. But what about on your computer screen? How > do you plan on creating tactile representations of braille glyphs on > my monitor? Hey, if you can already do this, please share, as it > sure would make internet porn more interesting! Search for braille display on the web. A wikipedia article also led me to braille e-book. (Or search for braille porn, since you are so inclined - the concept turns out to be already out there on the web.) From rosuav at gmail.com Thu Jun 20 11:28:35 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 21 Jun 2013 01:28:35 +1000 Subject: A few questiosn about encoding In-Reply-To: <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> Message-ID: On Thu, Jun 20, 2013 at 11:40 PM, Rick Johnson wrote: > Your generalization is analogous to explaining web browsers > as: "software that allows a user to view web pages in the > range www.*" Do you think someone could implement a web > browser from such limited specification? (if that was all > they knew?). Wow. That spec isn't limited, it's downright faulty. Or do you really think that (a) there is such a thing as the "range www.*", and that (b) that "range" has anything to do with web browsers? ChrisA From andipersti at gmail.com Thu Jun 20 13:08:06 2013 From: andipersti at gmail.com (Andreas Perstinger) Date: Thu, 20 Jun 2013 19:08:06 +0200 Subject: A few questiosn about encoding In-Reply-To: <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <4160f6c9-8a53-432f-b807-ae33ed69ac97@googlegroups.com> Message-ID: <20130620190806.0a860dac@Hof> Rick Johnson wrote: >============================================================ > Since we're on the subject of Unicode: >============================================================ >One the most humorous aspects of Unicode is that it has >encodings for Braille characters. Hmm, this presents a >conundrum of sorts. RIDDLE ME THIS?! > > Since Braille is a type of "reading" for the blind by > utilizing the sense of touch (therefore DEMANDING 3 > dimensions) and glyphs derived from Unicode are > restrictively two dimensional, because let's face it people, > Unicode exists in your computer, and computer screens are > two dimensional... but you already knew that -- i think?, > then what is the purpose of a Unicode Braille character set? > >That should haunt your nightmares for some time. From http://www.unicode.org/versions/Unicode6.2.0/ch15.pdf "The intent of encoding the 256 Braille patterns in the Unicode Standard is to allow input and output devices to be implemented that can interchange Braille data without having to go through a context-dependent conversion from semantic values to patterns, or vice versa. In this manner, final-form documents can be exchanged and faithfully rendered." http://files.pef-format.org/specifications/pef-2008-1/pef-specification.html#Unicode I wish you a pleasant sleep tonight. Bye, Andreas From wxjmfauth at gmail.com Thu Jun 20 12:27:50 2013 From: wxjmfauth at gmail.com (wxjmfauth at gmail.com) Date: Thu, 20 Jun 2013 09:27:50 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> Message-ID: <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> Le jeudi 20 juin 2013 13:43:28 UTC+2, MRAB a ?crit?: > On 20/06/2013 07:26, Steven D'Aprano wrote: > > > On Wed, 19 Jun 2013 18:46:59 -0700, Rick Johnson wrote: > > > > > >> On Thursday, June 13, 2013 2:11:08 AM UTC-5, Steven D'Aprano wrote: > > >> > > >>> Gah! That's twice I've screwed that up. Sorry about that! > > >> > > >> Yeah, and your difficulty explaining the Unicode implementation reminds > > >> me of a passage from the Python zen: > > >> > > >> "If the implementation is hard to explain, it's a bad idea." > > > > > > The *implementation* is easy to explain. It's the names of the encodings > > > which I get tangled up in. > > > > > You're off by one below! > > > > > > ASCII: Supports exactly 127 code points, each of which takes up exactly 7 > > > bits. Each code point represents a character. > > > > > 128 codepoints. > > > > > Latin-1, Latin-2, MacRoman, MacGreek, ISO-8859-7, Big5, Windows-1251, and > > > about a gazillion other legacy charsets, all of which are mutually > > > incompatible: supports anything from 127 to 65535 different code points, > > > usually under 256. > > > > > 128 to 65536 codepoints. > > > > > UCS-2: Supports exactly 65535 code points, each of which takes up exactly > > > two bytes. That's fewer than required, so it is obsoleted by: > > > > > 65536 codepoints. > > > > etc. > > > > > UTF-16: Supports all 1114111 code points in the Unicode charset, using a > > > variable-width system where the most popular characters use exactly two- > > > bytes and the remaining ones use a pair of characters. > > > > > > UCS-4: Supports exactly 4294967295 code points, each of which takes up > > > exactly four bytes. That is more than needed for the Unicode charset, so > > > this is obsoleted by: > > > > > > UTF-32: Supports all 1114111 code points, using exactly four bytes each. > > > Code points outside of the range 0 through 1114111 inclusive are an error. > > > > > > UTF-8: Supports all 1114111 code points, using a variable-width system > > > where popular ASCII characters require 1 byte, and others use 2, 3 or 4 > > > bytes as needed. > > > > > > > > > Ignoring the legacy charsets, only UTF-16 is a terribly complicated > > > implementation, due to the surrogate pairs. But even that is not too bad. > > > The real complication comes from the interactions between systems which > > > use different encodings, and that's nothing to do with Unicode. > > > > > > And all these coding schemes have something in common, they work all with a unique set of code points, more precisely a unique set of encoded code points (not the set of implemented code points (byte)). Just what the flexible string representation is not doing, it artificially devides unicode in subsets and try to handle eache subset differently. On this other side, that is because it is impossible to work properly with multiple sets of encoded code points that all these coding schemes exist today. There are simply no other way. Even "exotic" schemes like "CID-fonts" used in pdf are based on that scheme. jmf From rosuav at gmail.com Thu Jun 20 12:37:48 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 21 Jun 2013 02:37:48 +1000 Subject: A few questiosn about encoding In-Reply-To: <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> Message-ID: On Fri, Jun 21, 2013 at 2:27 AM, wrote: > And all these coding schemes have something in common, > they work all with a unique set of code points, more > precisely a unique set of encoded code points (not > the set of implemented code points (byte)). > > Just what the flexible string representation is not > doing, it artificially devides unicode in subsets and try > to handle eache subset differently. > UTF-16 divides Unicode into two subsets: BMP characters (encoded using one 16-bit unit) and astral characters (encoded using two 16-bit units in the D800::/5 netblock, or equivalent thereof). Your beloved narrow builds are guilty of exactly the same crime as the hated 3.3. ChrisA From python at mrabarnett.plus.com Thu Jun 20 13:17:12 2013 From: python at mrabarnett.plus.com (MRAB) Date: Thu, 20 Jun 2013 18:17:12 +0100 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> Message-ID: <51C33918.6060102@mrabarnett.plus.com> On 20/06/2013 17:37, Chris Angelico wrote: > On Fri, Jun 21, 2013 at 2:27 AM, wrote: >> And all these coding schemes have something in common, >> they work all with a unique set of code points, more >> precisely a unique set of encoded code points (not >> the set of implemented code points (byte)). >> >> Just what the flexible string representation is not >> doing, it artificially devides unicode in subsets and try >> to handle eache subset differently. >> > > > UTF-16 divides Unicode into two subsets: BMP characters (encoded using > one 16-bit unit) and astral characters (encoded using two 16-bit units > in the D800::/5 netblock, or equivalent thereof). Your beloved narrow > builds are guilty of exactly the same crime as the hated 3.3. > UTF-8 divides Unicode into subsets which are encoded in 1, 2, 3, or 4 bytes, and those who previously used ASCII still need only 1 byte per codepoint! From rosuav at gmail.com Thu Jun 20 13:21:39 2013 From: rosuav at gmail.com (Chris Angelico) Date: Fri, 21 Jun 2013 03:21:39 +1000 Subject: A few questiosn about encoding In-Reply-To: <51C33918.6060102@mrabarnett.plus.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> <51C33918.6060102@mrabarnett.plus.com> Message-ID: On Fri, Jun 21, 2013 at 3:17 AM, MRAB wrote: > On 20/06/2013 17:37, Chris Angelico wrote: >> >> On Fri, Jun 21, 2013 at 2:27 AM, wrote: >>> >>> And all these coding schemes have something in common, >>> they work all with a unique set of code points, more >>> precisely a unique set of encoded code points (not >>> the set of implemented code points (byte)). >>> >>> Just what the flexible string representation is not >>> doing, it artificially devides unicode in subsets and try >>> to handle eache subset differently. >>> >> >> >> UTF-16 divides Unicode into two subsets: BMP characters (encoded using >> one 16-bit unit) and astral characters (encoded using two 16-bit units >> in the D800::/5 netblock, or equivalent thereof). Your beloved narrow >> builds are guilty of exactly the same crime as the hated 3.3. >> > UTF-8 divides Unicode into subsets which are encoded in 1, 2, 3, or 4 > bytes, and those who previously used ASCII still need only 1 byte per > codepoint! Yes, but there's never (AFAIK) been a Python implementation that represents strings in UTF-8; UTF-16 was one of two options for Python 2.2 through 3.2, and is the one that jmf always seems to be measuring against. ChrisA From wxjmfauth at gmail.com Sun Jun 23 11:51:41 2013 From: wxjmfauth at gmail.com (wxjmfauth at gmail.com) Date: Sun, 23 Jun 2013 08:51:41 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> Message-ID: <28586b5f-cb51-4e41-a47d-38a18723b51c@googlegroups.com> Le jeudi 20 juin 2013 19:17:12 UTC+2, MRAB a ?crit?: > On 20/06/2013 17:37, Chris Angelico wrote: > > > On Fri, Jun 21, 2013 at 2:27 AM, wrote: > > >> And all these coding schemes have something in common, > > >> they work all with a unique set of code points, more > > >> precisely a unique set of encoded code points (not > > >> the set of implemented code points (byte)). > > >> > > >> Just what the flexible string representation is not > > >> doing, it artificially devides unicode in subsets and try > > >> to handle eache subset differently. > > >> > > > > > > > > > UTF-16 divides Unicode into two subsets: BMP characters (encoded using > > > one 16-bit unit) and astral characters (encoded using two 16-bit units > > > in the D800::/5 netblock, or equivalent thereof). Your beloved narrow > > > builds are guilty of exactly the same crime as the hated 3.3. > > > > > UTF-8 divides Unicode into subsets which are encoded in 1, 2, 3, or 4 > > bytes, and those who previously used ASCII still need only 1 byte per > > codepoint! Sorry, but no, it does not work in that way: confusion between the set of encoded code points and the implementation of these called code units. utf-8: how many bytes to hold an "a" in memory? one byte. flexible string representation: how many bytes to hold an "a" in memory? One byte? No, two. (Funny, it consumes more memory to hold an ascii char than ascii itself) utf-8: In a series of bytes implementing the encoded code points supposed to hold a string, picking a byte and finding to which encoded code point it belongs is a no prolem. flexible string representation: In a series of bytes implementing the encoded code points supposed to hold a string, picking a byte and finding to which encoded code point it belongs is ... impossible ! One of the cause of the bad working of this flexible string representation. The basics of any coding scheme, unicode included. jmf From steve+comp.lang.python at pearwood.info Sun Jun 23 12:30:40 2013 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 23 Jun 2013 16:30:40 GMT Subject: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> <28586b5f-cb51-4e41-a47d-38a18723b51c@googlegroups.com> Message-ID: <51c722af$0$29999$c3e8da3$5496439d@news.astraweb.com> On Sun, 23 Jun 2013 08:51:41 -0700, wxjmfauth wrote: > utf-8: how many bytes to hold an "a" in memory? one byte. > > flexible string representation: how many bytes to hold an "a" in memory? > One byte? No, two. (Funny, it consumes more memory to hold an ascii char > than ascii itself) Incorrect. Python strings have overhead because they are objects, so let's see the difference adding a single character makes: # Python 3.3, with the hated flexible string representation: py> sys.getsizeof('a'*100) - sys.getsizeof('a'*99) 1 # Python 3.2: py> sys.getsizeof('a'*100) - sys.getsizeof('a'*99) 4 How about a French ? character? Of course, ASCII cannot store it *at all*, but let's see what Python can do: # The hated Python 3.3 again: py> sys.getsizeof('?'*100) - sys.getsizeof('?'*99) 1 # And Python 3.2: py> sys.getsizeof('?'*100) - sys.getsizeof('?'*99) 4 > utf-8: In a series of bytes implementing the encoded code points > supposed to hold a string, picking a byte and finding to which encoded > code point it belongs is a no prolem. Incorrect. UTF-8 is unsuitable for random access, since it has variable- width characters, anything from 1 to 4 bytes. So you cannot just jump directly to character 1000 in a block of text, you have to inspect each byte one-by-one to decide whether it is a 1, 2, 3 or 4 byte character. > flexible string representation: In a series of bytes implementing the > encoded code points supposed to hold a string, picking a byte and > finding to which encoded code point it belongs is ... impossible ! Incorrect. It is absolutely trivial. Each string is marked as either 1- byte, 2-byte or 4-byte. If it is a 1-byte string, then each byte is one character. If it is a 2-byte string, then it is just like Python 3.2 narrow build, and each two bytes is a character. If it is a 4-byte string, then it is just like Python 3.2 wide build, and each four bytes is a character. Within a single string, the number of bytes per character is fixed, and random access is easy and fast. -- Steven From wxjmfauth at gmail.com Tue Jun 25 16:16:33 2013 From: wxjmfauth at gmail.com (wxjmfauth at gmail.com) Date: Tue, 25 Jun 2013 13:16:33 -0700 (PDT) Subject: A few questiosn about encoding In-Reply-To: <51c722af$0$29999$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> <28586b5f-cb51-4e41-a47d-38a18723b51c@googlegroups.com> <51c722af$0$29999$c3e8da3$5496439d@news.astraweb.com> Message-ID: Le dimanche 23 juin 2013 18:30:40 UTC+2, Steven D'Aprano a ?crit?: > On Sun, 23 Jun 2013 08:51:41 -0700, wxjmfauth wrote: > > > > > utf-8: how many bytes to hold an "a" in memory? one byte. > > > > > > flexible string representation: how many bytes to hold an "a" in memory? > > > One byte? No, two. (Funny, it consumes more memory to hold an ascii char > > > than ascii itself) > > > > Incorrect. Python strings have overhead because they are objects, so > > let's see the difference adding a single character makes: > > > > # Python 3.3, with the hated flexible string representation: > > py> sys.getsizeof('a'*100) - sys.getsizeof('a'*99) > > 1 > > > > # Python 3.2: > > py> sys.getsizeof('a'*100) - sys.getsizeof('a'*99) > > 4 > > > > > > How about a French ? character? Of course, ASCII cannot store it *at > > all*, but let's see what Python can do: > > > > > > # The hated Python 3.3 again: > > py> sys.getsizeof('?'*100) - sys.getsizeof('?'*99) > > 1 > > > > > > # And Python 3.2: > > py> sys.getsizeof('?'*100) - sys.getsizeof('?'*99) > > 4 > > > > > > > > > utf-8: In a series of bytes implementing the encoded code points > > > supposed to hold a string, picking a byte and finding to which encoded > > > code point it belongs is a no prolem. > > > > Incorrect. UTF-8 is unsuitable for random access, since it has variable- > > width characters, anything from 1 to 4 bytes. So you cannot just jump > > directly to character 1000 in a block of text, you have to inspect each > > byte one-by-one to decide whether it is a 1, 2, 3 or 4 byte character. > > > > > > > flexible string representation: In a series of bytes implementing the > > > encoded code points supposed to hold a string, picking a byte and > > > finding to which encoded code point it belongs is ... impossible ! > > > > Incorrect. It is absolutely trivial. Each string is marked as either 1- > > byte, 2-byte or 4-byte. If it is a 1-byte string, then each byte is one > > character. If it is a 2-byte string, then it is just like Python 3.2 > > narrow build, and each two bytes is a character. If it is a 4-byte > > string, then it is just like Python 3.2 wide build, and each four bytes > > is a character. Within a single string, the number of bytes per character > > is fixed, and random access is easy and fast. > > > > > > > > -- > > Steven :-) From breamoreboy at yahoo.co.uk Thu Jun 20 15:43:59 2013 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Thu, 20 Jun 2013 20:43:59 +0100 Subject: A few questiosn about encoding In-Reply-To: <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> <77ba6b16-4b1d-47a6-9b9b-5af45335c4fe@googlegroups.com> <51c2a089$0$29973$c3e8da3$5496439d@news.astraweb.com> <114200cf-2d46-46cb-bb5f-7c5f8ab98a66@googlegroups.com> Message-ID: On 20/06/2013 17:27, wxjmfauth at gmail.com wrote: > Le jeudi 20 juin 2013 13:43:28 UTC+2, MRAB a ?crit : >> On 20/06/2013 07:26, Steven D'Aprano wrote: >> >>> On Wed, 19 Jun 2013 18:46:59 -0700, Rick Johnson wrote: >> >>> >> >>>> On Thursday, June 13, 2013 2:11:08 AM UTC-5, Steven D'Aprano wrote: >> >>>> >> >>>>> Gah! That's twice I've screwed that up. Sorry about that! >> >>>> >> >>>> Yeah, and your difficulty explaining the Unicode implementation reminds >> >>>> me of a passage from the Python zen: >> >>>> >> >>>> "If the implementation is hard to explain, it's a bad idea." >> >>> >> >>> The *implementation* is easy to explain. It's the names of the encodings >> >>> which I get tangled up in. >> >>> >> >> You're off by one below! >> >>> >> >>> ASCII: Supports exactly 127 code points, each of which takes up exactly 7 >> >>> bits. Each code point represents a character. >> >>> >> >> 128 codepoints. >> >> >> >>> Latin-1, Latin-2, MacRoman, MacGreek, ISO-8859-7, Big5, Windows-1251, and >> >>> about a gazillion other legacy charsets, all of which are mutually >> >>> incompatible: supports anything from 127 to 65535 different code points, >> >>> usually under 256. >> >>> >> >> 128 to 65536 codepoints. >> >> >> >>> UCS-2: Supports exactly 65535 code points, each of which takes up exactly >> >>> two bytes. That's fewer than required, so it is obsoleted by: >> >>> >> >> 65536 codepoints. >> >> >> >> etc. >> >> >> >>> UTF-16: Supports all 1114111 code points in the Unicode charset, using a >> >>> variable-width system where the most popular characters use exactly two- >> >>> bytes and the remaining ones use a pair of characters. >> >>> >> >>> UCS-4: Supports exactly 4294967295 code points, each of which takes up >> >>> exactly four bytes. That is more than needed for the Unicode charset, so >> >>> this is obsoleted by: >> >>> >> >>> UTF-32: Supports all 1114111 code points, using exactly four bytes each. >> >>> Code points outside of the range 0 through 1114111 inclusive are an error. >> >>> >> >>> UTF-8: Supports all 1114111 code points, using a variable-width system >> >>> where popular ASCII characters require 1 byte, and others use 2, 3 or 4 >> >>> bytes as needed. >> >>> >> >>> >> >>> Ignoring the legacy charsets, only UTF-16 is a terribly complicated >> >>> implementation, due to the surrogate pairs. But even that is not too bad. >> >>> The real complication comes from the interactions between systems which >> >>> use different encodings, and that's nothing to do with Unicode. >> >>> >> >>> > > And all these coding schemes have something in common, > they work all with a unique set of code points, more > precisely a unique set of encoded code points (not > the set of implemented code points (byte)). > > Just what the flexible string representation is not > doing, it artificially devides unicode in subsets and try > to handle eache subset differently. > > On this other side, that is because it is impossible to > work properly with multiple sets of encoded code points > that all these coding schemes exist today. There are simply > no other way. > > Even "exotic" schemes like "CID-fonts" used in pdf > are based on that scheme. > > jmf > I entirely agree with the viewpoints of jmfauth, Nick the Greek, rr, Xah Lee and Ilias Lazaridis on the grounds that disagreeing and stating my beliefs ends up with the Python Mailing List police standing on my back doorsetep. Give me the NSA or GCHQ any day of the week :( -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence From davea at davea.name Wed Jun 12 08:43:05 2013 From: davea at davea.name (Dave Angel) Date: Wed, 12 Jun 2013 08:43:05 -0400 Subject: A few questiosn about encoding In-Reply-To: <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> Message-ID: <51B86CD9.6020204@davea.name> On 06/12/2013 05:24 AM, Steven D'Aprano wrote: > On Wed, 12 Jun 2013 09:09:05 +0000, ???????? ?????? wrote: > >> Isn't 14 bits way to many to store a character ? > > No. > > There are 1114111 possible characters in Unicode. (And in Japan, they > sometimes use TRON instead of Unicode, which has even more.) > > If you list out all the combinations of 14 bits: > > 0000 0000 0000 00 > 0000 0000 0000 01 > 0000 0000 0000 10 > 0000 0000 0000 11 > [...] > 1111 1111 1111 10 > 1111 1111 1111 11 > > you will see that there are only 32767 (2**15-1) such values. You can't > fit 1114111 characters with just 32767 values. > > Actually, it's worse. There are 16536 such values (2**14), assuming you include null, which you did in your list. -- DaveA From support at superhost.gr Fri Jun 14 01:34:37 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 08:34:37 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: On 14/6/2013 1:46 ??, Dennis Lee Bieber wrote: > On Wed, 12 Jun 2013 09:09:05 +0000 (UTC), ???????? ?????? > declaimed the following: > >>>> (*) infact UTF8 also indicates the end of each character >> >>> Up to a point. The initial byte encodes the length and the top few >>> bits, but the subsequent octets aren?t distinguishable as final in >>> isolation. 0x80-0xBF can all be either medial or final. >> >> >> So, the first high-bits are a directive that UTF-8 uses to know how many >> bytes each character is being represented as. >> >> 0-127 codepoints(characters) use 1 bit to signify they need 1 bit for >> storage and the rest 7 bits to actually store the character ? >> > Not quite... The leading bit is a 0 -> which means 0..127 are sent > as-is, no manipulation. So, in utf-8, the leading bit which is a zero 0, its actually a flag to tell that the code-point needs 1 byte to be stored and the rest 7 bits is for the actual value of 0-127 code-points ? >> 128-256 codepoints(characters) use 2 bit to signify they need 2 bits for >> storage and the rest 14 bits to actually store the character ? >> > 128..255 -- in what encoding? These all have the leading bit with a > value of 1. In 8-bit encodings (ISO-Latin-1) the meaning of those values is > inherent in the specified encoding and they are sent as-is. So, latin-iso or greek-iso, the leading 0 is not a flag like it is in utf-8 encoding because latin-iso and greek-iso and all *-iso use all 8 bits for storage? But, in utf-8, the leading bit, which is 1, is to tell that the code-point needs 2 byte to be stored and the rest 7 bits is for the actual value of 128-255 code-points ? But why 2 bytes? leading 1 is a flag and the rest 7 bits can hold the encoded value. Bu that is not the case since we know that utf-8 needs 2 bytes to store code-points 127-255 > 1110 starts a three byte sequence, 11110 starts a four byte sequence... > Basically, count the number of leading 1-bits before a 0 bit, and that > tells you how many bytes are in the multi-byte sequence -- and all bytes > that start with 10 are supposed to be the continuations of a multibyte set > (and not a signal that this is a 1-byte entry -- those only have a leading > 0) Why doesn't it work like this? leading 0 = 1 byte flag leading 1 = 2 bytes flag leading 00 = 3 bytes flag leading 01 = 4 bytes flag leading 10 = 5 bytes flag leading 11 = 6 bytes flag Wouldn't it be more logical? > Original UTF-8 allowed for 31-bits to specify a character in the Unicode > set. It used 6 bytes -- 48 bits total, but 7 bits of the first byte were > the flag (6 leading 1 bits and a 0 bit), and two bits (leading 10) of each > continuation. utf8 6 byted = 48 bits - 7 bits(from first bytes) - 2 bits(for each continuation) * 5 = 48 - 7 - 10 = 31 bits indeed to store the actual code-point. But 2^31 is still a huge number to store any kind of character isnt it? -- What is now proved was at first only imagined! From schesis at gmail.com Fri Jun 14 02:00:57 2013 From: schesis at gmail.com (Zero Piraeus) Date: Fri, 14 Jun 2013 02:00:57 -0400 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: : On 14 June 2013 01:34, Nick the Gr33k wrote: > Why doesn't it work like this? > > leading 0 = 1 byte flag > leading 1 = 2 bytes flag > leading 00 = 3 bytes flag > leading 01 = 4 bytes flag > leading 10 = 5 bytes flag > leading 11 = 6 bytes flag > > Wouldn't it be more logical? Think about it. Let's say that, as per your scheme, a leading 0 indicates "1 byte" (as is indeed the case in UTF8). What things could follow that leading 0? How does that impact your choice of a leading 00 or 01 for other numbers of bytes? ... okay, you're obviously going to need to be spoon-fed a little more than that. Here's a byte: 01010101 Is that a single byte representing a code point in the 0-127 range, or the first of 4 bytes representing something else, in your proposed scheme? How can you tell? Now look at the way UTF8 does it: Really, follow the link and study the table carefully. Don't continue reading this until you believe you understand the choices that the designers of UTF8 made, and why they made them. Pay particular attention to the possible values for byte 1. Do you notice the difference between that scheme, and yours: 0xxxxxxx 1xxxxxxx 00xxxxxx 01xxxxxx 10xxxxxx 11xxxxxx If you don't see it, keep looking until you do ... this email gives you more than enough hints to work it out. Don't ask someone here to explain it to you. If you want to become competent, you must use your brain. -[]z. From support at superhost.gr Fri Jun 14 03:28:32 2013 From: support at superhost.gr (Nick the Gr33k) Date: Fri, 14 Jun 2013 10:28:32 +0300 Subject: A few questiosn about encoding In-Reply-To: References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> Message-ID: On 14/6/2013 9:00 ??, Zero Piraeus wrote: > : > > On 14 June 2013 01:34, Nick the Gr33k wrote: >> Why doesn't it work like this? >> >> leading 0 = 1 byte flag >> leading 1 = 2 bytes flag >> leading 00 = 3 bytes flag >> leading 01 = 4 bytes flag >> leading 10 = 5 bytes flag >> leading 11 = 6 bytes flag >> >> Wouldn't it be more logical? > > Think about it. Let's say that, as per your scheme, a leading 0 > indicates "1 byte" (as is indeed the case in UTF8). What things could > follow that leading 0? How does that impact your choice of a leading > 00 or 01 for other numbers of bytes? > > ... okay, you're obviously going to need to be spoon-fed a little more > than that. Here's a byte: > > 01010101 > > Is that a single byte representing a code point in the 0-127 range, or > the first of 4 bytes representing something else, in your proposed > scheme? How can you tell? Indeed. You cannot tell if it stands for 1 byte or a 4 byte sequence: 0 + 1010101 = leading 0 stands for 1byte representation of a code-point 01 + 010101 = leading 01 stands for 4byte representation of a code-point the problem here in my scheme of how utf8 encoding works is that you cannot tell whether the flag is '0' or '01' Same happen with leading '1' and '11'. You cannot tell what the flag is, so you cannot know if the Unicode code-point is being represented as 2-byte sequence or 6 bye sequence Understood > Now look at the way UTF8 does it: > > > Really, follow the link and study the table carefully. Don't continue > reading this until you believe you understand the choices that the > designers of UTF8 made, and why they made them. > > Pay particular attention to the possible values for byte 1. Do you > notice the difference between that scheme, and yours: > > 0xxxxxxx > 1xxxxxxx > 00xxxxxx > 01xxxxxx > 10xxxxxx > 11xxxxxx > > If you don't see it, keep looking until you do ... this email gives > you more than enough hints to work it out. Don't ask someone here to > explain it to you. If you want to become competent, you must use your > brain. 0xxxxxxx 110xxxxx 10xxxxxx 1110xxxx 10xxxxxx 10xxxxxx 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx I did read the link but i still cannot see why 1. '110' is the flag for 2-byte code-point 2. why the in the 2nd byte and every subsequent byte leading flag has to be '10' -- What is now proved was at first only imagined! From guytamir1 at gmail.com Sun Jun 9 13:09:17 2013 From: guytamir1 at gmail.com (guytamir1 at gmail.com) Date: Sun, 9 Jun 2013 10:09:17 -0700 (PDT) Subject: Redirecting to a third party site with injected HTML Message-ID: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Hi all, new to group and pretty new to python. I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) i'm not really sure how to approach this problem.. hints :) regards, Guy From joel.goldstick at gmail.com Sun Jun 9 13:14:09 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Sun, 9 Jun 2013 13:14:09 -0400 Subject: Redirecting to a third party site with injected HTML In-Reply-To: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 1:09 PM, wrote: > Hi all, > > new to group and pretty new to python. > > I'm working on a new project and i want to receive a request from a user > and to redirect him to a third party site, but on the page after i redirect > my users i want to them to see injected html (on the third party site.) > > i'm not really sure how to approach this problem.. > hints :) > > regards, > Guy > -- > http://mail.python.org/mailman/listinfo/python-list > you can do redirect easily, but you can't inject html in 3rd party without permission. At any rate, how is this a python question? -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabiosantosart at gmail.com Sun Jun 9 13:22:17 2013 From: fabiosantosart at gmail.com (=?ISO-8859-1?Q?F=E1bio_Santos?=) Date: Sun, 9 Jun 2013 18:22:17 +0100 Subject: Redirecting to a third party site with injected HTML In-Reply-To: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Message-ID: On 9 Jun 2013 18:15, wrote: > > Hi all, > > new to group and pretty new to python. > > I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) > > i'm not really sure how to approach this problem.. > hints :) > > regards, > Guy What web framework are you using? This does not seem like a python question, instead a HTML/JavaScript one. -------------- next part -------------- An HTML attachment was scrubbed... URL: From guytamir1 at gmail.com Sun Jun 9 13:52:21 2013 From: guytamir1 at gmail.com (guytamir1 at gmail.com) Date: Sun, 9 Jun 2013 10:52:21 -0700 (PDT) Subject: Redirecting to a third party site with injected HTML In-Reply-To: References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Message-ID: <0021fabe-78ed-4e79-8cdf-468b4ccc7a71@googlegroups.com> its a python question since the request is received on a python server and i thought that there may be a way to so from the server that sends the response to the user... On Sunday, June 9, 2013 8:22:17 PM UTC+3, F?bio Santos wrote: > On 9 Jun 2013 18:15, wrote: > > > > > > Hi all, > > > > > > new to group and pretty new to python. > > > > > > I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) > > > > > > > i'm not really sure how to approach this problem.. > > > hints :) > > > > > > regards, > > > Guy > > What web framework are you using? > > This does not seem like a python question, instead a HTML/JavaScript one. From joel.goldstick at gmail.com Sun Jun 9 14:03:06 2013 From: joel.goldstick at gmail.com (Joel Goldstick) Date: Sun, 9 Jun 2013 14:03:06 -0400 Subject: Redirecting to a third party site with injected HTML In-Reply-To: <0021fabe-78ed-4e79-8cdf-468b4ccc7a71@googlegroups.com> References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> <0021fabe-78ed-4e79-8cdf-468b4ccc7a71@googlegroups.com> Message-ID: On Sun, Jun 9, 2013 at 1:52 PM, wrote: > its a python question since the request is received on a python server and > i thought that > there may be a way to so from the server that sends the response to the > user... > > On Sunday, June 9, 2013 8:22:17 PM UTC+3, F?bio Santos wrote: > > On 9 Jun 2013 18:15, wrote: > > > > > > > > > > Hi all, > > > > > > > > > > new to group and pretty new to python. > > > > > > > > > > I'm working on a new project and i want to receive a request from a > user and to redirect him to a third party site, but on the page after i > redirect my users i want to them to see injected html (on the third party > site.) > > > > > > > > > > > > i'm not really sure how to approach this problem.. > > > > > hints :) > > > > > > > > > > regards, > > > > > Guy > > > > What web framework are you using? > > > > This does not seem like a python question, instead a HTML/JavaScript one. > -- > http://mail.python.org/mailman/listinfo/python-list > unless you hack into 3rd party, you can't alter that site -- Joel Goldstick http://joelgoldstick.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From roy at panix.com Sun Jun 9 14:53:21 2013 From: roy at panix.com (Roy Smith) Date: Sun, 09 Jun 2013 14:53:21 -0400 Subject: Redirecting to a third party site with injected HTML References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> <0021fabe-78ed-4e79-8cdf-468b4ccc7a71@googlegroups.com> Message-ID: On Sunday, June 9, 2013 8:22:17 PM UTC+3, F?bio Santos wrote: >> This does not seem like a python question, instead a HTML/JavaScript one. In article <0021fabe-78ed-4e79-8cdf-468b4ccc7a71 at googlegroups.com>, guytamir1 at gmail.com wrote: > its a python question since the request is received on a python server and i > thought that there may be a way to so from the server that sends the response to the > user... There are two layers to this question. The first is a HTTP/HTML/Javascript question. That question is: "i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) What HTML, and/or Javascript, and/or HTTP headers do I need to send to make that happen? The second layer is a Python question: "How do I write something in Python which causes the above HTML/Javascript/HTTP to get sent?" Until you can find an answer for the first question, it's not worth asking the second question. And the answer to the first question won't be found on a python group. From hobson42 at gmail.com Sun Jun 9 14:24:56 2013 From: hobson42 at gmail.com (Ian) Date: Sun, 09 Jun 2013 19:24:56 +0100 Subject: Redirecting to a third party site with injected HTML In-Reply-To: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Message-ID: <51B4C878.7050500@gmail.com> On 09/06/2013 18:09, guytamir1 at gmail.com wrote: > Hi all, > > new to group and pretty new to python. > > I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) > > i'm not really sure how to approach this problem.. > hints :) > > regards, > Guy Hi Guy, It appears to me that you have thought "Inject html" as the solution to your problem. Sorry, but you can't solve your problem that way. Basic security. What is the problem you are trying to solve? Ian From python.list at tim.thechases.com Sun Jun 9 14:31:56 2013 From: python.list at tim.thechases.com (Tim Chase) Date: Sun, 9 Jun 2013 13:31:56 -0500 Subject: Redirecting to a third party site with injected HTML In-Reply-To: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> References: <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com> Message-ID: <20130609133156.30535598@bigbox.christie.dr> On 2013-06-09 10:09, guytamir1 at gmail.com wrote: > I'm working on a new project and i want to receive a request from a > user and to redirect him to a third party site, but on the page > after i redirect my users i want to them to see injected html (on > the third party site.) As others have stated, I'm not sure this is a Python problem. Two possibilities occur to me: 1) Your server returns a page with an