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

Re: Multiple inheritance, super() and changing signature

2016-06-04 Thread Nagy László Zsolt
> > Things to know about super: > Part 1 http://www.artima.com/weblogs/viewpost.jsp?thread=236275 > Part 2 http://www.artima.com/weblogs/viewpost.jsp?thread=236278 > Part 3 http://www.artima.com/weblogs/viewpost.jsp?thread=237121 > > The wonders of super: > http://www.artima.com/weblogs/viewpost.j

Recursive type annotations

2016-06-08 Thread Nagy László Zsolt
class Test: def test(self, child : Test): pass NameError: name 'Test' is not defined I understand that the class "Test" is not defined until the class definition is executed. But it is very very common to build recursive data structures, and I have concrete use case where the IDE did

Re: Recursive type annotations

2016-06-08 Thread Nagy László Zsolt
>> pass >> >> NameError: name 'Test' is not defined > I think you can fix this by using a string annotation as follows: > > class Test: > def test(self, child: "Test"): > pass Yes, you are right. It is not directly written in the official documentation ( https://doc

what is wrong with this property setter

2016-06-09 Thread Nagy László Zsolt
class Test: def __init__(self): self._parent = None @property def parent(self): return self._parent @parent.setter def set_parent(self, new_parent): self._parent = new_parent p, c = Test(), Test() c.parent = p >py -3 test.py Traceback (most recent c

Re: what is wrong with this property setter

2016-06-09 Thread Nagy László Zsolt
>> @parent.setter >> def set_parent(self, new_parent): >> self._parent = new_parent > This creates a settable property with the name "set_parent" and leaves the > read-only property "parent" alone. Yes, and more. That property will also have a get method! Is it intentional? -- h

UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt
Hi, I would like to create a collections.UserList subclass that can notify others when the list is mutated. I'm not sure which methods I need to override. I have checked the sources, and it seems difficult to figure out which methods needs to be overriden. For example, MutableSequence.extend i

Re: what is wrong with this property setter

2016-06-09 Thread Nagy László Zsolt
>> Yes, and more. That property will also have a get method! Is it >> intentional? > It's a logical effect of how the setter() method works. The above is > syntactic sugar for > > def set_parent(...): >... > set_parent = parent.setter(set_parent) > > and parent.setter() creates a new property

Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt
>> Is there a way to easily find out which methods of are mutating the >> collection? Other than going over the source and checking all (normal >> and inherited) methods? > How about > > set(dir(collections.UserList)) - set(dir(collections.Sequence)) Thanks. It narrows down the list of possible me

Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt
> Using the built-in list or dict is problematic because sometimes the > subclass methods are ignored when the internal data is accessed (sorry, I > don't have an example). Are you suggesting that I should use UserList and UserDict instead of list and dict? What is the truth? Was UserDict left i

Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt
> @wrap_notify('remove', 'clear', 'append', 'insert', 'sort'): > class ObservableList(ObservableCollection, list): > pass > > I just can't find out the right syntax. > > All right, this is working. from contextlib import contextmanager class ObservableCollection: @contextmanager def

Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt
> [Looks like you made progress while I struggled to come up with the > following. I'll post it anyway.] Your version is much better. Thanks! :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Nagy László Zsolt
2016.06.10. 0:38 keltezéssel, Michael Selik írta: > On Thu, Jun 9, 2016 at 5:07 AM Nagy László Zsolt <mailto:gand...@shopzeus.com>> wrote: > > I would like to create a collections.UserList subclass that can notify > others when the list is mutated. > > > Wh

python 3 + milter

2016-06-16 Thread Nagy László Zsolt
Does anyone know a module that can be used to write a before-queue, smtpd time milter with Python 3? Unfortunately, pymilter does not work with Python 3: Downloading https://pypi.python.org/packages/58/2f/d4799c9cade461177955ca19ade6ca55385286f066c0db9a0770a332ab8a/pymilter-1.0.tar.gz#md5=ec9b95f

Re: Which one is the best JSON parser?

2016-06-27 Thread Nagy László Zsolt
On 2016-06-23, MRAB wrote: >> On 2016-06-23 21:58, David Shi via Python-list wrote: >>> Can any one tell me? >>> Regards. >>> David >>> >> There's one in the standard library. > Which has always worked fine for me... Which always reminds me: >>> import json >>> d = {0:1, False:2} >>> d {0: 2} >>>

Re: Can math.atan2 return INF?

2016-06-27 Thread Nagy László Zsolt
> Thanks, I'm in the same position as you, except that I'm in the position > where I need it use the result, and if it ever returns INF my function will > blow up. But it doesn't look like that can happen. > Doesn't atan2 relies on the C lib math floating point library? At least in CPython. I thin

Re: Best way to (re)load test data in Mongo DB

2019-02-24 Thread Nagy László Zsolt
  Hello! We have a system where we have to create an exact copy of the original database for testing. The database size is over 800GB. We have found that using zfs snapshots and zfs clone is the best option. In order to do this, you have to enable journaling in mongodb. Then you can take a snap

Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Nagy László Zsolt
  Hello, It depends on the operating system. For example on Ubuntu, the default python version is still 2.7. When you install both python2.7 and python3 on a system, then usually the "pip" will be a symlink to pip version 2 or 3. The default python interpreter can be different on different system

ANN: tornadostreamform

2015-11-26 Thread Nagy László Zsolt
Pure python module that let’s you upload *huge* files to a tornado web server. This project provides the |tornadostreamform.multipart_streamer.MultiPartStreamer| class that incrementally parses incoming multipart/form-data, splits it into form fields, and streams the fields into file like objects

Re: ANN: tornadostreamform

2015-11-26 Thread Nagy László Zsolt
> PyPi: https://pypi.python.org/pypi/tornadostreamform > Documentation: https://pypi.python.org/pypi/tornadostreamform Wrong paste. Here is the good one: https://pythonhosted.org/tornadostreamform/ -- https://mail.python.org/mailman/listinfo/python-list

Re: variable vs. object

2015-11-30 Thread Nagy László Zsolt
> a=10 > > 'a' is an integer. Is it an object too? In Python, objects have an identity. When you do "a=10" then you *bind* the object to the name *a*. By "variable", the documentation refers to a name that was bound to an object. This is different from many other low level languages. For example:

timedelta and float multiplication in python 2

2016-02-11 Thread Nagy László Zsolt
I ran into a problem today where I had to determine the mean point between two datetimes. Here is an example: >>> start = datetime.datetime(2016,2,11) >>> stop = datetime.datetime.now() >>> mean = start + (stop-start)*0.5 Traceback (most recent call last): File "", line 1, in TypeError: unsuppo

Re: asyncmongo + python 3: No module named 'errors'

2016-02-25 Thread Nagy László Zsolt
2016.02.25. 9:08 keltezéssel, Nagy László Zsolt írta: > ayncmongo requirements are "pymongo" and "tornado". > > I have a fresh installation of Python 3.5, pymongo 3.2 and tornado 4.3, > but I cannot import asyncmongo. This seems to be the exact same bug r

asyncmongo + python 3: No module named 'errors'

2016-02-25 Thread Nagy László Zsolt
ayncmongo requirements are "pymongo" and "tornado". I have a fresh installation of Python 3.5, pymongo 3.2 and tornado 4.3, but I cannot import asyncmongo. Tracelog below. P:\WinPython-64bit-3.5.1.2\python-3.5.1.amd64>python Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900

Re: asyncmongo + python 3: No module named 'errors'

2016-02-25 Thread Nagy László Zsolt
> Yes. > I recommend you to use motor [1]. > > > * [1] https://github.com/mongodb/motor Thanks. I have checked motor, and here are some problems with it: * I cannot install it with "pip3 install motor", because it is trying to downgrade (!!!) pymongo to version 2.8, but it fails to do so. There m

Re: querry to get status code in selinium webdriver , unable to find it , requesting to please help me

2014-02-13 Thread Nagy László Zsolt
here ismy code in python for i in range(0,60): driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") # i want status code here" time.sleep(1) Status of what? Are you asking the HTTP status of the page downloaded? That has nothing to do with you

Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Nagy László Zsolt
I have Python 3.3 installed on my Windows 7 x64 box. Today I had to install Python 2.7 for an older app of mine. Here is my problem: although "#!/usr/bin/env python3" is given in the file and "py -3" program works fine, apparently the installation of python 2 simply has overwritten my settings

Re: Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Nagy László Zsolt
From a cmd window: ftype python.file="C:\Windows\py.exe" "%1" %* ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* TJG Thank you. It worked. Although I must note that it only works if you start the cmd.exe as administrator (under Windows 7). Is it the only thing that was possibly overw

Re: Install python 2 and 3 in the "wrong" order

2014-02-15 Thread Nagy László Zsolt
From a cmd window: ftype python.file="C:\Windows\py.exe" "%1" %* ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* There is a serious problem with this! Example code test.py: #!/usr/bin/env python3 import sys print(sys.argv) Test run: C:\Temp>test.py 1 2 3 ['C:\\Temp\\test.py'] This is

Re: Install python 2 and 3 in the "wrong" order

2014-02-15 Thread Nagy László Zsolt
Just because I have a distrust of Windows's command interpreter, what happens when you type: ftype python.file ? Does it echo back what you thought it had, or has %* been eaten? If the %* is missing, that would explain the loss of arguments. Already tought of that: C:\Temp>ftype python.fil

Re: Install python 2 and 3 in the "wrong" order

2014-02-16 Thread Nagy László Zsolt
I should emphasize that this is with the /same/ x.y version... Installing 3.3 when the previous was 3.2 won't overlay. Though I don't see anything in the ActiveState builds (which are all I've ever used) to handle the #! type selection of the desired version. Just got done updat

Import order question

2014-02-17 Thread Nagy László Zsolt
I have a class hierarchy like this: Widget <- VisualWidget <- BsWidget and then BsWidget has many descendants: Desktop, Row, Column, Navbar etc. Widgets can have children. They are stored in a tree. In order to manage the order of widgets, I need methods to append children. (And later: insert

Re: Import order question

2014-02-17 Thread Nagy László Zsolt
Here is the problem: these methods should create instances of Row, Column and Navbar. But this leads to circular imports. It should not; Python is not Java. Use modules to group your class definitions conceptually. There is no need whatever to separate every class into a different module. If t

cx_freeze and temporary files - security related question

2014-05-21 Thread Nagy László Zsolt
I need to create an application for Windows 7 that runs from a flash drive. This program would be used to create remote backups of the pendrive. The pendrive contains sensitive data, so when I plug in the pendrive and run the program to make a backup, it should not leave any trace of operation

compiled cx_freeze

2014-05-25 Thread Nagy László Zsolt
Anyone knows where to get a compiled cx_freeze that has already has this patch? http://hg.python.org/cpython/rev/7d20e30bd540 https://bitbucket.org/anthony_tuininga/cx_freeze/issue/81/python-34-venv-importlib-attributeerror The installer on the sourceforge site still has this bug. :-( I don't

os.stat and time zones

2014-05-25 Thread Nagy László Zsolt
This might be a silly question. Documentation of os.stat: The exact meaning and resolution of the st_atime, st_mtime, and st_ctime attributes depend on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, st_mtime has 2-second resolutio

Re: compiled cx_freeze

2014-05-25 Thread Nagy László Zsolt
Anyone knows where to get a compiled cx_freeze that has already has this patch? http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze Unfortunately, this is buggy too. Here is a test output from a compiled console exe created with the above version of cx freeze: Traceback (most recent call

win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-25 Thread Nagy László Zsolt
>>> import win32service Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed: The specified module could not be found I have no problem loading the same module with Python 2.7. Strange thing is that win32serviceutil.py is part of the pywin32 distribution, so I

Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-25 Thread Nagy László Zsolt
2014.05.25. 23:49 keltezéssel, Terry Reedy írta: On 5/25/2014 1:40 PM, Nagy László Zsolt wrote: >>> import win32service Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed: The specified module could not be found I have no problem load

Re: compiled cx_freeze

2014-05-26 Thread Nagy László Zsolt
Let Christoph know, he is very responsive and extremely helpful. He did help. The new version is available on his site and it works. Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Nagy László Zsolt
Strange thing is that win32serviceutil.py is part of the pywin32 distribution, so I guess I should be able to import it, right? Make sure you have a pywin32 that matches ???. Matching includes python version and bitness. In addition, c:\python27\DLLs should also be on your %PATH%: setx PAT

Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found [SOLVED]

2014-05-26 Thread Nagy László Zsolt
Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run `C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` manually from an elevated command prompt. Christoph C:\>C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install Copied py

Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Nagy László Zsolt
Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run `C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` manually from an elevated command prompt. Much better when ran as an administrator: C:\Python\Projects\test>C:\Python34\python.exe C:\Python

pycurl.error: (55, 'select/poll returned error')

2015-03-27 Thread Nagy László Zsolt
When calling curl.perform() on a curl instance I get this: pycurl.error: (55, 'select/poll returned error') On the server side, there is no error message at all. I suppose that the curl client tries to call select/poll on the socket. It fails and then returns with an error. This error happ

Re: pycurl.error: (55, 'select/poll returned error')

2015-03-29 Thread Nagy László Zsolt
2015.03.28. 7:43 keltezéssel, dieter írta: Nagy László Zsolt writes: When calling curl.perform() on a curl instance I get this: pycurl.error: (55, 'select/poll returned error') This error happens only if the file to be POST-ed is big enough. Last week files were und

Re: pycurl.error: (55, 'select/poll returned error')

2015-04-01 Thread Nagy László Zsolt
When calling curl.perform() on a curl instance I get this: pycurl.error: (55, 'select/poll returned error') The same server is happily accepting files over 4GB from other clients. Those other clients are exactly the same client programs, but they are running on Windows. Only the one on t

{Spam?} Re: need help with selenium

2015-09-15 Thread Nagy László Zsolt
After clicking on submit button, a message is displayed on the same page whether login was successful or not. However after clicking on submit button, I lose control over the web page. I can't use any selenium functions now like 'driver.find_element_by_name()'. You need to wait until the submi

certifi or tornadoweb broken? What is happening here?

2015-10-07 Thread Nagy László Zsolt
Here is an MWE: import certifi import tornado.ioloop import tornado.httpclient io_loop = tornado.ioloop.IOLoop.current() def test(): global io_loop url = "https://www.saaspass.com/sd/rest/applications/x/tokens?password=x"; # Just a test application! ht

When tornado 4.3 will be available at pypi?

2015-10-08 Thread Nagy László Zsolt
I would like to use async/await. The tornado latest documentation says it is possible with tornado 4.3 and later: http://tornadokevinlee.readthedocs.org/en/latest/guide/coroutines.html However, it is not available yet. c:\Python\Projects>pip3 install tornado -U Requirement already up-to-date: to

How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
I'm new to Python 3.5 async / await syntax. I would like to create a class - let's call it AsyncBus - that can be used to listen for keys, and send messages for keys ansynchronously. class BusTimeoutError(Exception): pass class AsyncBus(object): def __init__(self, add_timeout): ""

Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
> async def waitfor(self, keys, timeout=None): > """Wait for keys. > > :arg keys: An iterable of immutable keys. > :arg timeout: Raise TimeoutError if nothing hits the > bus for this amount of time. > None means: wait indefinitely. It

Re: How to repeat a loop once it is finished

2015-10-15 Thread Nagy László Zsolt
> what would be a small thing that I could add to make this thing run again? Something like this? TERMINATOR = "STOP" def read_int(prompt,minvalue,maxvalue): while True: answer = raw_input(prompt) if answer.lower().strip() == TERMINATOR.lower().strip(): print "Us

Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
>> async def waitfor(self, keys, timeout=None): >> """Wait until a message comes in for any of the given key(s). Raise >> BusTimeoutError after the given timedelta.""" >> >> >> >> Internally, the waitfor method would use the add_timeout to resume itself >> and raise the Bu

Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
> Sorry, I didn't realize that you were using tornado and not asyncio. > Presumably it should be on whatever loop the wait call was awaited in, > but I have no idea how compatible asyncio constructs are with tornado > event loops. Exactly. I had the same doubts. > I think it's a bad idea because t

Re: How to implement an async message bus

2015-10-16 Thread Nagy László Zsolt
> > It is very annoying that async, await, yield, Future, Condition, Lock > and almost all other async constructs work with any event loop; but > simple things like "sleep for 10 seconds" are totally incompatible. > But I guess I'll have to live with that for now. > Some more incompatibilty: *

Re: How to implement an async message bus

2015-10-16 Thread Nagy László Zsolt
>>> try: >>> return await waiter >>> finally: >>> # TODO: Use a context manager to add and remove the keys. >>> for key in keys: >>> self._waiters[key].discard(waiter) >>> if handle: >>> handle.cancel() >>> >>> def notify(self, key, m

Re: variable scope of class objects

2015-10-19 Thread Nagy László Zsolt
> > #!/usr/bin/python > # -- developed using Python 2.7.3 > > class BME280: Not strictly related to the question, but you probably want to use so called "new style classes" when developing a new program for Python version 2. In other words, use: class BME280(object): instead of class BME280:

Re: variable scope of class objects

2015-10-19 Thread Nagy László Zsolt
> My questions are: > What is the scope of class variables? In Python, you bind values (objects) to names. It is conceptually different from "setting the value of a variable". In Python, scope applies to names, not variables. When you say "class variable", what do you mean? This may help: A nam

  1   2   >