Python 3.8 or later on Debian?

2024-09-18 Thread Ulrich Goebel via Python-list
? I'm not a friend of things so deep in the system... Greetings Ulrich -- Ulrich Goebel -- https://mail.python.org/mailman/listinfo/python-list

Difference method vs attribut = function

2024-06-29 Thread Ulrich Goebel via Python-list
unctions to different instances of MyClass. It is in the context of a database app where I build Getters for database data and pass one Getter per instance. Thanks for hints Ulrich -- Ulrich Goebel -- https://mail.python.org/mailman/listinfo/python-list

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
użytkownik Ulrich Goebel napisał: 13. Januar 1965 13. January 1965 13.01.1965 1965-01-13 02.03.2000 Is it Mar, 2nd 2000 or Feb, 3rd 2000? -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
That's absolutely great, thank You! Am 17.12.19 um 11:53 schrieb Jon Ribbens via Python-list: On 2019-12-17, Ulrich Goebel wrote: I need to interpret a date string to get a datetime object. That should be done with strptime from the module datetime. But I don't know enough about

strptime for different languages

2019-12-17 Thread Ulrich Goebel
e possible languages.) Best regards Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
Sorry for the wrong spelling. In fact subprocess.call('./Test.py') works. The raising error was my error too, using ['./', 'Test.py'] instead of './Test.py' Sorry... Am 28.11.19 um 11:05 schrieb Ulrich Goebel: Hi, I have to call commands fro

os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
session) File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) PermissionError: [Errno 13] Permission denied Using subprocess.call(['./', 'Test.py'], shell=True) I get Test.py: 1: Test.py: ./: Permission d

Function to call a extern command as a filter

2019-09-25 Thread Ulrich Goebel
read the outputfile into the string l return (l) What would be nice: I would like to avoid the extra steps writing an reading extern files. Can anybody help me? Thanks Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Escape-Sequenzen in einem String identifizieren

2017-10-01 Thread Ulrich Goebel
herauszufinden, suche ich eine Funktion zeige_escape(string), die mir liefert: s = 'Hallo\nNeue Zeile' zeige_escape(s) Hallo\nNeue Zeile print hilft nicht, denn print(s) Hallo Neue Zeile Hat jemand eine Idee? Dank und Gruß Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bon

Re: Making Labels from python

2014-03-09 Thread Ulrich Goebel
Many thanks for the moment. I will try reportlab the next days. Am 09.03.2014 22:29, schrieb Ulrich Goebel: Hallo, has anybody an idea how to make small formated documents redy to print with python? I would like to print address labels as firstname lastname street and number cip

Making Labels from python

2014-03-09 Thread Ulrich Goebel
pagesize (labelsize) and a minimum format (boldface). But may be there is another light-weight-format besides PDF? Any idea? Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Trouble with utf-8 values

2013-11-04 Thread Ulrich Goebel
e byte 0xc3 in position 6: ordinal not in range(128) The "position 6" is exactly the position of the special character, ß in this case. What to do? Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: "Backward"-Iterator - Beginners question

2013-11-01 Thread Ulrich Goebel
Hi Am 31.10.2013 23:35, schrieb Terry Reedy: On 10/31/2013 5:29 PM, Ulrich Goebel wrote: I'm locking for an "iterator" type with not only the .next() method, but with a .previous(), .first() and .last() method, so that I can through it from the beginning or from the e

"Backward"-Iterator - Beginners question

2013-10-31 Thread Ulrich Goebel
ward, two steps forward). Any help will be wellcome! Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: sorting german characters äöü... solved

2013-10-30 Thread Ulrich Goebel
idecode does - and what it doesn't. There is also a rather long-ish recent topic on a similar topic that might be worth scanning as well. Sorry, I didn't find that. I've no direct/recent experience with this topic. I'm just an interested bystander. But even a helpful bys

sorting german characters äöü...

