Re: First python program, syntax error in while loop
On 06/05/2013 13:06, Neil Cerutti wrote: On 2013-05-03, John Gordon wrote: In Neil Cerutti writes: Not quite yet. Players who guess correctly on the fifth try don't get credit. Are you sure? tries is initialized to zero and isn't incremented for the initial guess. while (number != guess) and (tries < 5): Is the condition that concludes the game. After the game, you are told you lost if tries is not less than five, regardless of if number == guess. One of these days I'll work out why some people insist on using superfluous parentheses in Python code. Could it be that they enjoy exercising their fingers by reaching for the shift key in conjunction with the 9 or 0 key? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: module install failures
On 06/05/2013 19:50, Milton Mobley wrote: Hi there, I hate to bother you with this, but there doesn't seem to be any ordinary online help for such issues at python.org <http://python.org>: Lately I have tried to install several Python modules that are wrappers for C/C++ base libraries on a Windows 7 64 bit system. I used pip in a virtualenv environment, and some script fails complaining that it can't find vcvarsall.bat. I found the file in my Visual Studio 10 Express tree, but the script can't find it. How can I fix the script to look in the right place? Hopefully this helps http://old.nabble.com/Re%3A-Unable-to-install-PyWin32-with-Python-2.6.2-p25202902.html -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: First python program, syntax error in while loop
On 07/05/2013 01:17, alex23 wrote: On May 6, 10:37 pm, Mark Lawrence wrote: One of these days I'll work out why some people insist on using superfluous parentheses in Python code. Could it be that they enjoy exercising their fingers by reaching for the shift key in conjunction with the 9 or 0 key? One of these days I'll work out why some programmers consider typing to be "effort". I think it's very important to consider this aspect. E.g. any one using dynamically typed languages has to put in more effort as they should be typing up their test code, whereas people using statically typed languages can simply head down to the pub once their code has compiled. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do Perl programmers make more money than Python programmers
On 08/05/2013 01:34, Neil Hodgson wrote: jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performance, not compliance. Please show an example where Python 3.3 is not compliant with Unicode. Neil Surely nobody expects an answer, although I suppose there is always a first time for everything. Once again stealing from Tommy Docherty, jmfauth is to Python what King Herod was to baby sitting. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: multiple versions of python
On 08/05/2013 02:35, Colin J. Williams wrote: On 07/05/2013 6:26 PM, sokovic.anamar...@gmail.com wrote: Hi, what is the generally recommended structure when we have into play this type of problem: multiple versions of python (both in the sense of main versions and sub versions, e.g., 2.7 : 2.7.1 2.7.3 3: 3.3 3.3.1 Different versions of gcc different compilation strategies (-vanilla and non-vanilla) different modules (numpy,scipy) together with the different versions of all the rest. any help is appreciated Ana Do you really need more than 2.7.3 and 3.3.1. Typically, these go to C:\Python27 and C:\Python33 with windows. Colin W. In which case you'll normally be doing a binary installation. If you're compiling it's more likely to be VC++ not gcc. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
cello library
Hi folks, I thought some of you might find this interesting http://libcello.org/ -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode humor
On 10/05/2013 17:25, Chris Angelico wrote: On Sat, May 11, 2013 at 2:07 AM, rusi wrote: On May 10, 8:32 pm, Chris Angelico wrote: On Sat, May 11, 2013 at 1:24 AM, Ned Batchelder wrote: On 5/10/2013 11:06 AM, jmfauth wrote: On 8 mai, 15:19, Roy Smith wrote: Apropos to any of the myriad unicode threads that have been going on recently: http://xkcd.com/1209/ -- This reflects a lack of understanding of Unicode. jmf And this reflects a lack of a sense of humor. :) Isn't that a crime in the UK? ChrisA The problem with English humour (as against standard humor) is that its not unicode compliant Unicode humour was carefully laid out to incorporate English humour. In fact, if you use the standard variable-length-joke encoding, it's possible for a Unicode joke to be decoded as if it were an English joke, without any actual knowledge of Unicode. Unfortunately, this can result in non-compliant English humour publishers producing jokes that come out as gibberish in the rest of the world. Fortunately, we then get to laugh at them. ChrisA This simply shows bias to the English speaking world, as does Python unicode, at least in 3.3+. I wouldn't mind betting that other languages can't cope, e.g. can 3.3+ manage the top secret joke that's so deadly even the Germans die laughing? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Python's sad, unimaginative Enum
That's the title of this little beast http://www.acooke.org/cute/Pythonssad0.html if anybody's interested. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]
On 13/05/2013 22:17, Alister wrote: On Mon, 13 May 2013 19:28:29 +0100, Fábio Santos wrote: I think it is more readable. When doing more complicated statements I use != instead, but when it's a single test I prefer not … == It's a personal thing. It may also have to do with the fact that I didn't know python had != when I was a novice. On 13 May 2013 19:08, "Ned Batchelder" wrote: I would then still write it as not (x == y) to make it clear to myself & avoid any possible confusion although I think that X != Y is much cleaner. 2 lines from the zen stand out here:- Explicit is better than implicit. in the face of ambiguity refuse the temptation to guess. there are many features of Python (& other languages) i did not now when I started but have adopted once I understood what they were & how they worked. then again use what you are most comfortable with. Practicality beats purity I much prefer the alternative <> for != but some silly people insisted that this be removed from Python3. Just how stupid can you get? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing a blog post on the new Enum.
On 13/05/2013 22:44, Fábio Santos wrote: I have followed the process of the new PEP closely, and as such I know that there is a repository containing the reference implementation, a link to which was posted on the python-dev list. Is it okay to link to this repository in my new blog post about the Enum, so my readers can try it out? I will warn my readers about it not being final and not to use in production code. I am unsure whether the repository is not supposed to be shared with too many people. -- Fábio Santos My understanding is that nobody can mention this on pain of being subject to the Comfy Chair. I hope this clarifies everything. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
On 17/05/2013 01:00, visphatesj...@gmail.com wrote: fuck straight off I assume you're the author of "How to win friends and influence people"? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about ast.literal_eval
On 21/05/2013 09:23, Fábio Santos wrote: On 21 May 2013 09:10, "Frank Millman" mailto:fr...@chagford.com>> wrote: > It doesn't address the issue of brackets. I imagine that the answer is something like - > > maintain a stack of results > for each left bracket, push a level > for each right bracket, pop the result > > or something ... > Time for me to suggest pyparsing or PLY. You're better off creating your own AST and walking it to produce python or SQL than reinventing the wheel, I think. Or pick one from this lot http://nedbatchelder.com/text/python-parsers.html -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: please help
On 21/05/2013 09:38, iman.memarp...@gmail.com wrote: WAP in python to accept a list of words on STDIN and searches for a line containing all five vowels(a,e,i,o,u) Sorry we don't do your homework for you. But your starter for 10 is to use raw_input on Python 2 or input on Python 3 to fetch data from stdin. I look forward to reviewing your code. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 378: Format Specifier for Thousands Separator
On 21/05/2013 20:13, Skip Montanaro wrote: Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead. That's unlikely to change. If not deprecated already string interpolation using the modulo operator has lost favor to the string object's format method. Please stop perpetuating this myth, see http://mail.python.org/pipermail/python-dev/2012-February/116789.html and http://bugs.python.org/issue14123 -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: file I/O and arithmetic calculation
On 22/05/2013 17:13, Keira Wilson wrote: Dear all, I would appreciate if someone could write a simple python code for the purpose below: I have five text files each of 10 columns by 10 rows as follows: |file_one= 'C:/test/1.txt' file_two= 'C:/test/2.txt' . . . file_five= 'C:/test/5.txt'| I want to calculate the mean of first row (10 elements) for each file (5 files), if mean of first column (10 elements) of each file (5 files) is 50. Thank you in advance. Keira Sorry but we don't do homework. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing Json data (I think I am nearly there) complete beginner
On 23/05/2013 19:19, Andrew Edwards-Adams wrote: On Thursday, May 23, 2013 7:11:28 PM UTC+1, Andrew Berg wrote: On 2013.05.23 11:58, Andrew Edwards-Adams wrote: Hi thanks for the reply Andrew, my first bit of code was heading in the right direction I was managing to pull out the usernames from the JSON, using REGEX. It's also worth mentioning that regexes are almost always the wrong tool, especially for standardized formats like JSON. They can be very useful when nothing saner will get the job done, but are a nasty mess with no real benefit otherwise. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 Thanks Andrew, yes I believe this is what the guy who provided me with the code was thinking. I was about to embark on what was definitely going to be an inefficient long regex. Funny old world, there doesn't appear to be working code but someone is already thinking about definite inefficiency. What evidence do you have to support this claim? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Prepending string "@" to usernames
On 25/05/2013 00:04, Thomas Murphy wrote: Maybe this is what you're looking for? raw_address = "cookielover93 TheGermanHatesSaurkraut WhatsThatBoy932834" address_library = raw_address.split() print address_library final_address = [] for address in address_library: final_address.append("@" + str(address)) print final_address Exactly it. Thank you so much Dan. Perfect! -- Sincerely, Thomas Murphy Code Ninja 646.957.6115 You can safely remove the call to str as address is already a string. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: help how to sort a list in order of 'n' in python without using inbuilt functions??
On 25/05/2013 09:54, Carlos Nepomuceno wrote: lol def absolute(x): return x if x>0 else -x def reach(x): y=[] z=0 while z In my book this is another fail as lists are inbuilt (yuck!) and so is the add function that'll be called for z+=1. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: help how to sort a list in order of 'n' in python without using inbuilt functions??
On 25/05/2013 15:28, Steven D'Aprano wrote: On Sat, 25 May 2013 19:14:57 +1000, Chris Angelico wrote: def random_number(): return 7 I call shenanigans! That value isn't generated randomly, you just made it up! I rolled a die *hundreds* of times and not once did it come up seven! Lies, damn lies and statistics? :) -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Magazine
On 26/05/2013 02:58, Chris Angelico wrote: On Sun, May 26, 2013 at 11:54 AM, Roy Smith wrote: In article <7cd17be8-d455-4db8-b8d0-ccc757db5...@googlegroups.com>, John Ladasky wrote: On Saturday, May 25, 2013 8:30:19 AM UTC-7, Roy Smith wrote: From my phone, I can call any other phone anywhere in the world. But I can't talk directly to the file server in my neighbor's house across the street? Hmmm... I've been an advocate of IPv6, but... now you've got me thinking of what Iran's new cadre of hackers might do with it! :^) You (like many people) are confusing universal addressability with universal connectivity. The converse of that is people confusing NAT with security. 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. Not as an accident of being behind a NAT box. To be more specific: The control of who can talk to whom is in the hands of the admins of the two endpoints and the nodes in between, rather than being arbitrarily in the hands of the technology. So I would be able to talk to the file server across the street, but only IF its admin lets me. ChrisA By such means as leaving the top level admin password set to the factory default? :) -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: CrazyHTTPd - HTTP Daemon in Python
On 26/05/2013 04:55, cdorm...@gmail.com wrote: This is a small little Project that I have started. Its a light little Web Server (HTTPd) coded in python. Requirements: Python 2.7 =< And Linux / BSD. I believe this could work in a CLI Emulator in windows too. Welcome to check out the website powered by CrazyHTTPd: http://web.crazycoder.me:14081/index.html Please Email me with any bugs, errors, and/or comments about my little project: cdorm...@gmail.com IMHO writing a project right now that is limited to Python 2 is about as much use as a chocolate teapot. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'
On 26/05/2013 16:24, Chris Angelico wrote: On Mon, May 27, 2013 at 1:00 AM, wrote: Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: Anyone seeign somethign wrong? Yes. You're posting requests, then bumping the thread two hours later as though you're entitled to a response quicker than that. Plus, the problems you're seeing ought to be solved by the 2to3 utility. Use it. Look at its output. ChrisA There is a tool that convert python 2.6.x code => python 3.x ? Can you post a link to that toll plz? You have its name. You have Google. You have a mailing list that is getting tired of you not putting in any effort. ChrisA Not to mention double spaced google crap :( -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'
On 26/05/2013 17:10, Νίκος Γκρ33κ wrote: Here is the live error log coming form apacher when i request the webpage form browser: ==> /usr/local/apache/logs/error_log <== [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] fopen: Permission denied [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] fopen: Permission denied [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py what is that suexec? What has this got to do with Python? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Cutting a deck of cards
On 26/05/2013 19:16, Carlos Nepomuceno wrote: Date: Sun, 26 May 2013 10:52:14 -0700 Subject: Cutting a deck of cards From: rvinc...@gmail.com To: python-list@python.org 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 -- http://mail.python.org/mailman/listinfo/python-list list(range(13 * 4 * decks)) == range(13 * 4 * decks) ;) Wrong if you're using Python 3 :( -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to know how to implement concurrent threads in Python
On 26/05/2013 22:27, Andrew Berg wrote: On 2013.05.26 16:21, Daniel Gagliardi wrote: shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. So "How to win friends and influence people" had two authors. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Encodign issue in Python 3.3.1 (once again)
On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) No wonder the Greek economy is so screwed up. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to know how to implement concurrent threads in Python
On 26/05/2013 20:10, Daniel Gagliardi wrote: I want to know how to implement concurrent threads in Python google, bing, duckduckgo, yahoo... -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Encodign issue in Python 3.3.1 (once again)
On 26/05/2013 23:32, Chris Angelico wrote: On Mon, May 27, 2013 at 8:21 AM, Mark Lawrence wrote: On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) No wonder the Greek economy is so screwed up. Do you think the Greek economy would be improved by Python coming with PostgreSQL bindings? That'd push a lot of people onto a better database engine than MySQL. ChrisA Even the best economies would be improved by Python coming with PostgreSQL bindings, but if and only if the user knew how to use them :) -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Cutting a deck of cards
On 26/05/2013 23:42, Chris Angelico wrote: On Mon, May 27, 2013 at 8:30 AM, Carlos Nepomuceno wrote: Thanks guys! I've been delaying my dive into Python 3 (because I don't need it for now) but I'd like to run some code just to learn how different it is from Python 2 and even other Python flavors. So, I'd like to know if it's possible to have multiple Python installations on the same machine (Windows 7 in my particular case) without messing one with each other. What care must I take not to mess up with them? Easy. Just grab the standard installer and hit it. You'll get two separate directories (or more; I have \Python26, \Python27, \Python32, \Python33 on this box), and you can run whichever you want. The one thing to take care of is .py associations; I haven't actually done it (on here, all I actually do is IDLE, pretty much), but as of 3.3, you should be able to use a Unix-style shebang to indicate which Python you want to invoke. ChrisA See this http://docs.python.org/3/whatsnew/3.3.html#pep-397-python-launcher-for-windows -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27/05/2013 07:11, Cameron Simpson wrote: BTW, I recommend importing "errno" and using symbolic names. It makes things much more readable, and accomodates the situation where the symbols map to different numbers on different platforms. And have a catch-all. For example: Cheers, This should make life easier for us http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: This mail never gets delivered. Any ideas why?
On 27/05/2013 10:15, Νίκος Γκρ33κ wrote: Please, do you see an error in this? As i said the 2nd solution doesnt provide an error but also doesn't get the mail send too. At least you're improving. Yesterday you were chasing after two hours, it's now up to four hours 15 minutes. Keep doubling the time like this and you'll soon be up to the 24 hours that's considered polite. As previously stated the time can be shortened substantially by getting your cheque book out. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Encodign issue in Python 3.3.1 (once again)
On 27/05/2013 15:16, Νίκος Γκρ33κ wrote: I cant solve this plz help! Sure, all you need do is get your cheque book out. Also have you ever heard the expression "patience is a virtue"? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27/05/2013 17:54, Carlos Nepomuceno wrote: I think PEP 3151 is a step ahead! That's almost exactly what I was looking for. Why did it take so long to have that implemented? Lack of volunteers. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Short-circuit Logic
On 28/05/2013 09:39, Ahmed Abdulshafy wrote: And that's not specific to Python. Using google products is also not specific to Python. However whereever it's used it's a PITA as people are forced into reading double spaced crap. Please check out the link in my signature. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: How to: Setuptools
On 28/05/2013 13:03, rusi wrote: On May 28, 6:32 am, ray wrote: I would like to use easy_install, but can't figure out how to install it. I have 64-bit Python 2.7.5 on Windows 7. Following the instructions onhttps://pypi.python.org/pypi/setuptools, it says: Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue Being new to Python, I don't know what it means to "run it". I am not sure what I am looking at when I open it as the first line is "#!python". Looking down into the content of ez_setup.py, I find: 'setuptools-0.6c10-py2.6.egg': but there is no entry 'setuptools-0.6c10-py2.7.egg': Searching for it, I found a version at:https://pypi.python.org/packages/2.7/s/setuptools/ This appeared to be a linux version, the first line is: #!/bin/sh and the content seems to be encoded. There is an exe athttps://pypi.python.org/pypi/setuptools, but the instructions on the page state the .exe won't work for 64-bit installs. Ray Since there seems to be no response to this, let me try (even though I am not on windows) Just point your browser at the link http://peak.telecommunity.com/dist/ez_setup.py And save the file ez_setup.py The more windows-y way of running this is to right-click this and edit the run-with in some way that I dont have at my finger-tips. Do this, something goes wrong, no output to see. The more old-fashioned way is to start a dos-box (run cmd.exe) navigate to the directory where the ez_setup.py is saved from there run the command: python ez_setup.py Do this, something goes wrong, output in front of you. Do that and report back on what happened -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: How to: Setuptools
On 28/05/2013 14:05, ray wrote: The installation fails. The report stated it could not find the file. Per: Looking down into the content of ez_setup.py, I find: 'setuptools-0.6c10-py2.6.egg': but there is no entry 'setuptools-0.6c10-py2.7.egg': Since I am trying to install this for Python 2.7, it fails. Any suggestions? Ray Try reading this http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows which refers to this http://www.lfd.uci.edu/~gohlke/pythonlibs/ where you can get pip which is an easy_install replacement. You pays your money, you takes your choice :) -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python #ifdef
On 28/05/2013 20:46, Carlos Nepomuceno wrote: Are there Python 'preprocessor directives'? I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a single file. Is that possible? How? https://pypi.python.org/pypi/six/1.3.0 -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this code correct?
On 30/05/2013 13:31, Νίκος Γκρ33κ wrote: This is my last question, everythign else is taken care of. i cant test thjis coe online because i receive this [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 & maybe it is correct but it wont run, perhaps somethign with linux? Please ask questions unrelated to Python on a list that is unrelated to Python. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: User Input
On 30/05/2013 15:03, Eternaltheft wrote: do you think ti would be better if i call drawBoard? How would I know if you don't quote any context? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Too many python installations. Should i remove them all and install the latest?
On 01/06/2013 01:18, David wrote: I knew I didn't have all the answers, but felt that I'd try some pig wrestling anyway. To carry on with the animal analogy, the OP appears to me a very dangerous combination of headless chicken and bull in a china shop. -- "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
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: The problem with "print"
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 2.7.5
On 03/06/2013 23:37, Carlos Nepomuceno wrote: From: na...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: The problem with "print"
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing filenames from Greeklish => Greek (subprocess complain)
On 04/06/2013 14:57, Νικόλαος Κούρας wrote: I' just tried to implment your idea by correcting file names as: # 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) ) # 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.encode('ISO-8859-7').decode('latin-1'), ) data = cur.fetchone()#URL is unique, so should only be one This gave me this error: root@nikos [~]# [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59] File "files.py", line 68 [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59] data = cur.fetchone()#URL is unique, so should only be one [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59]^ [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59] SyntaxError: invalid syntax [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59] Premature end of script headers: files.py [Tue Jun 04 16:55:51 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml It seem that this approach overcame the error, won't you agree? But i see no syntax error in the exact follow up line. data = cur.fetchone()#URL is unique, so should only be one The syntax error is often in the preceeding line, typically because you're missed a closing bracket. -- "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
Re: Apache and suexec issue that wont let me run my python script
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: lstrip problem - beginner question
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Bools and explicitness [was Re: PyWart: The problem with "print"]
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Do you consider Python a 4GL? Why (not)?
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Bools and explicitness [was Re: PyWart: The problem with "print"]
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: I just wrote my first Python program a guessing game and it exits with an error I get this.
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Source code to identify user through browser?
On 05/06/2013 16:18, rusi wrote: On Jun 5, 8:10 pm, Carlos Nepomuceno wrote: From: nos...@nospam.com Subject: Source code to identify user through browser? Date: Wed, 5 Jun 2013 15:08:54 +0200 To: python-l...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: I just wrote my first Python program a guessing game and it exits with an error I get this.
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing filenames from Greeklish => Greek (subprocess complain)
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: "Don't rebind built-in names*" - it confuses readers
On 11/06/2013 16:43, Rick Johnson wrote: On Tuesday, June 11, 2013 8:34:55 AM UTC-5, Steven D'Aprano wrote: GvR is saying that it's okay to use the names of built-in functions or types as the names of local variables, even if that causes the built-in to be inaccessible within that function. Looks like we've finally found the traitor! Code smells propagating down from the apex of the pyramid... well thanks for the wonderful advice Guido, and with it you've cursed Python's stdlib to another decade of unprofessional code! PS: Excuse me whilst i brew myself a nice cup of HEMLOCK TEA!!! ಠ_ಠ At long last I've received some good news. But blast it, you've only said you'll brew it, not that you'll drink it. Still, I can but hope. -- "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
Re: PyGame tutorial?
On 11/06/2013 16:47, Eam onn wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with some player movement because he isn't moving smoothly, he jumps. If I add 5 pixels to his X position if I press a button, jumps to the next 5 pixels instead of smoothly moving. If I just add 5 pixels normally, he moves smooth. Thanks! Any help is appreciated! Try typing "pygame tutorial" into your favourite search and see what comes back, you might be pleasantly surprised. -- "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
Re: A certainl part of an if() structure never gets executed.
On 11/06/2013 21:20, Νικόλαος Κούρας wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (name, month, year) ) elif not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (month, year) ) elif not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', year ) else: print('''Πώς να γίνει αναζήτηση αφού δεν επέλεξες ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?''') print( '''''' ) sys.exit(0) data = cur.fetchall() hits = money = 0 for row in data: hits += 1 money = money + row[2] .. .. selects based on either name, month, year or all of them [/code] The above if structure works correctly *only* if the user sumbits by form: name, month, year or month, year If, he just enter a year in the form and sumbit then, i get no error, but no results displayed back. Any ideas as to why this might happen? On the grounds that you can't possibly have made a coding error I'd say this is a Python bug which should be reported here bugs.python.org. -- "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
Re: A certainl part of an if() structure never gets executed.
On 12/06/2013 14:05, Neil Cerutti wrote: Also, I wish he would stop fudging his From info. I've got something like 8 entries for this ass in my killfile, and it seems I need a new one every day. An ass eh, when did he get promoted to that position? -- "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
Re: Turnign greek-iso filenames => utf-8 iso
On 12/06/2013 13:42, Νικόλαος Κούρας wrote: Something you want me to try? I'd suggest suicide but that would no doubt start another stream of questions along the lines of "How do I do it?". -- "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
Re: Wrong website loaded when other requested
On 12/06/2013 21:19, Chris Angelico wrote: On Thu, Jun 13, 2013 at 3:33 AM, Νικόλαος Κούρας wrote: Why is pointing to /home/nikos isntead of /home/dauwin ? Why is question pointing to python-list@python.org isntead [sic] of your home town and some paid support? ChrisA Surely support at superhost dot greece should be able to sort all this out? -- "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
Re: Wrong website loaded when other requested
On 13/06/2013 15:28, Chris Angelico wrote: On Fri, Jun 14, 2013 at 12:23 AM, Νικόλαος Κούρας wrote: Please suggest something of why this happnes. You remind me of George. http://www.chroniclesofgeorge.com/ ChrisA George reminds me of the late Joyce Grenfell. The OP reminds me of Monty Python's Matching Tie and Handerchief, the record's stuck, the record's stuck, the record's stuck... -- "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
Re: Don't feed the troll...
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrong website loaded when other requested
On 14/06/2013 17:22, Nick the Gr33k wrote: On 14/6/2013 7:15 μμ, Steven D'Aprano wrote: On Fri, 14 Jun 2013 18:37:50 +0300, Nick the Gr33k wrote: please take an overall look at my httpd.conf at http://pastebin.com/Pb3VbNC9 in case you want to examine somehting else. Thank you very much. PLEASE SUGGEST SOMETHING! Don't shout, it's rude. We're not your servants. This is not a http.conf group, this is a Python group. The only suggestion I have is, find a forum that discusses web config and ask there. i did, the problem couldn't resolved there either. Can you at least help with the files.py ? you've provided code there that i utilized and alter a bit but the files aren't showing. can you help me run files.py successfully? Sure, just give me your password. -- "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
Re: Wrong website loaded when other requested
On 14/06/2013 17:46, Mark Lawrence wrote: Sure, just give me your password. He actually offered to do just this!!! How stupid can you get? I'm so fed up with his behaviour that I've emailed the Greek Embassy in London pointing out what he's up to. I've requested that someone looks at his activities and decides whether or not Greek law has been broken by him risking his clients' data. So Ferrous Cranus, if you feel the weight of the law landing on your shoulders, please *DON'T* blame me, just look in the mirror and you'll find the real culprit. -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 10:42, subhabangal...@gmail.com wrote: Dear Group, I am trying to search the following pattern in Python. I have following strings: (i)"In the ocean" (ii)"On the ocean" (iii) "By the ocean" (iv) "In this group" (v) "In this group" (vi) "By the new group" . I want to extract from the first word to the last word, where first word and last word are varying. I am looking to extract out: (i) the (ii) the (iii) the (iv) this (v) this (vi) the new . The problem may be handled by converting the string to list and then index of list. But I am thinking if I can use regular expression in Python. If any one of the esteemed members can help. Thanking you in Advance, Regards, Subhabrata I tend to reach for string methods rather than an RE so will something like this suit you? c:\Users\Mark\MyPython>type a.py for s in ("In the ocean", "On the ocean", "By the ocean", "In this group", "In this group", "By the new group"): print(' '.join(s.split()[1:-1])) c:\Users\Mark\MyPython>a the the the this this the new -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 11:24, Denis McMahon wrote: On Sat, 15 Jun 2013 10:05:01 +, Steven D'Aprano wrote: On Sat, 15 Jun 2013 02:42:55 -0700, subhabangalore wrote: Dear Group, I am trying to search the following pattern in Python. I have following strings: (i)"In the ocean" (ii)"On the ocean" (iii) "By the ocean" (iv) "In this group" (v) "In this group" (vi) "By the new group" . I want to extract from the first word to the last word, where first word and last word are varying. I am looking to extract out: (i) the (ii) the (iii) the (iv) this (v) this (vi) the new . The problem may be handled by converting the string to list and then index of list. No need for a regular expression. py> sentence = "By the new group" py> words = sentence.split() py> words[1:-1] ['the', 'new'] Does that help? I thought OP wanted: words[words[0],words[-1]] But that might be just my caffeine deprived misinterpretation of his terminology. >>> sentence = "By the new group" >>> words = sentence.split() >>> words[words[0],words[-1]] Traceback (most recent call last): File "", line 1, in TypeError: list indices must be integers, not tuple So why would the OP want a TypeError? Or has caffeine deprivation affected your typing skills? :) -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 14:45, Denis McMahon wrote: On Sat, 15 Jun 2013 13:41:21 +, Denis McMahon wrote: first_and_last = [sentence.split()[i] for i in (0, -1)] middle = sentence.split()[1:-2] Bugger! That last is actually: sentence.split()[1:-1] It just looks like a two. I've a very strong sense of deja vu having round the same loop what, two hours ago? Wondering out aloud the number of times a programmer has thought "That's easy, I don't need to test it". How are the mighty fallen. -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 15:31, subhabangal...@gmail.com wrote: Dear Group, I know this solution but I want to have Regular Expression option. Just learning. Regards, Subhabrata. Start here http://docs.python.org/2/library/re.html Would you also please read and action this, http://wiki.python.org/moin/GoogleGroupsPython , 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Scripting Calligra Sheets with Python
On 15/06/2013 16:55, Jim Byrnes wrote: I've read all the docs I can find and worked through a lot of examples but I can't figure out how to shift the focus from one cell to another. Could someone point me to the command or an example of how to do this? Thanks, Jim Have you tried asking here http://www.calligra.org/get-help/ as you were pointed in this direction on the tutor mailing list three months ago? -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 17:28, subhabangal...@gmail.com wrote: You've been pointed at several links, so what have you tried, and what, if anything, went wrong? Or do you simply not understand, in which case please say so and we'll help. I'm not trying to be awkward, it's simply known that you learn more if you try something yourself, rather than be spoon fed it. -- "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
Re: RFD: rename comp.lang.python to comp.support.superhost
On 15/06/2013 18:29, Nick the Gr33k wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας wrote: iam researchign a solution to this as we speak. Spamming endless "ZOMG HELP ME I'M INCOMPETENT" posts isn't "research". -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? A classic example of the pot calling the kettle black. -- "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
Re: Don't feed the troll...
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 <http://kwpolska.tk> | 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On 15/06/2013 18:51, Steven D'Aprano wrote: On Sat, 15 Jun 2013 18:43:42 +0100, Mark Lawrence wrote: A classic example of the pot calling the kettle black. 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. I do apologise Mr. Self Appointed Policeman. Not. -- "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
Re: Pattern Search Regular Expression
On 15/06/2013 22:03, Joshua Landau wrote: On 15 June 2013 11:18, Mark Lawrence wrote: I tend to reach for string methods rather than an RE so will something like this suit you? c:\Users\Mark\MyPython>type a.py for s in ("In the ocean", "On the ocean", "By the ocean", "In this group", "In this group", "By the new group"): print(' '.join(s.split()[1:-1])) c:\Users\Mark\MyPython>a the the the this this the new Careful - " ".join(s.split()) != s Eg: " ".join("s\ns".split()) 's s' It's pedantry, but true. I'm sorry but I haven't the faintest idea what you're talking about. I believe the code I posted works for the OP's needs. If it doesn't please say so. -- "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
Re: Why 'files.py' does not print the filenames into a table format?
On 15/06/2013 20:38, Nick the Gr33k wrote: Thank you and please whoever does not feel like helping, please at least not spam the thread. Your arrogance clearly has no bounds. This is a public forum and people can say what they like. You've wasted enough time as it is, so why don't you simply bugger off. -- "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
Re: Fatal Python error: Py_Initialize: can't initialize sys standard streams
On 15/06/2013 22:29, lucabrasi...@gmail.com wrote: I get this error when I try to save .dxf files in Inkscape: Fatal Python error: Py_Initialize: can't initialize sys standard streams Then it seems to recover but it doesn't really recover. It saves the files and then DraftSite won't open them. Here is what the thing says when Inkscape tried to fix the saving problem. File "D:\Program Files (x86)\Inkscape\python\Lib\encodings\__init__.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax Here are my computer specs if you need them: Tech Support Guy System Info Utility version 1.0.0.2 OS Version: Microsoft Windows 7 Ultimate, Service Pack 1, 64 bit Processor: AMD FX(tm)-6100 Six-Core Processor, AMD64 Family 21 Model 1 Stepping 2 Processor Count: 6 RAM: 16330 Mb Graphics Card: NVIDIA GeForce GTX 560, 1024 Mb Hard Drives: C: Total - 239806 MB, Free - 39808 MB; D: Total - 61553 MB, Free - 46085 MB; F: Total - 1907726 MB, Free - 1461558 MB; Motherboard: ASUSTeK COMPUTER INC., M5A97 Antivirus: avast! Internet Security, Updated and Enabled Any help would be appreciated. I posted on another forum http://forums.techguy.org but no one answered, as of yet anyway. It is kind of weird because they answer everything. So I am assuming only Python users might know. Thank you for considering my problem. Your Python version would help :) How did you install Inkscape? It looks strange to see it in Program Files, I'd normally expect to see it in the site packages directory. -- "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
Re: Don't feed the troll...
On 15/06/2013 22:47, alex23 wrote: 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? +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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Why 'files.py' does not print the filenames into a table format?
On 16/06/2013 02:03, Nick the Gr33k wrote: On 16/6/2013 12:29 πμ, Mark Lawrence wrote: On 15/06/2013 20:38, Nick the Gr33k wrote: Thank you and please whoever does not feel like helping, please at least not spam the thread. Your arrogance clearly has no bounds. Your spamming to my threads in an unproductive and yet bitching way has no bounds either. This is a public forum Yes it is. and people can say what they like. Only if its relative to the OP's question, otherwise its trolling to an other's person thread. You've wasted enough time as it is, so why don't you simply bugger off. The only time i'm wasting is that of folk's trying to respond to my questions. You are the one that wants to waste his time if you take the time and read my posts and also take more time to bitch-respond. I said to you and others before. Kill-file me, or mute my threads or ignore me if you do not like me and my questions. I have no intention of kill-filing you, muting your threads or ignoring you. I do intend hounding you until with any luck you crawl off into a hole somewhere and leave this group in peace. -- "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
Re: A certainl part of an if() structure never gets executed.
On 16/06/2013 11:42, R. Michael Weylandt wrote: Whats the difference of "interpreting " to "compiling" ? If only it could be googled Alas, no one has ever written anything about technology on the internet. Ironic that... Michael I'm very sorry but I don't understand the words "googled" and "internet". Could you please explain them? -- "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
Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]
On 16/06/2013 11:57, Ferrous Cranus wrote: i did Steven that why i asked in the 1st place To post a message to all the list members, send email to python-gre...@python.org. this is not a valid nrewgroup name/ Not valid in the same way that supp...@superhost.gr is not valid? -- "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
Re: A certainl part of an if() structure never gets executed.
On 16/06/2013 12:06, Ferrous Cranus wrote: what id() does, never heard of that function before. what google does, never heard of that function before. -- "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
Re: Why 'files.py' does not print the filenames into a table format?
On 17/06/2013 01:04, alex23 wrote: On Jun 16, 10:10 am, Steven D'Aprano wrote: Congratulation. You have just entered an extremely exclusive club. See you in a month. *plonk* So yours are the only pissy one-liner responses that shouldn't be taken off-list? I suggest caution, Big Brother is watching *YOU* :) -- "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
Re: Don't feed the troll...
On 17/06/2013 15:41, ru...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic if statement
On 18/06/2013 15:56, Tim Chase wrote: On 2013-06-18 07:10, upperdec...@gmail.com wrote: I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. I query fld1, fld2, fld3, qty, qty2 from table1 then I loop thru the results if fld1 = 'a' add qty to some_total1 ... I created a database pair that contains (table1,fld1 = 'a',add qty to some_total1) (table2,fld2 = 'b',qty to some_total1) (table3,fld3 = 'c',qty2 to some_total1) Given the data-structure you have, and that it's hard-coded (rather than able to take dynamic/dangerous user input) for the table-name, I'd do something like this (untested) for tablename, compare_field, compare_value, source_field in ( ("table1", "fld1", "a", "qty"), ("table2", "fld2", "b", "qty"), ("table3", "fld3", "c", "qty2"), ): # using string-building rather than escaping because # 1) we know the tablenames are hard-coded/safe from above, and # 2) this sort of escaping often chokes query parsers query = "SELECT fld1, fld2, fld3, qty, qty2 from %s" % tablename cursor.execute(query) name_index_map = dict( (info[0], i) for info, i in enumerate(cursor.description) Looks like this should be :- for i, info in enumerate(cursor.description) ) for row in cursor.fetchall(): db_value = row[name_index_map[compare_field]] if db_value == compare_value: addend = row[name_index_map[source_field]] some_total_1 += addend -tkc -- "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
Re: Why is regex so slow?
On 18/06/2013 18:08, Roy Smith wrote: On Jun 18, 2013, at 1:01 PM, Skip Montanaro wrote: I don't understand why the first way is so much slower. I have no obvious answers, but a couple suggestions: 1. Can you anchor the pattern at the beginning of the line? (use match() instead of search()) That's one of the things we tried. Didn't make any difference. 2. Does it get faster it you eliminate the "(.*)" part of the pattern? Just tried that, it also didn't make any difference. It seems that if you find a line matching the first part of the pattern, you could just as easily split the line yourself instead of creating a group. At this point, I'm not so much interested in making this faster as understanding why it's so slow. I'm tempted to open this up as a performance bug against the regex module (which I assume will be rejected, at least for the 2.x series). --- Roy Smith r...@panix.com Out of curiousity have the tried the new regex module from pypi rather than the stdlib version? A heck of a lot of work has gone into it see http://bugs.python.org/issue2636 -- "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
Re: Error running xmlrpc Client and server under different Python versions
On 20/06/2013 08:36, stanislav.boriso...@gmail.com wrote: Hello. I need to run xmlrpc Server under Python 3.3 and Client under Python 2.7. But when I try to do so, I receive the following exception: ":global name 'xmlrpclib' is not defined" What is the reason for such an exception. As far as I understand xmlrpc is language independent. Please help. Regards, Slava See http://www.python.org/dev/peps/pep-3108/#xmlrpc-package -- "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
Re: A few questiosn about encoding
On 20/06/2013 17:27, wxjmfa...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Default Value
On 22/06/2013 02:31, Steven D'Aprano wrote: On Sat, 22 Jun 2013 05:07:59 +1000, Chris Angelico wrote: Oh! I know. Function argument defaults will now be restricted to int/float/tuple. That would do it, right? Nobody would be bothered by little restrictions like that, would they. Alas, tuples won't do it. Fortunately, you can include str and bytes (unicode and str) and frozenset in the "Good List". Tuples have to go into the "Bad List" because, although they themselves are immutable, their contents may not be. Imagine the confusion and horror that poor developers will experience when they do something like this: def func(arg, extra=(23, 'foo', [])): [code goes here...] extra[2].append("something") [more code...] and they've now mutated the immutable default! Thinking about this, I think that the only safe thing to do in Rickython 4000 is to prohibit putting mutable objects inside tuples. Putting a list or a dict inside a tuple is just a bug waiting to happen! How about naming the fork RickedPython 4000, where ricked is defined here http://www.urbandictionary.com/define.php?term=ricked ? -- "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
Re: n00b question on spacing
On 22/06/2013 14:36, Joshua Landau wrote: On 21 June 2013 23:26, Gary Herron wrote: On 06/21/2013 02:17 PM, Yves S. Garret wrote: I have the following line of code: log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) <...> I was thinking of splitting it up like so: log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) This is how I'd do it: (And it's *FAR* clearer -- You win no points for clarity by having it all in one statement.) fmt = "Item wrote to MongoDB database %s/%s" msg = fmt % (settings['MONGODB_DB'], settings['MONGODB_COLLECTION']) log.msg(msg, level=log.DEBUG, spider=spider) Hear, Hear. But really, you should be using .format by now :P My favourite way would be along the lines of: message = "Item wrote to MongoDB database " message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) log.msg(message, level=log.DEBUG, spider=spider) I'm sticking with C style formatting, which thankfully isn't going away, .format indeed. -- "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
Re: How can i fix this?
On 22/06/2013 22:31, Борислав Бориславов wrote: while 1: name=raw_input("What is your name? ") if name == "bobi": print "Hello Master!" and break else: print "error" I want if my conditions are met to do a couple of things and i cant do that You most certainly can :) while 1: name=raw_input("What is your name? ") if name == "bobi": print "Hello Master!" print "Why do some people insist on cramming all of their code onto one line?" break else: print "error" -- "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
Re: Is this PEP-able? fwhile
On 24/06/2013 23:30, Tim Chase wrote: On 2013-06-25 07:38, Chris Angelico wrote: Python has no issues with breaking out of loops, and even has syntax specifically to complement it (the 'else:' clause). Use break/continue when appropriate. from minor_gripes import breaking_out_of_nested_loops_to_top_level -tkc Doesn't the goto module http://entrian.com/goto/ fix 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to import NHunspell.dll using ctypes in Python
On 25/06/2013 07:23, akshay.k...@gmail.com wrote: Im required to import ha certain dll called 'NHunspell.dll' which is used for Spell Checking purposes. I am using Python for the software. Although I checked out several websites to properly use ctypes, I have been unable to load the dll properly. When I use this code. from ctypes import * hunspell = cdll.LoadLibrary['Hunspellx64.dll'] I get an error hunspell = cdll.LoadLibrary['Hunspellx64.dll'] TypeError: 'instancemethod' object has no attribute '__getitem__' I guess it might a problem with the structure of the dll. But I have no idea how to import the dll properly. >>> from ctypes import * >>> help(cdll.LoadLibrary) Help on method LoadLibrary in module ctypes: LoadLibrary(self, name) method of ctypes.LibraryLoader instance. So looks as if you need:- hunspell = cdll.LoadLibrary('Hunspellx64.dll') -- "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