Re: testing if a list contains a sublist

2011-08-16 Thread Laszlo Nagy
That can be easily fixed: def sublist(lst1, lst2): s1 = ','.join(map(str, lst1)) s2 = ','.join(map(str, lst2)) return False if s2.find(s1)==-1 else True I don't know about best, but it works for the examples given. For numbers, it will always work. But what about l

Re: PUT with proxy-support

2011-08-25 Thread Laszlo Nagy
I tried httplib, httplib2, urllib2 with no avail. I managed to do this via command line curl: $ curl http:/xyz.com/testing/shashwat/test.txt -T test.txt -H "sw-version: 1.0" -H "CA-Cert-Auth:v=1;a=yxyz.prod;h=10.10.0.1;t=1316594650;s=.AeEYJMMfElN74f

Re: PUT with proxy-support

2011-08-26 Thread Laszlo Nagy
are that this version uses urllib2. Although it can use https protocol, it doesn't check the server's certificate. Good luck, Laszlo #-- # # Author: Laszlo Nagy # # Copyright: (c) 2005 by Szoftver Messias Bt. # Licence: BSD style # # Setup urllib so it will use Mozilla

Re: Installing WebDAV server

2011-08-31 Thread Laszlo Nagy
What do you mean by STFW? Search The Fucking Web ? I wasn't aware that easy_install was a utility. Downloaded and installed the Windows version and run easy_install pywebdav. It downloaded something, installed something and finished something. Then it's installed! But, once again, don't know

Re: Installing WebDAV server

2011-08-31 Thread Laszlo Nagy
Where it says: Installation and setup of server can be as easy as follows: $ easy_installPyWebDAV $ davserver-D/tmp-n-J Starting upPyWebDAV server(version0.9.2-dev) ATTENTION: Authentication disabled! Serving datafrom /tmp Listening on localhost(8008) Yes, but that's Unix/Linux

Re: Python marks an instance of my class undefined

2011-09-06 Thread Laszlo Nagy
On 2011-09-06 15:42, Kayode Odeyemi wrote: I was able to get this solved by calling class like this: >>> from core.fleet import Fleet >>> f = Fleet() Thanks to a thread from the list titled "TypeError: 'module' object is not callable" Or you can also do this: import core.fleet # import modul

Re: Portable locale usage

2011-09-07 Thread Laszlo Nagy
1. Is there a way for writing portable Python code dealing with locales (as sketched in the beginning)? I usually do this at the top of my main program, before importing other modules: import locale locale.setlocale(locale.LC_ALL, '') This is absolutely portable. The above snippet work

gdbm thread safety

2011-03-20 Thread Laszlo Nagy
Hi, Are gdbm objects thread safe? I searched through mailing list archives and the documentation but did not find the answer. My only concerns are: * is it safe to use the same gdbm object in read-only mode from many threads? * is it safe to use the same gdbm object from many thre

os.stat bug?

2011-03-21 Thread Laszlo Nagy
Hi All, I have a Python program that goes up to 100% CPU. Just like this (top): PID USERNAME THR PRI NICE SIZERES STATE C TIME WCPU COMMAND 80212 user1 2 440 70520K 16212K select 1 0:30 100.00% /usr/local/bin/python process_updates_ss_od.py -l 10 I ha

Re: os.stat bug?

2011-03-21 Thread Laszlo Nagy
On 2011-03-21 10:58, Martin v. Loewis wrote: Could it be a problem with the operation system? Is it possible that an os.stat call requires 100% CPU power from the OS? Or is it a problem with the Python implementation? There is a chance that the CPU usage actually comes from the thread doing slee

Re: os.stat bug?

2011-03-22 Thread Laszlo Nagy
I guess that the code is running in kernel mode. I think this because I can send a KILL signal to it and the state changes to the following: What's your operating system and file system? A better file system or system setting may increase your performance a lot. XFS or ext3 / ext4 with hashed di

Special logging module needed

2011-03-23 Thread Laszlo Nagy
Hi All, We have a special problem that needs to be addressed. We need to have a database of log messages. These messages are not simple strings - they are data structures. The log messages are assigned to various objects. Objects can be identified with simple object identifiers (strings).

