Re: max(), sum(), next()

2008-09-03 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: You are right in that sum could be used to sum arbitrary objects. However, in 99.99% of

Re: Function decorators

2008-09-04 Thread Laszlo Nagy
Aigars Aigars wrote: Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? The code in attachment. Thank you, Aigars -- http://mail.python.org/mail

Re: universal unicode font for reportlab

2008-09-08 Thread Laszlo Nagy
Laszlo Nagy <[EMAIL PROTECTED]> writes: I could not find any free TTF font that can do latin1, latin2, arabic, chinese and other languages at the same time. Is there a single font that is able to handle these languages? The GNU Unifont http://en.wikipedia.org/wiki/GNU_Unifont

universal unicode font for reportlab

2008-09-08 Thread Laszlo Nagy
I need to create multi lingual invoices from reportlab. I think it is possible to use UTF 8 strings but there is a problem with the font. I could not find any free TTF font that can do latin1, latin2, arabic, chinese and other languages at the same time. Is there a single font that is able to h

Re: universal unicode font for reportlab

2008-09-08 Thread Laszlo Nagy
The GNU Unifont http://en.wikipedia.org/wiki/GNU_Unifont> http://unifoundry.com/unifont.html> covers an impressive range of the Unicode Basic Multilingual Plane. Unifont is originally a bitmap font, but was recently made available in TrueType format http://www.lgm.cl/trabajos/unifont/index.en

Re: universal unicode font for reportlab

2008-09-08 Thread Laszlo Nagy
Iain Dalton wrote: Why don't you want to use multiple typefaces? Many programs that deal with multilingual strings use multiple fonts (cf. any Web browser and Emacs). You are right, but these PDF documents will show mixed strings. The end user can enter arbitrary strings into the database, a

Re: universal unicode font for reportlab

2008-09-10 Thread Laszlo Nagy
Ross Ridge wrote: Terry Reedy <[EMAIL PROTECTED]> wrote: Sorry, I posted the wrong name. Ariel Unicode MS is the one that seems pretty complete. ... From the MS, I would guess that is a Windows font too ;-). It's made by Microsoft, but it's not a standard Windows font. I th

Re: Best IDE for Python?

2006-04-03 Thread Szabolcs Nagy
ide unification effort: http://pyxides.stani.be/ (there are some useful links and it's more recent than the python.org wiki) -- http://mail.python.org/mailman/listinfo/python-list

Portable way to tell if a process is still alive

2009-12-29 Thread Laszlo Nagy
Suppose we have a program that writes its process id into a pid file. Usually the program deletes the pid file when it exists... But in some cases (for example, killed with kill -9 or TerminateProcess) pid file is left there. I would like to know if a process (given with its process id) is stil

Re: Python OOP Problem