2013-10-30 Thread Ulrich Goebel
return r def compare (a, b): aa = normal(a) bb = normal(b) if aa < bb: return -1 elif aa == bb: return 0 else: return 1 That works, but my be there is a more intelligent way? Especially there could be much more r.replace to handle all the accents as ^ ° ´ ` and so on.

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ulrich Eckhardt
Am 28.08.2013 13:55, schrieb Ferrous Cranus: Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. of cours ei ahve write permissions. Here: ni...@superh

Re: Basic Python Query

2013-08-23 Thread Ulrich Eckhardt
Am 23.08.2013 05:28, schrieb Steven D'Aprano: On Thu, 22 Aug 2013 13:54:14 +0200, Ulrich Eckhardt wrote: When the Python object goes away, it doesn't necessarily affect thethread or file it represents. > That's certainly not true with file objects. When the file object goes

Re: Basic Python Query

2013-08-22 Thread Ulrich Eckhardt
Am 21.08.2013 20:58, schrieb Johannes Bauer: On 21.08.2013 11:11, Ulrich Eckhardt wrote: That said, there is never a need for deriving from the Thread class, you can also use it to run a function without that. That way is IMHO clearer because the threading.Thread instance is not the thread

Re: Basic Python Query

2013-08-21 Thread Ulrich Eckhardt
Am 21.08.2013 08:50, schrieb chandan kumar: class Test(threading.Thread): def StartThread(self): Lock = threading.Lock() self.start() Inconsistently indented code, this is a killer for Python. Please read PEP8 and use four spaces! That said, there is never a need for de

Re: Module for dialoging with intercative programs, sockets, files, etc.

2013-08-06 Thread Ulrich Eckhardt
Am 05.08.2013 21:38, schrieb Olive: I have found telnetlib which make very easy to interact with a telnet server, especially the read_until command. I wonder if something similar exits for other things that a telnet server. It's not Python and I haven't played with it extensively, but there is

Re: outputting time in microseconds or milliseconds

2013-08-05 Thread Ulrich Eckhardt
Am 02.08.2013 15:17, schrieb matt.doolittl...@gmail.com: so you are saying that self.logfile.write('%s\t'%(str(time( should be: self.logfile.write('%s\t'%(str(time.time( No, I'm not saying that. What I wanted to make clear is that your code is impossible to understand as it

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Ulrich Eckhardt
Am 02.08.2013 12:54, schrieb matt.doolittl...@gmail.com: I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with the microseconds.[...] # write date and time and microseocnds self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", self.logfile.write(

Re: Python script help

2013-08-02 Thread Ulrich Eckhardt
Am 01.08.2013 18:02, schrieb cool1...@gmail.com: I know I should be testing out the script myself but I did, I tried and since I am new in python and I work for a security firm that ask me to scan hundreds of documents a day for unsafe links (by opening them) I thought writing a script will be mu

Re: Python script help

2013-07-30 Thread Ulrich Eckhardt
Am 30.07.2013 16:49, schrieb cool1...@gmail.com: Hello, I am looking for a script that will be able to search an online document (by giving the script the URL) and find all the downloadable links in the document and then download them automatically. Well, that's actually pretty simple. Using th

Re: Bitwise Operations

2013-07-30 Thread Ulrich Eckhardt
Am 30.07.2013 01:34, schrieb Devyn Collier Johnson: Typing "101 & 010" or "x = (int(101, 2) & int(010, 2))" only gives errors. What errors? Check out Eric Raymond's essay on asking smart questions, it's a real eye-opener! ;) That said, use "0b" as prefix for binary number literals (0b1000 is

Re: Callable or not callable, that is the question!

2013-07-12 Thread Ulrich Eckhardt
Am 11.07.2013 16:11, schrieb Peter Otten: Ulrich Eckhardt wrote: Bug or feature? No bug. Missing feature if you come up with a convincing use-case. class Parser: def _handle_bool(input): # ... pass types = {'bool': _handle_bool, 'boolean

Callable or not callable, that is the question!

2013-07-11 Thread Ulrich Eckhardt
Hello! I just stumbled over a case where Python (2.7 and 3.3 on MS Windows) fail to detect that an object is a function, using the callable() builtin function. Investigating, I found out that the object was indeed not callable, but in a way that was very unexpected to me: class X:

Re: Kivy for Python 3.3

2013-07-11 Thread Ulrich Eckhardt
Welcome to Python! Am 11.07.2013 11:09, schrieb fronag...@gmail.com: I'm looking to write a program in Python, (and have in fact written most of it by now,) and am trying to put together a GUI for it. Kivy looks very nice, particularly with the fact that it's supposed to be compatible with most

Re: How to clean up socket connection to printer

2013-07-09 Thread Ulrich Eckhardt
Am 09.07.2013 11:39, schrieb loial: I have a socket application that is connecting to a HP printer via port 9100. Occassionally I get a "Connection reset by peer" error which I am trapping and exiting the script with an error message. Strange. Why does the remote terminate the connection? T

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-07-04 Thread Ulrich Eckhardt
Am 04.07.2013 12:38, schrieb Νίκος: Στις 4/7/2013 12:50 μμ, ο/η Ulrich Eckhardt έγραψε: Am 04.07.2013 10:37, schrieb Νίκος: Why cant it decode the starting byte? what starting byte is that? It's the 0xb6 but it's expecting the starting byte of a UTF-8 sequence. Please do some resea

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-07-04 Thread Ulrich Eckhardt
Am 04.07.2013 10:37, schrieb Νίκος: I just started to have this error without changing nothing Well, undo the nothing that you didn't change. ;) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte [Thu Jul 04 11:35:14 2013] [error] [client 108.162.229.97

Re: Writing Extensions for Python 3 in C

2013-06-19 Thread Ulrich Eckhardt
Am 18.06.2013 12:24, schrieb Aditya Avinash: Hi. This is the last place where I want to ask a question. You are probably not saying what you mean here. The meaning of your sentence is more like "Here is the forum that I dislike more than any other forum, but still I have to ask a question her

Re: A few questiosn about encoding

2013-06-12 Thread Ulrich Eckhardt
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 follo

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Ulrich Eckhardt
Am 11.06.2013 12:38, schrieb Νικόλαος Κούρας: File "/home/nikos/public_html/cgi-bin/metrites.py", line 28, in , referer: http://xxxredactedxxx/ page = page.replace( '/home/nikos/public_html/', '' ), referer: http://xxxredactedxxx/ AttributeError: 'list' object has no attribute 'replace', ref

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 15:37, schrieb Νικόλαος Κούρας: Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: for key in sorted

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 11:48, schrieb Νικόλαος Κούρας: After many tried this did the job: for key in sorted(months.items(),key=lambda num : num[1]): print(''' %s ''' % (key[1], key[0]) ) This code is still sending a misleading message. What you are referring to as "ke

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: >Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: for key in sorted( months.keys() ): print(''' %s ''' % (months[key], key) ) this in fact wor

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 10:04, schrieb Νικόλαος Κούρας: months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } for key in sorted( months.keys() ): =

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 10:29, schrieb Νικόλαος Κούρας: for key in sorted( months.values() ): ^^^ ^^ KeyError 1 ??!! All i did was to tell python to sort the dictionary values, which are just integers. ...and which you then proceed to use as key, which is obviously wrong.

Re: I want to know how to implement concurrent threads in Python

2013-05-28 Thread Ulrich Eckhardt
Am 26.05.2013 21:10, schrieb Daniel Gagliardi: I want to know how to implement concurrent threads in Python Have you tried searching the web or maybe looked on docs.python.org? Seriously, show at least some effort before asking here. Uli -- http://mail.python.org/mailman/listinfo/python-lis

Re: subclassing from unittest

2013-05-23 Thread Ulrich Eckhardt
Am 22.05.2013 17:32, schrieb Charles Smith: I'd like to subclass from unittest.TestCase. I observed something interesting and wonder if anyone can explain what's going on... some subclasses create null tests. I can perhaps guess what's going on, though Terry is right: Your question isn't ver

Re: Fractal

2013-05-16 Thread Ulrich Eckhardt
Am 16.05.2013 02:00, schrieb alex23: My favourite is this one: http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python Not only is this blog entry an interesting piece of art, there's other interesting things to read there, too. Thanks! Uli -- http://mail.python.org/m

Re: percent faster than format()?

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 10:26, schrieb Chris “Kwpolska” Warrick: On Tue, Apr 23, 2013 at 9:46 AM, Ulrich Eckhardt wrote: Am 23.04.2013 06:00, schrieb Steven D'Aprano: If it comes down to micro-optimizations to shave a few microseconds off, consider using string % formatting rather than the f

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 09:13, schrieb inshu chauhan: This statement is giving me the following error Statement: for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(), pixel_count.iterkeys())): Error: Traceback (most recent call last): File "C:\Users\inshu\Desktop\Training_segs_trial2.

percent faster than format()? (was: Re: optomizations)

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 06:00, schrieb Steven D'Aprano: If it comes down to micro-optimizations to shave a few microseconds off, consider using string % formatting rather than the format method. Why? I don't see any obvious difference between the two... Greetings! Uli -- http://mail.python.org/mailma

Re: name lookup failure using metaclasses with unittests

2013-04-12 Thread Ulrich Eckhardt
Am 11.04.2013 10:19, schrieb Steven D'Aprano: if sys.version >= '3': Use sys.version_info >= (3,), otherwise your code breaks when upgrading to Python 10 and greater. ;^) The second question that came up was if there is a way to keep a metaclass defined inside the class or if the only way

Re: name lookup failure using metaclasses with unittests

2013-04-11 Thread Ulrich Eckhardt
Am 10.04.2013 11:52, schrieb Peter Otten: It looks like this particular invocation relies on class attribute and function __name__ being identical. Please file a bug report. http://bugs.python.org/issue17696 Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: name lookup failure using metaclasses with unittests

2013-04-11 Thread Ulrich Eckhardt
Am 10.04.2013 11:52, schrieb Peter Otten: Ulrich Eckhardt wrote: [...] It looks like this particular invocation relies on class attribute and function __name__ being identical. Please file a bug report. Thanks for confirming this and reducing the test case even more. Now, concerning

name lookup failure using metaclasses with unittests

2013-04-10 Thread Ulrich Eckhardt
Hi! I'm having problems using a metaclass to generate test functions. This works when I try to run all tests from the module or test case, but it fails when I'm trying to specify a single test function. My environment is Python 2.7.3 on MS Windows 7 at the moment. It should be upgraded to at

Re: Sudoku

2013-03-27 Thread Ulrich Eckhardt
Am 27.03.2013 06:44, schrieb Eric Parry: I downloaded the following program from somewhere using a link from Wikipedia and inserted the “most difficult Sudoku puzzle ever” string into it and ran it. It worked fine and solved the puzzle in about 4 seconds. However I cannot understand how it works.

Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-04 Thread Ulrich Eckhardt
Am 01.03.2013 17:28, schrieb Isaac Won: What I really want to get from this code is m1 as I told. For this purpose, for instance, values of fpsd upto second loop and that from third loop should be same, but they are not. Actually it is my main question. You are not helping yourself... In any

Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Ulrich Eckhardt
Am 01.03.2013 09:59, schrieb Isaac Won: try to make my triple nested loop working. My code would be: c = 4 [...] while c <24: c = c + 1 This is bad style and you shouldn't do that in python. The question that comes up for me is whether something else is modifying "c" in that loop,

Re: Awsome Python - chained exceptions

2013-02-15 Thread Ulrich Eckhardt
Am 15.02.2013 08:51, schrieb Rick Johnson: "How could a line in the "try" block ever be considered offensive?" My suggestion of "offensive" does not imply ignorance on /my/ part[...] Well, it seems to imply that you are not aware of the subtle difference between "offending" and "offensive".

Re: Awsome Python - chained exceptions

2013-02-14 Thread Ulrich Eckhardt
Am 13.02.2013 um 17:14 schrieb Rick Johnson: Q1: How could a line in the "try" block ever be considered offensive? Because it throws an error? try: rrick.go_and_fuck_yourself() finally: rrick.get_lost() See, wasn't that difficult, was it? :D Are you serious? No, I just coul

Re: Is Python programming language?

2013-02-08 Thread Ulrich Eckhardt
Am 08.02.2013 14:03, schrieb gmspro: One said, Python is not programming language, rather scripting language, is that true? That depends on your definition of scripting language and programming language. Python's not a language but an animal. Uli -- http://mail.python.org/mailman/listinfo

Re: which situations should we use thread. join() ?

2013-02-08 Thread Ulrich Eckhardt
Am 08.02.2013 07:29, schrieb Chris Angelico: On Fri, Feb 8, 2013 at 3:32 PM, iMath wrote: which situations should we use thread. join() ? http://bpaste.net/show/yBDGfrlU7BDDpvEZEHmo/ why do we not put thread. join() in this code ? I've no idea why you don't put thread.join() in that code. M

Re: puzzled by name binding in local function

2013-02-07 Thread Ulrich Eckhardt
Heureka! Am 06.02.2013 15:37, schrieb Dave Angel: > def myfunc2(i): def myfunc2b(): print ("myfunc2 is using", i) return myfunc2b Earlier you wrote: There is only one instance of i, so it's not clear what you expect. Since it's not an argument to test(), it has to be found

Re: puzzled by name binding in local function

2013-02-06 Thread Ulrich Eckhardt
Dave and Terry, Thanks you both for your explanations! I really appreciate the time you took. Am 05.02.2013 19:07, schrieb Dave Angel: If you need to have separate function objects that already know a value for i, you need to somehow bind the value into the function object. One way to do it,

puzzled by name binding in local function

2013-02-05 Thread Ulrich Eckhardt
Hello Pythonistas! Below you will find example code distilled from a set of unit tests, usable with Python 2 or 3. I'm using a loop over a list of parameters to generate tests with different permutations of parameters. Instead of calling util() with values 0-4 as I would expect, each call uses

Re: Opinion on best practice...

2013-02-05 Thread Ulrich Eckhardt
Am 05.02.2013 11:35, schrieb Peter Otten: Ulrich Eckhardt wrote: [...] use os.path.walk(), because that doesn't first build a list and then iterate over the list but iterates over the single elements directly. [...] Not true. os.walk() uses os.listdir() internally. Oh. 8| Thank

Re: autoflush on/off

2013-02-05 Thread Ulrich Eckhardt
Am 05.02.2013 01:09, schrieb Jabba Laci: I like the context manager idea There is a helper library for constructing context managers, see http://docs.python.org/2/library/contextlib.html. That would have made your code even shorter. setting the sys.stdout back to the original value doesn

Re: Opinion on best practice...

2013-02-05 Thread Ulrich Eckhardt
Am 05.02.2013 05:14, schrieb Anthony Correia: I need to pick up a language that would cover the Linux platform. I use Powershell for a scripting language on the Windows side of things. Very simple copy files script. Is this the best way to do it? import os objdir = ("C:\\temp2") Dro

Re: autoflush on/off

2013-02-04 Thread Ulrich Eckhardt
Am 04.02.2013 18:12, schrieb Jabba Laci: autoflush_on = False def unbuffered(): """Switch autoflush on.""" global autoflush_on # reopen stdout file descriptor with write mode # and 0 as the buffer size (unbuffered) if not autoflush_on: sys.stdout = os.fdopen(sys

Re: monolithic apps

2013-01-24 Thread Ulrich Eckhardt
Am 24.01.2013 18:06, schrieb tamn...@gmail.com: Any suggestions for study?..: Is is possible to take a large executable with GUI and real time data and images, to extract modules, and it can run as if it looks like a monolithic application (windows over main windows, or images over other images)

Re: Memory error with quadratic interpolation

2013-01-23 Thread Ulrich Eckhardt
Am 23.01.2013 05:06, schrieb Isaac Won: I have tried to use different interpolation methods with Scipy. My code seems just fine with linear interpolation, but shows memory error with quadratic. I am a novice for python. I will appreciate any help. > #code f = open(filin, "r") Check out the "w

Re: need explanation

2013-01-21 Thread Ulrich Eckhardt
Am 21.01.2013 17:06, schrieb kwakukwat...@gmail.com: please I need some explanation on sys.stdin and sys.stdout, and piping out http://www.catb.org/esr/faqs/smart-questions.html Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: interrupt the file sending if the file size over the quota...some errors here...

2013-01-15 Thread Ulrich Eckhardt
Am 15.01.2013 10:46, schrieb Levi Nie: i want to interrupt the file sending. but i can't change the client. so i need change the server. All things go well, but the message i wanna response seem not work. Ahem, what? It doesn't work, so does it sit on the couch all day? is the self.transport

Re: unit selection problem

2013-01-15 Thread Ulrich Eckhardt
Am 14.01.2013 21:29, schrieb Paul Pittlerson: map_textures = get_sprites( (48, 48) ,"spritesheet.png" , (0, 0) ) You forgot to include spritesheet.png in your message. Seriously, condense your code down to a minimal example. This might help you finding the problem yourself, otherwise

Re: new to python and programming at large

2013-01-09 Thread Ulrich Eckhardt
Am 09.01.2013 22:05, schrieb kwakukwat...@gmail.com: pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. Whenever describing an error, be precise. In this particular case, we have some sourcecode (which is good!) but what is still missin

Re: Problem with calling function from dll

2012-12-13 Thread Ulrich Eckhardt
Am 13.12.2012 08:40, schrieb deep...@poczta.fm: I have problem with using function from dll. import ctypes b = ctypes.windll.LoadLibrary("kernel32") a = "" b.GetComputerNameA(a,20) GetComputerNameA takes a pointer to a writable char string. You give it a pointer to an immutable string. You

Re: Error .. Please Help

2012-12-12 Thread Ulrich Eckhardt
Am 12.12.2012 16:00, schrieb inshu chauhan: color = image[y,x] if color == (0.0,0.0,0.0): continue else : if color == (0.0,255.0,0.0): classification = 1 elif color == (128.0, 0.0, 255.0): classifi

Re: amazing scope?

2012-11-30 Thread Ulrich Eckhardt
Am 30.11.2012 12:11, schrieb andrea crotti: I wrote a script, refactored it and then introducing a bug as below: def record_things(): out.write("Hello world") This is a function. Since "out" is not a local variable, it is looked up in the surrounding namespace at the time the function is

Re: How to create an executable from python script in windows

2012-11-28 Thread Ulrich Eckhardt
Am 28.11.2012 07:43, schrieb Prakash: copying C:\Python24\lib\site-packages\py2exe\run_w.exe Python 2.4 was released 8 years ago and shouldn't be used for new development or learning any longer. The first step I would take is to upgrade to 2.7, which is the last in the 2

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Ulrich Eckhardt
Am 21.11.2012 02:43, schrieb Steven D'Aprano: On Tue, 20 Nov 2012 20:07:54 +, Robert Kern wrote: The source of bugs is not excessive complexity in a method, just excessive lines of code. Taken literally, that cannot possibly the case. def method(self, a, b, c): do_this(a) do_tha

Re: Point of idle curiosity

2012-11-19 Thread Ulrich Eckhardt
Am 18.11.2012 12:45, schrieb Chris Angelico: (if you'll forgive the pun) Nevarr! Is IDLE named after Eric of that name, or is it pure coincidence? Maybe. Interestingly, there is also http://eric-ide.python-projects.org/, just to add some more unfounded conspiracy theories to this discuss

Re: editing conf file

2012-11-16 Thread Ulrich Eckhardt
Am 16.11.2012 13:06, schrieb chip9munk: I would like to use conf file to get all the variables in my code. And it works great. I use the following (simple example): execfile("example.conf", config) print config["value1"] and it works like a charm. This works, but in general importing con

Re: debugging in eclipse

2012-11-15 Thread Ulrich Eckhardt
Am 15.11.2012 13:29, schrieb chip9m...@gmail.com: I have a python module, lets call it debugTest.py. and it contains: def test(): a=1 b=2 c=a+b c so as simple as possible. Should that be "return c" instead of "c" on a line? Now I would like to debug it in eclipse.. (I h

Re: Supported Platforms for Python

2012-11-14 Thread Ulrich Eckhardt
Am 14.11.2012 10:51, schrieb Kiran N Mallekoppa: 1. Is this information available somewhere? 2. I was pointed to PEP-11, which documents the platforms that are not supported. So, can we take that all active versions of Python (2.7.3 and 3.3, i believe) are supported on all the OS flavors that Pyt

Re: int.__init__ incompatible in Python 3.3

2012-11-12 Thread Ulrich Eckhardt
Am 09.11.2012 12:37, schrieb Steven D'Aprano: In Python 3.3: py> class X(int): ... def __init__(self, *args): ... super().__init__(*args) # does nothing, call it anyway ... py> x = X(22) Traceback (most recent call last): File "", line 1, in File "", line 3, in __init__ TypeE

Re: Strange object identity problem

2012-11-12 Thread Ulrich Eckhardt
Am 12.11.2012 14:12, schrieb F.R.: Once in a while I write simple routine stuff and spend the next few hours trying to understand why it doesn't behave as I expect. Here is an example holding me up: [...snip incomplete code...] Trying something similar with a simpler class works as expected: [

Re: List comprehension for testing **params

2012-11-12 Thread Ulrich Eckhardt
Am 11.11.2012 23:24, schrieb Cantabile: I'm writing a small mail library for my own use, and at the time I'm testing parameters like this: Let's ignore the facts that there is an existing mail library, that you should use real parameters if they are required and that exit() is completely inap

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 09.11.2012 12:37, schrieb Steven D'Aprano: On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote: Or, do you suggest I don't call super().__init__()? That would seem unclean to me. On the contrary: calling super().__init__ when the superclass does something you don't wa

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 08.11.2012 21:29, schrieb Terry Reedy: On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt wrote: On 3.3, it gives me a "TypeError: object.__init__() takes no parameters". To some extent, this makes sense to me, because the int subobject is not initialized in __init__ but in __n

int.__init__ incompatible in Python 3.3

2012-11-08 Thread Ulrich Eckhardt
Hi! Preparing for an upgrade from 2.7 to 3, I stumbled across an incompatibility between 2.7 and 3.2 on one hand and 3.3 on the other: class X(int): def __init__(self, value): super(X, self).__init__(value) X(42) On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeErr

isinstance(.., file) for Python 3

2012-11-08 Thread Ulrich Eckhardt
Hi! I have two problems that are related and that I'd like to solve together. Firstly, I have code that allows either a file or a string representing its content as parameter. If the parameter is a file, the content is read from the file. In Python 2, I used "isinstance(p, file)" to determine

Re: accepting file path or file object?

2012-11-05 Thread Ulrich Eckhardt
Am 05.11.2012 11:54, schrieb andrea crotti: Quite often I find convenient to get a filename or a file object as argument of a function, and do something as below: def grep_file(regexp, filepath_obj): """Check if the given text is found in any of the file lines, take a path to a file or

surprising += for lists

2012-11-04 Thread Ulrich Eckhardt
Hi everybody! I was just smacked by some very surprising Python 2.7 behaviour. I was assembling some 2D points into a list: points = [] points += (3, 5) points += (4, 6) What I would have expected is to have [(3, 5), (4, 6)], instead I got [3, 5, 4, 6]. My interpretations thereof is that th

Re: Proper place for everything

2012-11-02 Thread Ulrich Eckhardt
Am 02.11.2012 12:20, schrieb Jason Benjamin: Anybody know of the appropriate place to troll and flame about various Python related issues? I'm kind of mad about some Python stuff and I need a place to vent where people may or may not listen, but at at least respond. Thought this would be a stra

Re: Organisation of python classes and their methods

2012-11-02 Thread Ulrich Eckhardt
Am 02.11.2012 09:08, schrieb Martin Hewitson: On 2, Nov, 2012, at 08:38 AM, Paul Rubin wrote: Martin Hewitson writes: So, is there a way to put these methods in their own files and have them 'included' in the class somehow? ... Is there an official python way to do this? I don't like having s

Re: Organisation of python classes and their methods

2012-11-02 Thread Ulrich Eckhardt
Am 02.11.2012 09:20, schrieb Martin Hewitson: Well, here we disagree. Suppose I have a class which encapsulates time-series data. Below is a list of the absolute minimum methods one would have to process that data. [...] > 'abs' 'acos' 'asin' 'atan' 'atan2' 'average' 'cohere' 'conv' 'corr' > 'co

Re: calling one staticmethod from another

2012-10-31 Thread Ulrich Eckhardt
Am 30.10.2012 18:23, schrieb Jean-Michel Pichavant: - Original Message - [snip] I haven't figured out the justification for staticmethod, http://en.wikipedia.org/wiki/Namespace + "Namespaces are one honking great idea -- let's do more of those!" Someone may successfully use only modul

Re: calling one staticmethod from another

2012-10-30 Thread Ulrich Eckhardt
Am 30.10.2012 14:47, schrieb Dave Angel: I'd think the obvious solution is to move both the functions outside of the class. I haven't figured out the justification for staticmethod, except for java or C++ converts. Although I come from a C++ background, I think static functions have solid rea

calling one staticmethod from another

2012-10-30 Thread Ulrich Eckhardt
Hi! I can call a staticmethod f() of class C like "C.f()" or with an instance like "C().f()". Inside that staticmethod, I have neither the class (at least not the original one) nor do I have an instance, so I can't call a different staticmethod from the same class. The obvious solution is to

Re: Help understanding an Object Oriented Program example

2012-10-29 Thread Ulrich Eckhardt
Am 29.10.2012 00:30, schrieb goldtech: class Contact: all_contacts = [] def __init__(self, name, email): self.name = name self.email = email Contact.all_contacts.append(self) Okay, a class that automatically registers all instances in a central list. OK,

better way for ' '.join(args) + '\n'?

2012-10-26 Thread Ulrich Eckhardt
Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least as expressive as any alternative. What I have now is a case where I'm assembling lines of text for driving a pro

Re: bad httplib latency due to IPv6 use

2012-10-17 Thread Ulrich Eckhardt
Some updates on the issue: The etc/hosts file contains the following lines: # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost As I understand it, those effectively mean that localhost is not resolved via this hosts fil

bad httplib latency due to IPv6 use

2012-10-17 Thread Ulrich Eckhardt
Hi! I noticed yesterday that a single HTTP request to localhost takes roughly 1s, regardless of the actually served data, which is way too long. After some digging, I found that the problem lies in socket.create_connection(), which first tries the IPv6 ::1 and only then tries the IPv4 127.0.0

portable unicode literals

2012-10-15 Thread Ulrich Eckhardt
Hi! I need a little nudge in the right direction, as I'm misunderstanding something concerning string literals in Python 2 and 3. In Python 2.7, b'' and '' are byte strings, while u'' is a unicode literal. In Python 3.2, b'' is a byte string and '' is a unicode literal, while u'' is a syntax

Re: an error in python lib?

2012-10-12 Thread Ulrich Eckhardt
Am 12.10.2012 00:06, schrieb Wenhua Zhao: On Wed, Oct 10, 2012 at 12:21 PM, Ian Kelly wrote: Can you demonstrate an API bug that is caused by this? A simple demo of this error is: [...] print "in main cv._is_owned: ", cv._is_owned() That is kind of cheating, because as far as I can t

  1   2   3   4   5   >