Re: Special logging module needed

2011-03-24 Thread Laszlo Nagy
2011.03.23. 19:33 keltezéssel, Dan Stromberg írta: On Wed, Mar 23, 2011 at 7:37 AM, Laszlo Nagy <mailto:gand...@shopzeus.com>> wrote: I was also thinking about storing data in a gdbm database. One file for each month storing at most 100 log messages for every key value.

Re: os.stat bug?

2011-03-24 Thread Laszlo Nagy
It's the OS kernel. If it was Python or the C library, sending SIGKILL would result in immediate termination. Is the disk interface operating in PIO mode? A slow disk shouldn't cause 100% CPU consumption; the OS would just get on with something else (or just idle) while waiting for data to beco

Standard way to distribute utilities with packages

2011-03-27 Thread Laszlo Nagy
I'd like to distribute a pure Python package named "foo". By default it will be placed in lib/site-packages/foo. What if I want to add utilities? Command line or GUI programs that are not full featured applications, but they can be handy for some tasks that are related to the package. Here is w

Re: Python program termination and exception catching

2011-04-10 Thread Laszlo Nagy
2011.04.10. 21:25 keltezéssel, Jason Swails írta: Hello everyone, This may sound like a bit of a strange desire, but I want to change the way in which a python program quits if an exception is not caught. The program has many different classes of exceptions (for clarity purposes), and they'r

dictionary size changed during iteration

2011-04-20 Thread Laszlo Nagy
Given this iterator: class SomeIterableObject(object): def __iter__(self): ukeys = self.updates.keys() for key in ukeys: if self.updates.has_key(key): yield self.updates[key] for rec in self.inserts: yield rec

wxGrid, PyGridTableBase, strange SWIG error message!

2011-05-01 Thread Laszlo Nagy
I'm trying to create a special widget that is a wx.Grid and also a PyGridTableBase. In my special case of application, I really need to have a grid that uses itself for getting cell data and cell attributes. Here is a test program, demonstrating my problem: import wx from wx.grid import Grid,P

Re: dictionary size changed during iteration

2011-05-07 Thread Laszlo Nagy
... That works, but if d is large, it won't be very efficient because it has to generate a large list. It is not large. But I'm using Python 2.6 , not Python 3. I did not get this error again in the last two days. I'll post a new reply if I encounter it again. (It happened just a few times o

Asyncmongo and Python3: ImportError: No module named 'errors'

2013-11-16 Thread Laszlo Nagy
I'm about to convert a complete library into python3. I need asnycmongo for this. Trying to install it on Ubuntu. After executing "sudo pip3 install asyncmongo" I have the following traceback: Traceback (most recent call last): ... import asyncmongo File "/usr/local/lib/python3.3/

Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
Example interactive: $ python3 Python 3.3.1 (default, Sep 25 2013, 19:29:01) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import uuid >>> import base64 >>> base64.b32encode(uuid.uuid1().bytes)[:-6].lower() b'zsz653co6ii6hgjejqhw42ncgy' >>> But w

Why tornado.web.RequestHandler.arguments.get is binary?

2013-11-16 Thread Laszlo Nagy
I believe most data passed in URLs are character data. RFC 2986 also suggest that the standard should be percent encoded UTF-8: The generic URI syntax mandates that new URI schemes that provide for the representation of character data in a URI must, in effect, represent characters from the unr

Re: Asyncmongo and Python3: ImportError: No module named 'errors'

2013-11-16 Thread Laszlo Nagy
Sorry if this question was answered before, I'm new to Python 3. Have you seen and met its 'requirements'? If you haven't then perhaps that's the problem. Yes I did. Requirements are: pymongo 1.9+ and tornado. Both are compatible with Python 3 and are installed on my system: gandalf@gandalf

Re: Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
the error is in one of the lines you did not copy here because this works without problems: <> #!/usr/bin/python Most probably, your /usr/bin/python program is python version 2, and not python version 3 Try the same program with /usr/bin/python3. And also try the interactive mode with