2009-12-29 Thread Laszlo Nagy
Thanks for reply, but it doesn't fit to my task. If I will add later other objects(and it will be very often) - I should stop the service, but that would be very bad. I think you meant "if you add other classes". I'm not sure, if this is solution, but test passed: myimportmod = __import__(

Re: Portable way to tell if a process is still alive

2010-01-28 Thread Laszlo Nagy
Suppose we have a program that writes its process id into a pid file. Usually the program deletes the pid file when it exists... But in some cases (for example, killed with kill -9 or TerminateProcess) pid file is left there. I would like to know if a process (given with its process id) is st

Re: Q: sort's key and cmp parameters

2009-10-01 Thread Laszlo Nagy
Is this a homework? Challenge: to come up with a sorting task that cannot be achieved by passing to the sort method (or sorted function) suitable values for its key and reverse parameters, but instead *require* giving a value to its cmp parameter. Let me put up this question: how do you defin

AJAX Widget Framework

2009-10-01 Thread Laszlo Nagy
I'm looking for an open source, AJAX based widget/windowing framework. Here is what I need: - end user opens up a browser, points it to a URL, logs in - on the server site, sits my application, creating a new session for each user that is logged in - on the server site, I create windows(frames)

Re: Q: sort's key and cmp parameters

2009-10-01 Thread Laszlo Nagy
can be achieved (to a very good approximation at least) with scrambled = some_list.sort(key=lambda x: random()) Is there a real-life sorting task that requires (or is far more efficient with) cmp and can't be easily achieved with key and reverse? The core developers don't think there is

Re: Customizing Option Elements

2009-10-03 Thread Laszlo Nagy
I want to create elements within a element in which I could insert html, which, of course, is illegal (don't tell the police ;) so I'm looking at recreating the form elements using my own customized elements, that is, hacking the equivalent from scratch, but how do I proceed? I would like t

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Laszlo Nagy
Ulrich Eckhardt írta: Hi! I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then start the new thread on it: t = threading.Thread(target=my_fu

Re: No threading.start_new_thread(), useful addition?

2009-10-09 Thread Laszlo Nagy
I personally find it much cleaner this way. Also, why should any code care in which thread it is executed? Why should I have to derive a class from some other only because I want to run one of its functions in a separate thread? I think you are right! Especially that you can (and probably wi

Re: Persistent Distributed Objects

2009-10-09 Thread Laszlo Nagy
I've seen evidence about this being done wrt what looks like insanely complex stuff on this list but I'm wondering if there is something to do this with any number of nodes and just farm out random classes/objects to them? Designing and opreating distributed systems is a complex thing. Esp

Re: Persistent Distributed Objects

2009-10-10 Thread Laszlo Nagy
Sorry about being interpreted as being vague. You wasn't vague. I'm sorry! `et me try to narrow it down. program a creates objects b c d which each need to use 1 disk space 2 ram 3 processor time. I would like to create a checkpoint which would save the work of the object to be later used a

Re: No threading.start_new_thread(), useful addition?

2009-10-10 Thread Laszlo Nagy
Christian Heimes wote: Laszlo Nagy wrote: IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation. You are entitled to your opinion but I STRONGLY recommend against your decorator. You MUST

Re: id( ) function question

2009-10-14 Thread Laszlo Nagy
Andre Engels schrieb: What is going on is that a few objects that are often used, in particular the small (how small is small depends on the implementation) integers, are 'preloaded'. When one of these is then referred to, a new object is not created, but the pre-defined object is used. 10 i

Re: id( ) function question

2009-10-15 Thread Laszlo Nagy
The built-ins aren't mutable, and the singletons are each immutable and/or unique; so in no case do objects that are both different and mutable have the same ID. I know. :-) Although I have no idea how it is that `id({}) == id({})` as a prior posted showed; FWIW, I can't manage to reproduce

Re: id( ) function question

2009-10-15 Thread Laszlo Nagy
Christian Heimes írta: Chris Rebert wrote: The built-ins aren't mutable, and the singletons are each immutable and/or unique; so in no case do objects that are both different and mutable have the same ID. Correct, the fact allows you to write code like "type(egg) is str" to check if an

Re: id( ) function question

2009-10-15 Thread Laszlo Nagy
None, True, False, integers and strings are not mutable. The only time the id is the "same" between two objects is if they are the identical two objects. I'm aware of that. ;-) CPython just (as a performance optimization) re-uses the same objects sometimes even if people think they're usi

how to zip a StringIO object?

2009-10-28 Thread Nagy Viktor
Hi, I try to run the following code: def generate_zip(object_list, template): result = StringIO.StringIO() zipped = zipfile.ZipFile(result, "w") for object in object_list: pdf = generate_pdf(object, template) if not pdf: raise IOError("Problem with generati

Editor for Python

2010-02-05 Thread Laszlo Nagy
Hi All, I know that this question was put up on this list a thousand times. I know that most of the editors are listed here: http://wiki.python.org/moin/PythonEditors I already tried most of them. But still, I need something that is not listed there. Requirements: * starts and works

Re: MemoryError, can I use more?

2010-02-14 Thread Laszlo Nagy
2010.02.13. 17:40 keltezéssel, Diez B. Roggisch írta: Am 13.02.10 17:18, schrieb Anssi Saari: Nobody writes: A single process can't use much more than 2GiB of RAM without a 64-bit CPU and OS. That's not really true. Even Windows XP has the /3GB boot option to allow 3 GiB per process. On PC

Instance factory - am I doing this right?

2010-03-03 Thread Laszlo Nagy
This is just an interesting code pattern that I have recently used: class CacheStorage(object): """Generic cache storage class.""" @classmethod def get_factory(cls,*args,**kwargs): """Create factory for a given set of cache storage creation parameters.""" class CacheStora

sqlite3 is sqlite 2?

2010-03-14 Thread Laszlo Nagy
gand...@ubuntu:~$ python Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> sqlite3.version '2.4.1' Is it possible to install a real sqlite version 3 somehow? I really need it b

sqlite savepoint problem (was: Re: sqlite3 is sqlite 2?)

2010-03-14 Thread Laszlo Nagy
That's the sqlite *bindings* version: >>> sqlite3.version '2.4.1' >>> sqlite3.sqlite_version '3.6.16' >>> Thanks. I tried it and RELEASE command didn't work: >>> import sqlite3 >>> conn = sqlite3.connect(':memory:') >>> with conn: ... conn.execute("BEGIN") ... conn.execute("

Re: sqlite savepoint problem

2010-03-14 Thread Laszlo Nagy
From memory you can't issue a "CREATE TABLE" statement inside a transaction, at least not at the default isolation level. Such a statement will automatically commit the current transaction. Doesn't help with your current problem but worth pointing out :-) Thank you. I'll keep in mind. Whe

Re: sqlite savepoint problem

2010-03-14 Thread Laszlo Nagy
I'm now confused. Also, I could not find anything about these isolation levels on the sqlite website. The only think I could find is "PRAGMA read_uncommited". If that is the same as setting isolation_level to None, then I don't want it. Yes, it is. Here is a test: import os import sqlite3

Re: sqlite savepoint problem [solved]

2010-03-15 Thread Laszlo Nagy
No it doesn't. The problem is that using a connection as a context manager doesn't do what you think. It does *not* start a new transaction on __enter__ and commit it on __exit__. As far as I can tell it does nothing on __enter__ and calls con.commit() or con.rollback() on exit. With isola

Re: sqlite savepoint problem [solved]

2010-03-15 Thread Laszlo Nagy
Annotating your example: # entering this context actually does nothing with conn: # a transaction is magically created before this statement conn.execute("insert into a values (1)") # and is implicitly committed before this statement conn.execute("SAVEPOINT sp1")

Re: sqlite savepoint problem [solved]

2010-03-15 Thread Laszlo Nagy
#1. By using isolation_level = None, connection objects (used as a context manager) WON'T automatically commit or rollback transactions. #2. Using any isolation level, connection objects WON'T automatically begin a transaction. #3. Possibly, include your connection manager class code, to show h

sqlite version on windows

2010-03-26 Thread Laszlo Nagy
Hi All, On my Linux system: Python version: 2.6.2 sqlite3.sqlite_version: 3.6.10 On my Windows system: Python version: 2.6.5 sqlite3.sqlite_version: 3.5.9 Why is that? I wrote a program that uses SAVEPOINT/ROLLBACK to. It is only available in SQLite 3.6.8 and above. Can I install it on Windo

Re: sqlite version on windows

2010-03-26 Thread Laszlo Nagy
2010.03.26. 10:57 keltezéssel, Laszlo Nagy írta: Hi All, On my Linux system: Python version: 2.6.2 sqlite3.sqlite_version: 3.6.10 On my Windows system: Python version: 2.6.5 sqlite3.sqlite_version: 3.5.9 Why is that? I wrote a program that uses SAVEPOINT/ROLLBACK to. It is only available

Python metaclass and UML

2011-01-31 Thread Laszlo Nagy
How should I represent a Python metaclass on an UML class diagram? I know how to represent composition, aggregation and inheritance. But not sure about metaclasses. What kind of arrow or line should I use between a class and its metaclass? Is there a standard for this? Thanks, Laszlo -- h

Re: On Class namespaces, calling methods

2010-04-10 Thread Laszlo Nagy
class Uno: a=1 def m(): print "mouse" Say that I have this "silly" class. While I can then write print Uno.a I cannot write Uno.m() I get the following error message: TypeError: m() takes no arguments (1 given) As a workaround, use this pattern: >>> cl

Open Source Pivot table (OLAP cube?)

2010-04-27 Thread Laszlo Nagy
Hi All, I'm planning to create a new visual component for wxPython, for designing, creating and printing pivot tables. Also known as: decision cube, OLAP cube. I was searching on the internet for something similar, but I could not find any open source version (or free to use, at least). The

Re: Open Source Pivot table (OLAP cube?)

2010-04-27 Thread Laszlo Nagy
Please note: this is not a direct answer to your question. I would personally go for a client-server model; not worrying what the server is written in or how it works. For some reason I have a scary thought of your widget pulling in 100million records and cross-tabbing two dimensions :) Don't w

Re: Pointers in Python

2010-04-27 Thread Laszlo Nagy
Hi, I can't figure out how can I change the variable type in function. In C I could do that easily by changing pointer. Please read about "mutable and immutable objects in Python". If you understand the difference between them, you will get the idea. I'll explain program anyway, showing you

Performance of list.index - how to speed up a silly algorithm?

2010-04-29 Thread Laszlo Nagy
I have some ten thousand rows in a table. E.g. columns = ["color","size","weight","value"] rows = [ [ "Yellow", "Big", 2, 4 ], [ "Blue", "Big", 3, -4 ], [ "Blue", "Small", 10, 55 ], ... ] Some columns are dimensions, others are measures. I want to convert this to an indexed vers

Re: Performance of list.index - how to speed up a silly algorithm?

2010-04-30 Thread Laszlo Nagy
The .index method does a linear search, checking on average 1/2 of the items in the list. That's why it's so slow. In order to avoid that you could build a dict of each value in dimension_values[col_idx] and its index in a single pass so that it becomes a quick lookup. For example: from

Re: Performance of list.index - how to speed up a silly algorithm?

2010-05-01 Thread Laszlo Nagy
Maybe this should be implemented in C. But I believe that the algorithm itself must be wrong (regardless of the language). I really think that I'm doing something wrong. Looks like my algorithm's processing time is not linear to the number of rows. Not even log(n)*n. There should be a more ef

duplicate temporary file?

2010-05-03 Thread Laszlo Nagy
I try to write an iterator class: class FileIterator(object): def __init__(self,file_object): self.fin = file_object # other initialization code here ... def __iter__(self): return self def next(self): # special code that reads from the file and convert

Re: Portable Python

2010-05-05 Thread Laszlo Nagy
Is there any difference in functionality between standard Python pack and portable Python? It is not so easy to install third party modules for portable Python... Why standard Python pack installation requires reboot after installation? It is not true for all operating systems. At least under

Re: running .py files on Linux

2010-05-06 Thread Laszlo Nagy
Tingting HAN írta: Dear Officer, I want to run two .py files to generate .h5 files. hantingt...@tityro:~$ python2.5 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. When

numpy - save many arrays into a file object

2010-06-30 Thread Laszlo Nagy
import numpy data = numpy.array(...) numpy.save("test.np",data) This is very good, but I want to save the data into a file object with a write() method. E.g. not a real file. (My purpose right now is to save many arrays into one binary file, while recording starting positions of the arrays.)

Sphinx cross reference question

2010-08-22 Thread Laszlo Nagy
In my shopzeus.db.pivot.convert.py file, in the run() method of my Data2Facts class, I can write this into the docstring: class Data2Facts(threading.Thread): # code here... def prepare(self,*args): # code here... # more code here def run(self): """ Star

Load TTF from pycairo under Windows

2009-09-17 Thread Laszlo Nagy
Hi All, I have a program that works under Ubuntu. It loads a TTF font into pycairo, using libfreetype. The code snippet I used was taken from here: http://cairographics.org/freetypepython/ Now I need to use the same program from Microsoft Windows. But Windows does not have "libfreetype.so"

Cross platform TTF font render from Python [was: Load TTF from pycairo under Windows]

2009-09-18 Thread Laszlo Nagy
Hi All, I need to render antialiased PNG images using TTF font files and UTF-8 text. It needs to be available at least on Linux and Windows. This is what I have tried: #1. PIL - it has some problems and I cannot use it. Specifically, the ImageFont.getsize() returns bad value for some fonts,

Re: Cross platform TTF font render from Python [was: Load TTF from pycairo under Windows]

2009-09-18 Thread Laszlo Nagy
... the reportlab graphics renderPM(_renderPM) module does most things with T1 and TTF and works linux/win32. We use freetype2 internally to extract the curves from ttf and then draw them with libart_lgpl which does anti-aliasing. I just tried reportlab and RenderPM. I got the same error

Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-19 Thread Laszlo Nagy
This is what I did so far: #1. Install Python 2.6, Firebird 1.5 server (with libs and headers), egenix mx base and mingw C compiler #2. put "c:\MinGW\bin" on the PATH (or wherever it is) #3. extract kinterbasdb source to a temp folder #4. hack setup.cfg. Change the build section: [build] comp

Re: Pickle Encoding Errors

2009-09-20 Thread Laszlo Nagy
I'm running Python 2.5.4 on Debian Sid. If anybody understands the error please enlighten me. Very interesting! Here is a minimalist version: import pickle class PickleTest: def __init__(self): self.library={u"A": 1,u"B": 2,u"C": 3} def __del__(self): self.pickle()

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Laszlo Nagy
The building and installation went find. But I cannot "import kinterbasdb" because I get a "DLL load failed" error. I figured out that has something to do with msvcr90 and "_ftime". Can you please give me some advice how to solve this problem? Download Microsoft Visual C++.2008 Express Ed

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Laszlo Nagy
Christian Heimes írta: Laszlo Nagy wrote: The building and installation went find. But I cannot "import kinterbasdb" because I get a "DLL load failed" error. I figured out that has something to do with msvcr90 and "_ftime". Can you please give me some ad

xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'

2017-09-22 Thread Nagy László Zsolt
Here is an MWE: import io from lxml import etree test_node = etree.fromstring(''' http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512";>     ''') output = io.BytesIO(b'') test_node.getroottree().write(output, enc

Re: xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'

2017-09-22 Thread Nagy László Zsolt
> Result: > > Traceback (most recent call last): >   File "C:/not_telling/c14n.py", line 16, in >     short_empty_elements=False >   File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write > (src\lxml\lxml.etree.c:57004) > TypeError: write() got an unexpected keyword argument 'short_em

Re: xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'

2017-09-22 Thread Nagy László Zsolt
> https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write > > The argument was added in Python 3.4. Presumably, lxml implemented the > API before this change. > > Maybe this would be considered a bug by lxml. Maybe it won't. Maybe it is not a bug, just

requests / SSL blocks forever?

2018-01-13 Thread Nagy László Zsolt
Hi! I have a multi threaded Windows service written in Python. It is running on 3.6.2.  Sometimes I cannot stop the service, because on of the threads won't exit. I have narrowed down the problem to request and _lib.SSL_read. I have used a modified version of this gem: http://code.activestate.com/

Re: requests / SSL blocks forever?

2018-01-15 Thread Nagy László Zsolt
2018. 01. 13. 15:03 keltezéssel, Jon Ribbens írta: > On 2018-01-13, Nagy László Zsolt wrote: >> I have a multi threaded Windows service written in Python. It is running >> on 3.6.2.  Sometimes I cannot stop the service, because on of the >> threads won't exit. I have

Re: requests / SSL blocks forever?

2018-01-15 Thread Nagy László Zsolt
> (a) are you setting daemon=True on the thread? > (b) are you setting a timeout on the requests call? Hmm setting the timeout might not be the solution. This is from the docs of the requests module: > > Note > > |timeout| is not a time limit on the entire response download; rather, > an exception

Re: requests / SSL blocks forever?

2018-01-15 Thread Nagy László Zsolt
> In other words: if the server starts to send the response, but then > stops sending it (without closing the connection), then this will block > forever anyway. Or maybe I misunderstood the docs and the timeout means the max. time elapsed between receiving two chunks of data from the server? --

Re: requests / SSL blocks forever?

2018-01-16 Thread Nagy László Zsolt
>> Or maybe I misunderstood the docs and the timeout means the max. time >> elapsed between receiving two chunks of data from the server? > Yes. It's documented better here: > http://docs.python-requests.org/en/master/user/advanced/#timeouts > > You can't specify a "total time" within which the op

datetime, time zone and xs:datetime

2016-08-26 Thread Nagy László Zsolt
Hello, I'm having problems finding the "preferrably one" way to convert a datetime instance into an xs:datetime string. Here is an example datetime instance with is format: dt = datetime.now() print(dt.isoformat()) # prints "2016-08-26 12:41:13.426081+02:00" print(dt.strftime('%Y-%m-%dT%H:%M:

Override property setter of base class in Python 3

2016-09-11 Thread Nagy László Zsolt
Example code: class A: def __init__(self, prop=0): self.__prop = prop @property def prop(self): return self.__prop @prop.setter def prop(self, value): self.__prop = value class B(A): @A.prop.setter def prop(self, value): print

Re: Override property setter of base class in Python 3

2016-09-11 Thread Nagy László Zsolt
By the way, I know that I can use a "property virtualizer", something like this: import inspect class A: def __init__(self, prop=0): self.__prop = prop def _prop_get(self): return self.__prop def _prop_set(self, value): self.prop_set(value)

Re: Override property setter of base class in Python 3

2016-09-11 Thread Nagy László Zsolt
> Even the problem seems to rather defeat the purpose of a property. A > property should be very simple - why do you need to override it and > call super()? Doesn't this rather imply that you've gone beyond the > normal use of properties *already*? I'm not sure about that. I'm going to send a USE

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
> Even the problem seems to rather defeat the purpose of a property. A > property should be very simple - why do you need to override it and > call super()? Doesn't this rather imply that you've gone beyond the > normal use of properties *already*? Here are some of my classes that can represent da

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
Yes, I believe it does. (Others may disagree. This is a design question and very much a matter of style, not hard fact.) I would have an explicit action "set_content" which will set the value of an input field, the inner text of a textarea, the checked state of a check box, etc. In other words,

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
> Yes, the get part works. The set part is a pain, and a bit ugly: > > super(B, B).foo.__set__(self, value) > > There is an issue for this on the tracker: > http://bugs.python.org/issue14965 > Thank you Ethan! The superprop pure Python implementation is very promising. ( http://bugs.python.or

How to make a copy of chained dicts effectively and nicely?

2016-09-27 Thread Nagy László Zsolt
The result that I need should be a real dict, not just a ChainMap. (It is because I have to mutate it.) d1 = {'a':1, 'b':2} d2 = {'c':3, 'd':4} d3 = {'e':5, 'f':6} #1. My first naive approach was: from collections import ChainMap d = {} for key,value in ChainMap(d1, d2, d3).items(): d[key]

Re: How to make a copy of chained dicts effectively and nicely?

2016-09-29 Thread Nagy László Zsolt
On Wed, Sep 28, 2016 at 12:54 AM, Jussi Piitulainen > wrote: >> I wasn't sure if it makes a copy or just returns the dict. But it's >> true: help(dict) says dict(mapping) is a "new dictionary initialized >> from a mapping object's (key, value) pairs". > Yep. With mutable objects, Python's docs ar

Python 3.5 amd64 and win32service

2016-10-03 Thread Nagy László Zsolt
Hello, Is it possible to write a win32 service with 64 bit python 3.5? The pywin32 package does exist on 3.5 64bit, but missing some modules: >>> import win32service Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed:The specified module could not be found.

Re: Python 3.5 amd64 and win32service

2016-10-04 Thread Nagy László Zsolt
>> Is it possible to write a win32 service with 64 bit python 3.5? The >> pywin32 package does exist on 3.5 64bit, but missing some modules: > Try pip installing the "pypiwin32" package. That worked, thanks. Do you have an explanation why to official build ( https://sourceforge.net/projects/pywi

Re: Python 3.5 amd64 and win32service

2016-10-04 Thread Nagy László Zsolt
>> def main(self): >> self.ReportServiceStatus(win32service.SERVICE_RUNNING) >> while not self.stop_requested.is_set(): >> time.sleep(1) # So something useful here > Why don't you use the Windows Event (hWaitStop) with > WaitForSingleObject instead of an additional

Re: Python 3.5 amd64 and win32service

2016-10-05 Thread Nagy László Zsolt
>> But again, that is not related to the question. Why does it not work? >> What is missing? > If you mean why running the service doesn't work, it should once you > run the post-install script that copies pywintypes35.dll to the > Windows System32 directory. This DLL is required by PythonService.

Re: Python 3.5 amd64 and win32service

2016-10-05 Thread Nagy László Zsolt
> On Wed, Oct 5, 2016 at 7:43 AM, Nagy László Zsolt > wrote: >> It did not help. I still get the same error message (service did not >> respond in time). > Can you run the service executable directly? From the command line > check `sc qc TestService`. Run the BINARY_P

Re: Python 3.5 amd64 and win32service

2016-10-05 Thread Nagy László Zsolt
> > The MWE I provided is so simple. By now, It should be obvious what is > missing from it. :-( > > The problem is NOT with my code. I just installed a new virtual machine, and installed python3.5 amd64 + pypiwin32 on it. On that machine, the test service works perfectly! So it is with my machin

Re: Python 3.5 amd64 and win32service

2016-10-06 Thread Nagy László Zsolt
>> "C:\Users\Laci\AppData\Local\Programs\Python\Python35\lib\site-packages\win32\PythonService.exe" > I wanted you to run the above executable, not python.exe. If it fails > you'll get more information about why it's failing when run directly > then when the service controller runs it. Since you'r

XSD data mapper lib

2018-06-16 Thread Nagy László Zsolt
  Hello! I wonder what kind of XSD <-> Python class mapper should I use for my project. I need something that can generate classes from XSD files, and then parse XML to an objecttree and also dump object trees to XML. I'll be using Python version 3.6 and I would prefer to use something that is b

Set type for datetime intervals

2016-03-31 Thread Nagy László Zsolt
Hello, I need to compare sets of datetime intervals, and make set operations on them: intersect, union, difference etc. One element of a set would be an interval like this: element ::= (start_point_in_time, end_point_in_time) intervalset ::= { element1, element2, } Operations on element

ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
Hi All, If anyone is interested, a module was born: https://bitbucket.org/nagylzs/intervalset https://pypi.python.org/pypi/intervalset/0.1.1 I have some unit tests, but testers and comments are welcome. Also see below. >> >> Hello, >> >> I need to compare sets of datetime intervals, and

Re: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
> > On Fri, Apr 1, 2016 at 1:32 AM Nagy László Zsolt <mailto:gand...@shopzeus.com>> wrote: > > Does anyone know a library that already implements these functions? > > > What do you not like about the ones on PyPI? > https://pypi.python.org/pypi?%3Aaction=s

Re: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
>> element ::= (start_point_in_time, end_point_in_time) >> intervalset ::= { element1, element2, } >> >> Operations on elements: > > Eh... I think these should be realized as operations on an intervalset > with a single element, and that elements should simply have properties > like the start

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
> Why do you limit the intervals to datetime? Are there any assumptions in > your code that would make it fail with int values? Just one. The empty interval is a singleton and I want it to be smaller than any other interval. UTC_ZERO = datetime.datetime.utcfromtimestamp(0) EMPTY_INTERVAL = Inte

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
> Why do you limit the intervals to datetime? Are there any assumptions in > your code that would make it fail with int values? It has been generalized. Now it can be used with any immutable ordered type. :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Nagy László Zsolt
> I don't know if I like it being immutable. Maybe have separate mutable > and immutable versions. The reason for making it immutable is implementation specific. These intervals are stored in an ordered list. Overlapping intervals are unified by the constructor. This makes sure that sets with equa

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Nagy László Zsolt
> Yes, my question is why it's useful to have a single Interval as a > *distinct* type, separate from the interval set type, which supports a > sharply limited number of set-like operations (such as the union of two > overlapping intervals but NOT two non-overlapping ones). This doesn't > appear t

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Nagy László Zsolt
>> It is blurred by design. There is an interpretation where an interval >> between [0..4] equals to a set of intervals ([0..2],[2..4]). > No, because 2.5 is in one and not the other. My notation was: 0..4 for any number between 0 and 4. And 2..4 for any number between 2 and 4. So yes, 2.5 is in

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Nagy László Zsolt
>> How about creating two classes for this? One that supports zero sized >> intervals, and another that doesn't? > If you don't want zero sized intervals, just don't put any in it. You > don't have a separate list type to support even integers vs one that > supports all floats. What operations are

Re: Set type for datetime intervals

2016-04-05 Thread Nagy László Zsolt
> Sorry to be late to the party--I applaud that you have already > crafted something to attack your problem. When you first posted, > there was a library that was tickling my memory, but I could not > remember its (simple) name. It occurred to me this morning, after > you posted your new lib

Multiple inheritance, super() and changing signature

2016-05-31 Thread Nagy László Zsolt
Today I come across this problem for the N+1st time. Here are some classes for the example: class Observable: """Implements the observer-observable pattern.""" def __init__(self): # initialization code here... super(Observable, self).__init__() class AppServerSessionMixi

Re: Multiple inheritance, super() and changing signature

2016-06-03 Thread Nagy László Zsolt
> > In Python 3, that will be automatic and you don't need to worry about it. I'm using Python 3. I'm aware of old style and new style classes in Python 2. > > > [...] >> class BootstrapDesktop(BootstrapWidget, BaseDesktop): >> def __init__(self, appserver, session): >> # there is NOT

Re: Multiple inheritance, super() and changing signature

2016-06-03 Thread Nagy László Zsolt
> Raymond Hettinger gives an excellent presentation where he describes various > problems with MI and gives solutions for them. I think this might be it: > > http://pyvideo.org/video/1094/the-art-of-subclassing-0 This is a much better version from one year later: https://www.youtube.com/watch?v=m

Re: Multiple inheritance, super() and changing signature

2016-06-03 Thread Nagy László Zsolt
>> But I have to initialize some default attributes. > Then the statement “there is NOTHING else here” must be false. Either > the custom ‘__init__’ does something useful, or it doesn't. Well... the custom __init__ method with nothing else just a super() call was expressed there to show the super

Re: Multiple inheritance, super() and changing signature

2016-06-03 Thread Nagy László Zsolt
>> That's overly strict. As Raymond shows, it is easy to deal with >> changing method signatures in *cooperative* classes. > I must watch that for sure. All right, I have read this: https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ There is still something I don't get: how to

Re: Multiple inheritance, super() and changing signature

2016-06-03 Thread Nagy László Zsolt
Is the problem that the attribute or parameter has the same name in both base classes, but has different meanings in each? If they had different meanings, a simple rename would solve the problem. They have the same meaning. If you can't change the base classes, I've got some other solutions,

Re: I'm wrong or Will we fix the ducks limp?

2016-06-03 Thread Nagy László Zsolt
def getsMeet(files=file_list): """Get a File or List of Files. From the list of files determine what meetings exist and prepare them to be parsed """ pyqFiles = [] for filename in sorted(file_list): pyqFiles = pyqFiles.append(pq(filename=my_dir + file

<    1   2   3   4   5   6   7   8   9   >