Re: Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
Why it is behaving differently on the command line? What should I do to fix this? I was experimenting with this a bit more and found some more confusing things. Can somebody please enlight me? Here is a test function: def password_hash(self,password): public = bytearray([rando

Re: Beginner python 3 unicode question [SOLVED]

2013-11-16 Thread Laszlo Nagy
So is the default utf-8 or not? Should the documentation be updated? Or do we have a bug in the interactive shell? It was my fault, sorry. The other program used os.system at some places, and it accidentally used python2 instead of python 3. :-( -- This message has been scanned for viruse

inconsistency in converting from/to hex

2013-11-16 Thread Laszlo Nagy
We can convert from hex str to bytes with bytes.fromhex class method: >>> b = bytes.fromhex("ff") But we cannot convert from hex binary: >>> b = bytes.fromhex(b"ff") Traceback (most recent call last): File "", line 1, in TypeError: must be str, not bytes We don't have bytes_instance.tohex()

Doc generation from annotated source code

2013-11-18 Thread Laszlo Nagy
I just started rewritting my project from python 2 to python 3. I noticed that there are these new parameter and return value annotations. I have docstrings everywhere in my project, but I plan to convert many of them into annotations. The question is: what kind of auto documenting system shoul

Re: Method chaining

2013-11-23 Thread Laszlo Nagy
OK, that one is disgusting... Anyway, I'd like to see a sequence of method names taken from actual code that profits from this chaining pattern. Actually, wx.lib.agw uses this a lot. Especially for AuiPaneInfo: http://www.wxpython.org/docs/api/wx.aui.AuiPaneInfo-class.html All right, this

Re: Cracking hashes with Python

2013-11-27 Thread Laszlo Nagy
On 2013-11-26 00:58, Marc wrote: Hashes, by definition, are not reversible mathematically. The only way to figure out what they represent is to take plaintext that might be the plaintext based on anything you might know about the original plaintext (which is often nothing) and hash it; then see

Re: L[:]

2014-01-13 Thread Laszlo Nagy
Unless L is aliased, this is silly code. There is another use case. If you intend to modify a list within a for loop that goes over the same list, then you need to iterate over a copy. And this cannot be called an "alias" because it has no name: for idx,item in enumerate(L[:]): # do somet

Re: Portable locale usage

2011-09-08 Thread Laszlo Nagy
I have set the system-wide locale to Croatian (Croatia) on my development system as instructed by: http://windows.microsoft.com/en-US/windows-vista/Change-the-system-locale Nevertheless, your proposal produces: ('English_United States','1252') This is what I see on my Hungarian Windows: C:\U

Re: Portable locale usage

2011-09-09 Thread Laszlo Nagy
Why are you trying to force a specific locale to your program anyway? Because I wish to be able to correctly sort Croatian names. Well, all right. If you want to sort Croatian names from a program that runs on an English (or whatever) system, then you will have to check the platform and use a

Re: stackoverflow and c.l.py

2011-09-14 Thread Laszlo Nagy
On 2011-09-14 15:05, memilanuk wrote: Rick & Xang Li are two examples of what you *don't* see (or at least I don't) @ SO I knew Xang's name would come up. :-) Epic. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call java methods in python

2011-10-04 Thread Laszlo Nagy
Please help me Regarding how to create java bridge as how to call a java function from python If you want to call a Java *method* from the C python implementation, then there are many possibilities. For example, you can write your Java program as a service. The Python program can talk to it t

webapp development in pure python

2011-10-25 Thread Laszlo Nagy
Hi, Anyone knows a framework for webapp development? I'm not talking about javascript/html compilers and ajax frameworks. I need something that does not require javascript knowledge, just pure Python. (So qooxdoo is not really an option, because it cannot be programmed in Python. You canno

Re: webapp development in pure python

2011-10-25 Thread Laszlo Nagy
Anyone knows a framework for webapp development? I'm not talking about javascript/html compilers and ajax frameworks. I need something that does not require javascript knowledge, just pure Python. (So qooxdoo is not really an option, because it cannot be programmed in Python. You cannot even

Re: Is there a graphical GUI builder?

2013-02-20 Thread Laszlo Nagy
You have to think about your window differently - think about what you're putting where, rather than going visually "that looks about right" - but the reward is that it'll look right no matter where you run your app. As an added bonus, you don't need any sort of graphical builder; you can just w

Re: Encoding problem in python

2013-03-04 Thread Laszlo Nagy
On 2013-03-04 10:37, yomnasala...@gmail.com wrote: I have a problem with encoding in python 27 shell. when i write this in the python shell: w=u'العربى' It gives me the following error: Unsupported characters in input any help? Maybe it is not Python related. Did you get an exception? Can yo

imaplib question

2006-07-14 Thread Laszlo Nagy
Hello, I'm trying to write a very simple program that moves all messages from INBOX into another folder. I'm not sure what am I doing wrong. This is a very simple task. I believe I need to call these methods: - search -> get all message UIDs in the INBOX - copy -> copy all messages to anothe

Re: imaplib question

2006-07-14 Thread Laszlo Nagy
Laszlo Nagy írta: > Hello, > > I'm trying to write a very simple program that moves all messages from > INBOX into another folder. > I'm not sure what am I doing wrong. This is a very simple task. I > believe I need to call these methods: > > - search -&

Re: imaplib question - answering my own question

2006-07-14 Thread Laszlo Nagy
Laszlo Nagy írta: > Laszlo Nagy írta: > >> Hello, >> >> I'm trying to write a very simple program that moves all messages from >> INBOX into another folder. >> I'm not sure what am I doing wrong. This is a very simple task. I >> believe

Re: XMLRPC Solution Code

2006-07-18 Thread Laszlo Nagy
> I'm afraid you'll need to Google for "python windows service" or > similar: in essence the main thing the service has to do (besides serve) > is ensure a continuous flow of messages through the system. It's ugly, > but people have done it before. > Also don't forget to "Allow the service i

Re: how to know if socket is still connected

2006-07-18 Thread Laszlo Nagy
[EMAIL PROTECTED] írta: > ok, yeah, thats in my book. > thanks, and no, it isn't enabled. > thanks again for everything > -sk > Another hint: use select.select() on the socket before reading. It will tell you if recv() will block or not. This way you can implement your own async timeout and do

Re: Using super()

2006-07-19 Thread Laszlo Nagy
Pupeno írta: > Hello, > I have a class called MyConfig, it is based on Python's > ConfigParser.ConfigParser. > It implements add_section(self, section), which is also implemented on > ConfigParser.ConfigParser, which I want to call. > So, reducing the problem to the bare minimum, the class (with a

Re: Using super()

2006-07-19 Thread Laszlo Nagy
> I see, thank you. > > class MyConfig(ConfigParser, object): > def add_section(self, section) > super(MyConfig, self).add_section(section) > > seems to work and as expected. Is there anything wrong with it ? > I have never seen this before. :) I don't know the answer, but I'm int

wx.ListCtrl - I do not see the inserted item

2006-07-20 Thread Laszlo Nagy
This is a ListCtrl descendant: class MegaListCtrl(wx.ListCtrl): def InsertImageStringItem(self, index, label, imageIndex): imageIndex = self.imagelists[wx.IMAGE_LIST_SMALL].GetIndexByName(imageIndex) print index,imageIndex,label,imageIndex super(MegaListCtrl,sel

cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
This program: import sys import traceback import cStringIO a = 1.0 b = 0.0 try: c=a/b except: f = cStringIO.StringIO('') ei = sys.exc_info() traceback.print_exception(ei[0],ei[1],ei[2],file=f) raises this exception: Traceback (most recent call last): File "C:/Documents and

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
>> > Nope. StringI is an input-only object, StringO is an output object. You > got a StringI because you gave a string argument to the creator. > > > >>> f1 = cStringIO.StringIO() > >>> f1 > > >>> dir(f1) > ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', > '__ini

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
> from cStringIO documentation: > > > Another difference from the StringIO module is that calling > StringIO() with a string parameter creates a read-only object. > Unlike an object created without a string parameter, it does > not have write methods. > Looks like I did not

xmlrpc: hostname nor servname provided ?

2006-07-25 Thread Laszlo Nagy
I'm running a service on a machine. The service is written in Python (of course) and it connects to an XMLRPC server periodically. It recreates the ServerProxy instance each time it needs to connect to the RPC server. The server is created with this code: server = xmlrpclib.ServerProxy(local.SE

Re: xmlrpc: hostname nor servname provided ?

2006-07-27 Thread Laszlo Nagy
> I'm running a service on a machine. The service is written in Python > (of course) and it connects to an XMLRPC server periodically. > It recreates the ServerProxy instance each time it needs to connect to > the RPC server. > > The server is created with this code: > > server = xmlrpclib.Server

gaierror: (8, 'hostname nor servname provided, or not known')

2006-07-31 Thread Laszlo Nagy
Hello, I asked this question about a week ago, but I did not provide a traceback. Here is the traceback: File "/usr/local/lib/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python2.4/xmlrpclib.py", line 1383, in __request

Re: gaierror: (8, 'hostname nor servname provided, or not known')

2006-07-31 Thread Laszlo Nagy
faulkner írta: > my boss has a similar problem with his home internet connection in > general. he traced it back to his router, which was in the first couple > generations of routers. how old are the routers you tested this on? > aside from upgrading them, if they are the problem, i can suggest a >

Re: Jumping over in the class hierarchy

2006-08-01 Thread Laszlo Nagy
Pupeno írta: > Hello, > I want to jump over a method in the class hierarchy, that is: If I have > class A(object), clas B(A), class C(B) and in C, I want a method to do > exactly what A does but not what B does in its reimplementation, would it > be correct to do: super(A, super(B, self)).method()

Re: wxPython and PIL

2006-10-19 Thread Laszlo Nagy
Odalrick wrote: > I'm making a simple program to crop and scale images, essentially make > thumbnails from a user defined subset of the image. > > I'm planning to use Python Image Library to crop and resize the images, > mostly to make the resized smaller images look good. > > How do I display a PI

Re: Getting externally-facing IP address?

2006-11-10 Thread Laszlo Nagy
Michael B. Trausch wrote: > Hello, > > Every programming example that I have seen thus far shows simple > server code and how to bind to a socket--however, every example binds > to the localhost address. What I am wondering is this: Is there a > clean way to get the networked IP address of the

Set header from IMAP

2006-11-13 Thread Laszlo Nagy
Dear List, I'm trying to figure out, how to change the header of an e-mail that is accessed by an IMAP object. There is some code below (not a complete program). The key function is the filter_mail function. It should move/delete/change/export messages, based on their header. For exporting m

Re: Running Python scripts under a different user

2006-05-29 Thread Laszlo Nagy
>> >> From what you wrote, I think that you need to change architecture. You >> should write your own service rather than write tricky programs. This >> way you can develop your own security system, and restrict access to >> specific files/programs. You can write tools that can connect to your >>

Re: Checking var is a number?

2006-06-06 Thread Laszlo Nagy
[EMAIL PROTECTED] írta: > Hi, > I am very new to all this and need to know how to check > a variable to see if it is a number or not. Also can anyone > recommend a reference book apart from dive into python > preferably a reference with good examples of how to impliment > code. > There are diffe

secure xmlrpc server?

2006-06-07 Thread Laszlo Nagy
Hello, I'm trying to create a simple XMLRPC server and a client. It is a small application, but the connection needs to be secure. I would like the client to be as thin as possible. Ideally, the client should only require the basic python library, nothing else. I found many examples on the

Re: Python language problem

2006-06-07 Thread Laszlo Nagy
[EMAIL PROTECTED] i'rta: class A: > ... pass > ... > a = A() b = a del b a > <__main__.A instance at 0x00B91BC0> > I want to delete 'a' through 'b', why It does't? > How can I do that? > > You must undestand that 'a' and 'b' are names. Y

Re: secure xmlrpc server?

2006-06-07 Thread Laszlo Nagy
Martin P. Hellwig wrote: > Laszlo Nagy wrote: > > Have a look at: > http://trevp.net/tlslite/ > C:\temp\ccc>python setup.py install running install running build running build_py running build_ext error: The .NET Framework SDK needs to be installed before building extensio

Re: secure xmlrpc server?

2006-06-07 Thread Laszlo Nagy
Martin P. Hellwig írta: > Laszlo Nagy wrote: > >> Martin P. Hellwig wrote: >> >>> Laszlo Nagy wrote: >>> >>> Have a look at: >>> http://trevp.net/tlslite/ >>> >>> >> C:\temp\ccc>python setup.py ins

simplexmlrpcserver and allow_none

2006-06-08 Thread Laszlo Nagy
Hello, I ran in the same problem again. Many others have the same problem. Just Google for this: "SimpleXMLRPCServer allow_none site:python.org". Looks like the 'allow_none' patch was commited to trunk on 2005 Dec ( http://mail.python.org/pipermail/python-checkins/2005-December/048289.html )

Terminateable thread

2006-06-08 Thread Laszlo Nagy
I wote a TThread class that is 'soft terminateable'. For example: class MyProcessor(TThread): def run(self): while not self.terminated(): self.process_one_item() My question is that, do I really need to use events for this? Because of the GIL, assignments are atomic. Is

Re: simplexmlrpcserver and allow_none

2006-06-08 Thread Laszlo Nagy
Thomas Bellman írta: > Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > >> I ran in the same problem again. Many others have the same problem. Just >> Google for this: "SimpleXMLRPCServer allow_none site:python.org". >> Looks like the 'allow_none

Re: Importing again and again

2006-06-08 Thread Laszlo Nagy
abcd írta: > If I have code which imports a module over and over again...say each > time a function is called, does that cause Python to actually re-import > it...or will it skip it once the module has been imported?? > > for example: > > def foo(): > import bar > bar.printStuff() > > foo()

__getattr__ question

2006-06-09 Thread Laszlo Nagy
Hello, This is from the Python documentation (fragment): __getattr__( self, name) Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self). name is the attribute name. This method

Re: __getattr__ question

2006-06-09 Thread Laszlo Nagy
Here is a horrible solution. I could make it thread-safe by adding +30 lines. There must be a better solution. class TemplateItem(object): def __init__(self,name): self.name = name self.items = [] def __getattr__(self,name): self._getattr_was_called = True

Re: TypeError: unsubscriptable object

2006-06-09 Thread Laszlo Nagy
[EMAIL PROTECTED] írta: > So wat should I do ?? > You should do this: print type(Function),type(Description) raise SystemExit Instead of this: print template % (ID, IID, Function[:10], Description[:10],ErrorNumber, StatusCD) Then probably you will see: instead of or something simil

Re: TypeError: unsubscriptable object

2006-06-09 Thread Laszlo Nagy
[EMAIL PROTECTED] írta: > I did the same, > > The function type is < NoneType> and the description type is > so how can i print a part of this 2 output. > The unicode object IS subscriptable. It is a unicode string which has characters. The value None is not subscriptable. It probably means th

Re: __getattr__ question

2006-06-10 Thread Laszlo Nagy
> > Either way is a few more characters to type, but it's far saner than > trying to distinguish between "real" and "fake" attributes. > I think you are right. I'll make up my mind. -- http://mail.python.org/mailman/listinfo/python-list

Re: __getattr__ question

2006-06-10 Thread Laszlo Nagy
> print "item1" in dir(root) # False > print "item3" in dir(root) # True > > Is it the behavior you wanted? > Exactly. :-) Why I did not think of this? I'm always amazed when I see that Python can do anything we want. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimals

2006-06-13 Thread Laszlo Nagy
Tgone írta: > Hello, > > I have a price column in a MySQL table: price decimal(5,2) > > When I access them in Python with SQLObject, prices display as 15.0 > instead of 15.00. Why is this happening? I can't figure out why Python > is trimming off the hundredth place. I'm not doing any formatting...

Re: Decimals

2006-06-13 Thread Laszlo Nagy
>> Try string formatting: >> >> print '%.2f' % product.price >> > > That works. I expected Python to display the data exactly as it is in > the database, like most languages. It depends on what you get back from MySQLdb. Try this: import decimal d = decimal.Decimal("3.") print d Now tr

Re: code folding, a unique problem to python?

2006-06-15 Thread Laszlo Nagy
John Salerno írta: > Specifically, I'm using UltraEdit and perhaps there's no way perfect way > to implement code folding with it, given how it uses its syntax > highlighting file to do so (i.e., you have to specify an "Opening" and > "Closing" character in which to enfold code, such as braces).

Re: Pycrypto

2006-06-16 Thread Laszlo Nagy
> You can do this as follows: > > py> from Crypto.Cipher import AES > py> # key has to be 16, 24 or 32 bytes for AES > py> crypt = AES.new('abcdefghijklmnop', AES.MODE_ECB) > # we're lucky, the string to encrypt is a multiple of 16 in length > py> txt = 'ea523a664dabaa4476d31226a1e3bab0' > py> c =

Re: Pycrypto

2006-06-16 Thread Laszlo Nagy
> Not in this implementation: > py> from Crypto.Cipher import AES > py> crypt = AES.new('abcdefghijklmnop', AES.MODE_CBC) > py> c = crypt.encrypt('1') > Traceback (most recent call last): > File "", line 1, in ? > ValueError: Input strings must be a multiple of 16 in length > This is strange.

Re: python + postgres psql + os.popen

2006-06-22 Thread Laszlo Nagy
damacy írta: > hello, everyone. > > i am trying to write a program which executes SQL commands stored in > .sql files. > > i wrote a function called psql() whose contents look like the > following. > > ... > os.popen(command) > file = os.popen(command, 'w') > file.write(password) > file.close() > .

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Martin Bürkle írta: > Hi NG, > > I have writen a programm using TCP sockets. After i get the connection > to another socket I cut the Ethernet cable. Then I send a message. > The program doesnt raise any exception. Can somebody tell me why and > give me a hint how to get an exception > Okay, l

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Ben Sizer írta: > Martin Bürkle wrote: > >> I have writen a programm using TCP sockets. After i get the connection >> to another socket I cut the Ethernet cable. Then I send a message. >> The program doesnt raise any exception. Can somebody tell me why and >> give me a hint how to get an excepti

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Laszlo Nagy írta: > Ben Sizer írta: > >> Martin Bürkle wrote: >> >> >>> I have writen a programm using TCP sockets. After i get the connection >>> to another socket I cut the Ethernet cable. Then I send a message. >>> The program doesn

Re: List Manipulation

2006-07-04 Thread Laszlo Nagy
Roman írta: > I would appreciate it if somebody could tell me where I went wrong in > the following snipet: > > When I run I get no result > > cnt = 0 > p=[] > reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel", > quotechar="'", delimiter='\t') > for line in

Re: socket buffer flush question

2006-07-05 Thread Laszlo Nagy
Kiran i'rta: > Hello Everybody! > I am writing a networking application in python for a small piece of > hardware, in which there could sometimes be timeouts. I am using > sockets to communicate to this device. Data that is sent to the device > is instructions for that piece of hardware, and da

Re: XML-RPC server-client communication

2006-07-05 Thread Laszlo Nagy
Stefka írta: > Hi all, > > I try to implement a python xml-rpc server and call it from a php > client. If the server and the client are on the same machine > (localhost) the communication between them is just fine. When I start > the server on a different host I don't get an answer. > Please go

Re: Solution for XML-RPC over a proxy

2006-07-07 Thread Laszlo Nagy
Andrew R írta: > All, > > I couldn't get my xml-rpc script to work via a corporate proxy. > > I noticed a few posts asking about this, and a very good helper script by jjk > on > starship. That script didn't work for me, and I think its a little old -- but > it > was very helpful to figure it out

Looking for a HTML like rendering library (wishlist)

2006-07-10 Thread Laszlo Nagy
Hello, I'm looking for a library that can do the following: * Parse a simple structured text file (XML or HTML etc.) * Render its output to an image * I would like to give the maximum width of the image (but not the minimum) * I would like to use my custom TrueType fonts,

Re: std in and stdout

2006-07-10 Thread Laszlo Nagy
Juergen Huber írta: > hello, > > i have a question! > > how would i fix the following problem: > > now i have an input file with a fix name and an output file! > i have this two files hardcoded written in the sourcecode of this function! > > in the future i will start this script with the command l

Re: lambda

2006-08-24 Thread Laszlo Nagy
> what is a lambda expression? labmda is a reserved word and AFAIK it is an operatior. By using lamba, you can create an anonymous function. That is, a function without name. For example, doing def create_adder(amount): def adder(x): return x + amount return adder is equvalent

Re: can't destroy a wxMiniFrame

2006-08-24 Thread Laszlo Nagy
Flavio írta: > Hi, > > I have a miniframe composed mainly of combo boxes, that I need to > destroy and recreate multiple time with different choice lists for the > combo boxes. > > My problem is that even after destroying a miniframe with the Destroy() > method, when it is recreated, the combo boxe

Re: Python & chess

2006-08-24 Thread Laszlo Nagy
tobiah írta: > Paolo Pantaleo wrote: > >> Well Python is not a good language for writing a chess engine >> > > I'm curious; how does python fall short here, and what are the > features that make some other language more suitable for the > task? > Hmmm. I think that if you need to write

Re: wxPython default radiobox choice

2006-08-24 Thread Laszlo Nagy
crystalattice írta: > In my GUI app, I have a radio box allowing the user to pick his/her > gender. When I click a button, I'd like the radio box to tell the > program which choice is marked. I can get it to work when I manually > pick a choice but I get an error when the choice is left at the de

py2exe and libxml

2006-09-04 Thread Laszlo Nagy
I wrote a little win32 console application that uses libxml2. It is working fine. If I create an .exe version, I get this error when I try to start the program: Traceback (most recent call last): File "MyProgram.py", line 3, in ? File "mylib\item.pyc", line 5, in ? ImportError: dynamic modu

Re: py2exe and libxml

2006-09-05 Thread Laszlo Nagy
Amaury Forgeot d'Arc írta: > Laszlo Nagy a écrit : > >> I wrote a little win32 console application that uses libxml2. It is >> working fine. If I create an .exe version, I get this error when I try >> to start the program: >> >> Traceback (most recent

Re: Secure XMLRPC Server / PEM Files

2006-09-11 Thread Laszlo Nagy
Daniel Crespo írta: Hello everybody, I'm trying to implement a secure xmlrpc server with basis on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496786 recipe. The thing that I'm concerned about is how can I get/create rapidly the .pem files (the key and cert). Any help? Hello, If

Re: Secure XMLRPC Server / PEM Files

2006-09-11 Thread Laszlo Nagy
> > > If you have OpenSSL installed, you can do the following: > > 1. Create a new directory and place the two attached files in it > (openssl.cnf and generate.sh) > 2. Run "chmod +x gen_cert.sh ; ./gen_cert.sh yourdomain.com" I meant generate.sh instead of gen_cert.sh. Under windows it won't

Re: Secure XMLRPC Server / PEM Files

2006-09-11 Thread Laszlo Nagy
Daniel Crespo írta: > Laszlo Nagy wrote: > >>> If you have OpenSSL installed, you can do the following: >>> >>> 1. Create a new directory and place the two attached files in it >>> (openssl.cnf and generate.sh) >>> 2. Run "chmod +x gen_

Re: Secure XMLRPC Server / PEM Files

2006-09-12 Thread Laszlo Nagy
Daniel Crespo írta: > Hi Laszlo, > > I have read that. It's the wrapper for the usage of OpenSSL, so I have > to install it. I have downloaded the Borland C++ compiler, and I'm > doing so right now, but I'm not getting good results yet. > You do not need any compiler. You just need to install th

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread Laszlo Nagy
John Henry írta: > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > >...some_huge_list is a huge list... >some_huge_list[0]=1 >aref = some_huge_list >aref[0]=0 >print so

<    1   2   3   4   5   >