Re: Problem subclassing (Newbie)

2005-09-23 Thread Laszlo Zsolt Nagy
>Then I have an instance of class Button called obj. My probelm is that >the test isinstance(obj, Widget) resturns False! > You must have a typo somewhere. Please try this little test program. >>> class Widget(object): ... pass ... >>> class Button(Widget): ... pass ... >>> b = B

Re: @staticmethod, backward compatibility?

2005-09-27 Thread Laszlo Zsolt Nagy
Neal Becker wrote: >How can I write code to take advantage of new decorator syntax, while >allowing backward compatibility? > >I almost want a preprocessor. > >#if PYTHON_VERSION >= 2.4 >@staticmethod >... > > >Since python < 2.4 will just choke on @staticmethod, how can I do this? > > Decorator

email module, redirecting to stdout

2005-10-04 Thread Laszlo Zsolt Nagy
Hello, I have this code: s = smtplib.SMTP() s.set_debuglevel(1) s.connect(host=smtp_host) s.set_debuglevel(0) log("Connected, sending e-mail") sys.stdout.flush() s.sendmail( consts.EMAIL_FROMADDRESS, [to],

Re: Python, Mysql, insert NULL

2005-10-05 Thread Laszlo Zsolt Nagy
Python_it wrote: >Python 2.4 >MySQL-python.exe-1.2.0.win32-py2.4.zip > >How can I insert a NULL value in a table (MySQL-database). >I can't set a var to NULL? Or is there a other possibility? >My var must be variable string or NULL. >Becaus i have a if statement: >if > cursor.execute("..

Re: Python, Mysql, insert NULL

2005-10-05 Thread Laszlo Zsolt Nagy
> > BTW, you did not write which driver are you using. Oh, you did. Sorry. :-( Import your DB module 'yourmodule' and then print yourmodule.paramstyle Description of paramstyle is also in PEP249: paramstyle String constant stating the type of parameter marker

Re: How to get the output from os.system() into a variable?

2005-10-05 Thread Laszlo Zsolt Nagy
alexLIGO wrote: >Hi, > >I would like to execute some command in python on the bash, e.g. > >os.system('globus-job-run mike4.cct.lsu.edu/jobmanager-pbs -l >/bin/date') > >and want the result of the output in a vector, so something like: > >result=python_command(' command_on_the_bash ') > >Is that p

Re: How to get the output from os.system() into a variable?

2005-10-05 Thread Laszlo Zsolt Nagy
>>result=python_command(' command_on_the_bash ') >> >>Is that possible? And how to do that? >> >> > >Check out the commands module. > >http://docs.python.org/lib/module-commands.html > Hmm, I forgot this one. It is only working from UNIX, am I right? Les -- http://mail.python.org/mailman

Re: change a value to NULL?

2005-10-05 Thread Laszlo Zsolt Nagy
Bell, Kevin wrote: >I'm pulling a list of numbers from MS Excel, but occasionally if there >is no data from excel, the value is an asterisk, but I need to make it >null. > >What is the best way to do that? Thus far, I'm using: > > >for value in myRange: > try: > intV = int(value

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Laszlo Zsolt Nagy
>I've removed all references to the object, except for the cache. Do I >have to implement my own garbage collecting is or there some "magical" >way of doing this within Python? I pretty much want to get rid of the >cache as soon as there are no other references (other than the cache). > Store we

Re: Class methods

2005-10-05 Thread Laszlo Zsolt Nagy
Hughes, Chad O wrote: > Is there any way to create a class method? I can create a class > variable like this: > ... > Any ideas? > Oh man, it has been a long time I have read such an disturbing question. RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 Les -- http://mail

Re: Class methods

2005-10-05 Thread Laszlo Zsolt Nagy
>> >> >Oh man, it has been a long time I have read such an disturbing question. > >RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 > > I feel I was a bit harsh. class A(object): x = 0 @classmethod def f(cls): cls.x += 1 print "x is",cls.x >>> A.

Re: Help-log in to a web page

2005-10-06 Thread Laszlo Zsolt Nagy
Murugesh wrote: >Hi all, >I'm a newbie to python.I need to login to a webpage after supplying >usename and password. > >import urllib >sock = urllib.urlopen("http://xop-pc.main.com";) >htmlSource = sock.read() >sock.close() >pri

Class property (was: Class methods)

2005-10-06 Thread Laszlo Zsolt Nagy
Hughes, Chad O wrote: > Is there any way to create a class method? I can create a class > variable like this: > Hmm, seeing this post, I have decided to implement a 'classproperty' descriptor. But I could not. This is what I imagined: class A(object): _x = 0 @classmethod def get_x(

Re: Help-log in to a web page

2005-10-06 Thread Laszlo Zsolt Nagy
>> >> I tried to view the source,it has, >> >> >> src="/em/cabo/images /t.gif" height="80">> align="center" border="0" cellspacing="2" cellpadding="0">> id="username >> __xc_">> title="Required" class="xc">* *User Name> pan>> width="12">> id="username"

Re: /usr/bin/env python, force a version

2005-10-06 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: >I've got a trouble, and i think that anybody there can help me > >I've got a python script which i distribute in somes packages for *nix. >This script is full of python and need python 2.4 ! And i'd like to >display a message when the user doesn't have a python2.4 version

Re: /usr/bin/env python, force a version

2005-10-06 Thread Laszlo Zsolt Nagy
Roel Schroeven wrote: >Laszlo Zsolt Nagy wrote: > > >>[EMAIL PROTECTED] wrote: >> >> >> >>>I've got a trouble, and i think that anybody there can help me >>> >>>I've got a python script which i distribute in somes package

Re: Class property

2005-10-06 Thread Laszlo Zsolt Nagy
Peter Otten wrote: >Laszlo Zsolt Nagy wrote: > > > >>I was trying for a while, but I could not implement a 'classproperty' >>function. Is it possible at all? >> >> > >You could define a "normal" property in the metaclass: &

Re: Python's Performance

2005-10-08 Thread Laszlo Zsolt Nagy
Dave wrote: > Hello All, > > I would like to gather some information on Python's runtime > performance. As far as I understand, it deals with a lot of string > objects. Does it require a lot string processing during program > execution? How does it handle such time-consuming operations? Is th

Re: Comparing lists

2005-10-10 Thread Laszlo Zsolt Nagy
Odd-R. wrote: >I have to lists, A and B, that may, or may not be equal. If they are not >identical, I want the output to be three new lists, X,Y and Z where X has >all the elements that are in A, but not in B, and Y contains all the >elements that are B but not in A. Z will then have the elemen

Re: Send password over TCP connection

2005-10-10 Thread Laszlo Zsolt Nagy
How about an OTP (One Time Password) algorithm? It is described in RFC2289. http://www.faqs.org/rfcs/rfc2289.html I have a working implementation in Messlib. You can download it an look at the "MessageSocket.SecureMessageSocket" class. That is a modified version where a good random generator is

Re: Send password over TCP connection

2005-10-11 Thread Laszlo Zsolt Nagy
dcrespo wrote: >¡Beautiful and elegant solution! > >Two copies of the password: one on the client, the other on the server. > >1. Client wants to connect >2. Server generates a random_alphanumeric_string and sends it to the >client >3. Both Client and Server creates a hash string from > >4. Client

Re: Send password over TCP connection

2005-10-11 Thread Laszlo Zsolt Nagy
>Ignoring all the other issues, any solution which actually requires the >password to be stored on the server is a bad solution. Administrators >should not have access to user passwords, and in addition users should >not be put in the position of having to trust your server-side security >to

Re: Send password over TCP connection

2005-10-11 Thread Laszlo Zsolt Nagy
>If you really want to do it right, use SRP, . > > This is a bit offtopic here. I read the RFC and I do not see why SRP is not vulnerable to dictionary attacks. If I have a working client software then I can use it to reveal passwords. Isn't it a dictionary attack? Can

Re: Send password over TCP connection

2005-10-11 Thread Laszlo Zsolt Nagy
Paul Rubin wrote: >Laszlo Zsolt Nagy <[EMAIL PROTECTED]> writes: > > >>This is a bit offtopic here. I read the RFC and I do not see why SRP >>is not vulnerable to dictionary attacks. >>If I have a working client software then I can use it to reveal >>

Re: Send password over TCP connection

2005-10-11 Thread Laszlo Zsolt Nagy
>If you're saying that people have no choice but to trust that their >passwords, stored in the clear on the server of some idiot who didn't >know better, are safe from casual administrator observation and safe >from hackers stealing the password file, then you shouldn't be allowed >anywhere ne

Need a spider library

2005-10-12 Thread Laszlo Zsolt Nagy
Hi All, I'm writting a spider program. I need to go to serveral URLs and extract information from the HTML source. Including links. I was using FancyURLOpener and my own function that extracts the links from a HTML page. The problem is that I always need to change it. This is because some sit

Re: Need a spider library

2005-10-12 Thread Laszlo Zsolt Nagy
Fredrik Lundh wrote: >Laszlo Zsolt Nagy wrote: > > > >>The question: is there a good library for Python for extraction links and >>images >>out of (possibly malformed) HTML soucre code? >> >> > >http://www.crummy.com/software/BeautifulSoup

Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
I have a program with this code fragment: print len(data) print data[:50] raise SystemExit This prints: 20381 http://mail.python.org/mailman/listinfo/python-list

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
Laszlo Zsolt Nagy wrote: >I have a program with this code fragment: > >print len(data) >print data[:50] >raise SystemExit > >This prints: > >20381 > >But if I change 50 to 51 > >print len(data) >print data[:51] >raise SystemEx

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
> >I assume the code snippets are exact copy/paste so this is not a typo >(like print data[51:] ...) - and I can't reproduce it here... even with >a string of 20381 characters. > > Yes, they were cut out. type(data) returns ''. The data was downloaded from a website, it starts with http://www.w

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
David Stockwell wrote: > Indeed,Are you writing a new book? > > http://www.amazon.com/exec/obidos/ASIN/1563052857/wildwierdmathpro I'm not, but thanks for asking. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
>i. e. a character after a 'carriage return' ('\r') overwrites part of the >string which therefore doesn't seem to grow. Try > >print repr(data[:51]) > >to see what's really in your data string. > > Yes, that was it! Thanks for you help. I thought it will be something obvious. The server retu

Outdated documentation

2005-10-17 Thread Laszlo Zsolt Nagy
Hi All, This is from the documentation of the dbhash module: Returns the key next key/value pair in a database traversal. The following code prints every key in the database |db|, without having to create a list in memory that contains them all: print db.first() for i in xrange

Re: html parser?

2005-10-18 Thread Laszlo Zsolt Nagy
Christoph Söllner wrote: >Hi *, > >is there a html parser available, which could i.e. extract all links from a >given text like that: >""" >BAR >BAR2 >""" > >and return a set of dicts like that: >""" >{ > ['foo.php','BAR','param1','test'], > ['foo2.php','BAR2','param1','test','param2','test'] >

Re: html parser?

2005-10-19 Thread Laszlo Zsolt Nagy
Thorsten Kampe wrote: >* Christoph Söllner (2005-10-18 12:20 +0100) > > >>right, that's what I was looking for. Thanks very much. >> >> > >For simple things like that "BeautifulSoup" might be overkill. > >import formatter, \ > htmllib, \ > urllib > >url = 'http://python.org'

Re: IE Temporary Internet Files & Python

2005-11-10 Thread Laszlo Zsolt Nagy
>The script does not seem to work when used on Temporary Internet Files. > > Doesn't work well? What does it mean? Is there an exception raised? Les -- http://mail.python.org/mailman/listinfo/python-list

ZSI bug?

2005-12-05 Thread Laszlo Zsolt Nagy
Hi All, I'm trying to use ZSI (and SOAP) for the first time. I read somewhere that ZSI is the most compete SOAP implementation. I have ZSI-1.7 and PyXML-0.8.4. This very simple code: import ZSI fname = 'eBaySvc.wsdl' version = 421 url = 'http://developer.ebay.com/webservices/%s/%s' % (versio

Re: extract python install info from registry

2005-12-06 Thread Laszlo Zsolt Nagy
rbt wrote: >On windows xp, is there an easy way to extract the information that >Python added to the registry as it was installed? > > Using regedit.exe, look at the registry keys and values under HKEY_LOCAL_MACHINE\Software\Python If you need to know how to read the registry from Python: ple

Re: extract python install info from registry

2005-12-06 Thread Laszlo Zsolt Nagy
>There's more to it than that... isn't there? I've used _winreg and the >win32 extensions in the past when working with the registry. I thought >perhaps someone had already scripted something to extract this info. > > Ok, if you need to get all changes in the registry, you can use regdiff. ht

Re: windows installer problems

2005-12-06 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: >Hi, >I'm trying to install Python on Windows 2000 Server using remote >desktop. I log as a user that is in administrators group. Instalator >starts, I select default installation directory, on the next screen >with parts to install I click just next. Than blicks screen wi

junk pointer ????

2005-12-06 Thread Laszlo Zsolt Nagy
Hi All, I got this while using Python 2.4 under FreeBSD 5.4: python in free(): warning: junk pointer, too high to make sense Segmentation fault (core dumped) What does it mean? Thanks, Les -- http://mail.python.org/mailman/listinfo/python-list

Re: How to ping in Python?

2005-12-07 Thread Laszlo Zsolt Nagy
Michael Schneider wrote: >I telnet to port 13 (returns time) > The problem is that most modern up-to-date servers use firewalls. They only open the ports that are absolutely necessary. Usually the time service is part of inetd, which is disabled by default, on most of the servers. PING ICMP may

Re: need help on generator...

2005-01-21 Thread Laszlo Zsolt Nagy
Joh wrote: hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = [1,2,3,4] would like to produce : [1,2], [2,3], [3,4], [1,2,3], [2,3,4] Do you mean: [1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4] (E.g. all elements in the power set e

wx.BoxSizer problem

2005-01-21 Thread Laszlo Zsolt Nagy
Hi All, Here is the code of a frame: import wx class PanelDatabaseDefinition(wx.Panel): def __init__(self,parent): wx.Panel.__init__(self,parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.sizer.Add(wx.Button(self,label="test1"),flag=wx.EXPAND,pr

Re: wx.BoxSizer problem

2005-01-24 Thread Laszlo Zsolt Nagy
My problem is that only one of the buttons is visible and that one is not expanded. (System: Windows, Python 2.3.4, wxPython 2.5.3) Works as expected on Mac OS X 10.3.7, python 2.3.4, wxPython 2.5.2.8. Thanks. Probably the problem is with my bitmap (I used a bitmap instead of a button). Ple

Re: How to assign

2005-01-25 Thread Laszlo Zsolt Nagy
Jan Rienyer Gadil wrote: Sort of a newbie question: How am i going to assign to a variable anything the user inputs on a wxTxtCtrl? I'm affraid you have to do it manually. I think the best solution is to use a property like this: import wx class FrameMain(wx.Frame): def __init__(self, *args

wx.Image: Couldn't add an image to the image list.

2005-01-26 Thread Laszlo Zsolt Nagy
I would like to load image from a directory right into an image list. I wrote a simple library that loads the images in the directory and resizes them as needed before adding to the wx.ImageList. This is not the same code but some snippets. I resize the image this way (using Python Imaging Library)

Re: execute python code from db

2005-01-26 Thread Laszlo Zsolt Nagy
robert wrote: Hello, Anybody knows if it's possible to execute python code from an db. db=MySQLdb.connect(host="localhost",user="r",passwd="j",db="v") c=db.cursor() c.execute("""SELECT * FROM table WHERE id = %s""", (id,)) for python_code in c.fetchall(): execute (python_code) Maybe f

unicode and data strings

2005-01-28 Thread Laszlo Zsolt Nagy
Hello I have a program where I would like to calculate a checksum. Looks like this: n = self.__calc_n(seed1,seed2,pwd) This is required for an OTP (One Time Password) algorithm. My code was working before without problems. Now I installed Python 2.3.4 and wxPython 2.5.3 (with unicode support).

Re: unicode and data strings

2005-01-28 Thread Laszlo Zsolt Nagy
ut encodings. How do I do that? Unicode errors only appear if you're converting between "raw 8-bit data" and Unicode strings (which contain Unicode characters, not bytes or integers). You cannot do that without caring about encodings... I see now. Thanks for your help. It was: seed1 + pwd

re module - cannot make expression

2005-01-31 Thread Laszlo Zsolt Nagy
Hi All! I would like to match strings not beginning with '/webalizer'. How can I do this? The only one negation command is ^ inside [] but it cannot be used here. I looked over "re" examples on the net but I could not find an example about how to match "not beginning with" type expressions. Tha

How to use DrPython plugins

2005-08-06 Thread Laszlo Zsolt Nagy
Hi All! I have DrPython installed. I see there are cool plugins but I cannot user them. For example, I installed the "CodeCompletion" and "CodeMark" plugins. I have enabled the "CodeCompletion" plugin by default. I assigned the shortcut CTRL+SPACE to :CodeCompletion "Toggle Code Completion"

Windows 32 service problem (ImportError)

2005-08-15 Thread Laszlo Zsolt Nagy
Hi All! I have a running service (a small web server) implemented in python, running as a win32 service. I wrote another program that is very similar to the web server but I cannot start the service. From the event log, I can read this traceback: - Python could not import the se

zlib + Windows 32 service problem (ImportError)

2005-08-15 Thread Laszlo Zsolt Nagy
Sorry, I realized that the import zlib was not executed from my (working) service. So here is the question: why can't I use zlib from a win32 service? Is there any way to make it working? >- >Python could not import the service's module > File "T:\Python\Projects\NamedConnector\Serv

Re: zlib + Windows 32 service problem (ImportError)

2005-08-16 Thread Laszlo Zsolt Nagy
vincent wehren wrote: >"Laszlo Zsolt Nagy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag >news:[EMAIL PROTECTED] >| Sorry, I realized that the import zlib was not executed from my >| (working) service. >| So here is the question: why can't I use zlib from a w

Re: zlib + Windows 32 service problem (ImportError)

2005-08-17 Thread Laszlo Zsolt Nagy
| >| >C:\Python24;C:\Python24\DLLs;c:\Python24\Lib\site-packages\win32;c:\oracle\product\10.1.0\db_1\bin;c:\oracle\product\10.1.0\db_1\jre\1.4.2\bin\client;c:\oracle\product\10.1.0\db_1\jre\1.4.2\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program >| Files\Common Files\GT

sys.path and win32 services (was: importerror)

2005-08-17 Thread Laszlo Zsolt Nagy
>Why do you think str() is needed here? > > Because I'm not sure if sys.path was overwritten or changed. Some bad modules could overwrite sys.path with another list. I know I'm paranoid. :-) >Possibly because sys.path can start with '' which is interpreted as the >current directory. Perhaps w

Re: FileIO problem

2005-08-24 Thread Laszlo Zsolt Nagy
Try this: gclas = raw_input("What is the class:") def Princlas(): count = 0 while count != 1000: count = count + 1 return "Admin forceclass %s %s " % ( count , gclas ) #asks for file name a = raw_input("What is new file name:") out_file = open(a,"w") #this is the input of t

pexpect.exitstatus not working?

2005-09-01 Thread Laszlo Zsolt Nagy
This function: def scp(from_path,to_path,pwd): """Copy a file with scp.""" cmd = '/bin/csh -c "scp -q %s %s ; echo XXX"' %(from_path,to_path) print cmd child = pexpect.spawn(cmd) child.expect('Password:') child.sendline(pwd) child.expect('XXX') return child.exi

Re: pexpect.exitstatus not working?

2005-09-01 Thread Laszlo Zsolt Nagy
Laszlo Zsolt Nagy wrote: >This function: > >def scp(from_path,to_path,pwd): >"""Copy a file with scp.""" >cmd = '/bin/csh -c "scp -q %s %s ; echo XXX"' %(from_path,to_path) >print cmd >child = pe

Re: simple question: $1, $2 in py ?

2005-09-05 Thread Laszlo Zsolt Nagy
>Oh, yes. Right : ) >It feels that I miss-looked it. > >thank You very much for an advice : ) > > Also try the OptParse module. http://www.python.org/doc/2.4/lib/module-optparse.html It handles the GNU/POSIX syntax very well. Les -- http://mail.python.org/mailman/listinfo/python-list

epydoc CLI and many files

2005-09-05 Thread Laszlo Zsolt Nagy
Hello, I have a problem under Windows. I use the cli.py program included with epydoc. I wrote a small program that lists all of my modules after the cli. Something like this: cli.py --html --inheritance=grouped module1.py module2.py module3.py .. The problem is that now I have so many m

The right way to do i18n

2005-09-07 Thread Laszlo Zsolt Nagy
Hello, I wonder if there is a standard for making i18n in Python projects. I have several Python projects that are internationalized. I also have Python packages with i18n. But it is still not clean to me what is the recommended way to do it. Currently, I use a module called 'localization.p

Distutils question

2005-09-08 Thread Laszlo Zsolt Nagy
How how can I install my .mo files from a distutil script into its default location? sys.prefix + os.sep + 'share' + os.sep + 'locale' -- http://mail.python.org/mailman/listinfo/python-list

Re: popen in thread on QNX

2005-09-08 Thread Laszlo Zsolt Nagy
Jacek Popławski wrote: >I am still in the process of creating my script which will run command >received from socket. >My scripts works perfectly on Linux, but doesn't work on QNX! > >File "/usr/lib/python2.4/popen2.py", line 108, in __init__ > self.pid = os.fork() >OSError: [Errno 89] Func

Re: popen in thread on QNX

2005-09-08 Thread Laszlo Zsolt Nagy
>>os.popen already creates a new process. So what if you try to call >>os.popen from your main thread, then pass the file descriptors to your >>thread? >>It is just an idea... >> >> > >But I need to run command from thread, that's the main reason to create >new thread :) > > Ok, but can't

Distutils extension proposal (was: Re: Distutils question)

2005-09-08 Thread Laszlo Zsolt Nagy
Peter Hansen wrote: >>How how can I install my .mo files from a distutil script into its >>default location? >> >>sys.prefix + os.sep + 'share' + os.sep + 'locale' >> >> > >I can't answer the first question, but the latter should be written this >way instead > >os.path.join(sys.prefix, '

Self reordering list in Python

2005-09-15 Thread Laszlo Zsolt Nagy
Hello, Do you know how to implement a really efficient self reordering list in Python? (List with a maximum length. When an item is processed, it becomes the first element in the list.) I would like to use this for caching of rendered images. Of course I could implement this in pure Python,

Re: How to clear screen in Python interactive shell mode?

2005-09-16 Thread Laszlo Zsolt Nagy
A. L. wrote: >In Python interactive mode, is there some function acting like 'clear' >command in bash? Could somebody here give some advice? > > Under Linux/UNIX system (on x86 at least) you can use the CTRL+L combination to clear the screen. I do not now similar for Windows and MACs. Les

Re: Self reordering list in Python

2005-09-16 Thread Laszlo Zsolt Nagy
>I wonder why you don't use a dictionary? The only time I used a >move-front algorithm I stored algorithms and had to evaluate a >condition to select the correct algo. That means no constant search key >was available for accessing the correct one. In case of an image list I >would implement a self

Re: Python Doc Problem Example: os.path.split

2005-09-18 Thread Laszlo Zsolt Nagy
>is the doc writer, trying to write the doc with some austereness, but >is confused about the behavior of split, or confused about expressing >it? Did his pretension fucked him up? > > Dear Xah Lee, The Python community is very sorry because we have a very bad documentation. You are right. Th

Re: win32 service and time.sleep()

2005-09-20 Thread Laszlo Zsolt Nagy
rbt wrote: >I have a win32 service written in Python. It works well. It sends a >report of the status of the machine via email periodically. The one >problem I have is this... while trying to send an email, the script >loops until a send happens and then it breaks. Should it be unable to >send, it

Where is my exception

2005-09-20 Thread Laszlo Zsolt Nagy
I have this code in a wxWidgets program: class HtmlHintWindow(wx.Frame): def __init__(self,pos,hint,config): global _current_hint_window # Determine the size of the screen self.screensize = wx.ClientDisplayRect()[2:] # Calculate the size of the hint ;-)

Re: testing a website from python

2005-09-20 Thread Laszlo Zsolt Nagy
M.N.A.Smadi wrote: >hi; > >I just want to test that a given website is up or not from a python >script. I thought of using wget as an os command. Any better ideas? > > urllib http://www.python.org/doc/current/lib/module-urllib.html If you only want to test if the HTTP port is open or not:

Re: Where is my exception

2005-09-20 Thread Laszlo Zsolt Nagy
>The program prints out "point 1" but it does not print "point 2". What >am I missing? > > Sorry from all. I should have been looked at the processor before I posted. There is no exception. It was an infinite loop inside the try block, but it was called from an event handler. I did not notice

Re: Indexed variables

2005-09-22 Thread Laszlo Zsolt Nagy
>a1=a2=0 > >def f(x): >if x == a1: >a1 = a1 + 1 >elif x == a2: >a2 = a2 + 1 > > >Now if I call f with f(a2) only a1, of course, is incremented because the >if-clause does only check for the value of the input and the values of a1 >and a2 are identical. > >So how do I define

Re: Indexed variables

2005-09-22 Thread Laszlo Zsolt Nagy
>If you really want to change an actual parameter inside an object, then > > inside a function, I mean -- http://mail.python.org/mailman/listinfo/python-list

Re: User Identification

2005-02-08 Thread Laszlo Zsolt Nagy
Bob Parnes wrote: I have a python program on a server of an all-linux network. It needs to record the user name running it. Is there a way for the program to extract the name from the system without a separate log-in dialog? Bob Parnes What about: import os username = os.getlogin() Please see

Re: User Identification

2005-02-08 Thread Laszlo Zsolt Nagy
how about: import getpass getpass.getuser() 'gromit' Hmm, yours is better. It also works on Windows. :-) I wonder why os.getuser() does not work in Windows - apparently there is a good implementation for Windows. -- _

Re: python connect to server using SSH protocol

2005-02-08 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: How can python connect to server which use SSH protocol? Is it easy since my python has to run third party vendor, write data, read data inside the server (supercomputer). In advance, I'm not sure if I understood your problem. SSH is clearly a remote shell. You will be

Re: How to keep a module with the same name as a module it is importing from importing itself?

2005-02-08 Thread Laszlo Zsolt Nagy
In my package, myapp, I have a module, logging.py. That module, naturally, imports the library module logging with an 'import logging' statement. However, when I use 'import myapp.logging' in my script, the myapp.logging module tries to import itself rather than the library logging module. How c

Re: python connect to server using SSH protocol

2005-02-08 Thread Laszlo Zsolt Nagy
import os fi, foe = os.popen4 ('ssh dopey') print >>fi, 'ls' fi.close () # <-- this is annoying for line in foe: print line, foe.close () The above connects to a server, passes the command 'ls', which is executed there, and prints the returned result. However, reading from foe succeeds only

httplib question

2004-11-29 Thread Laszlo Zsolt Nagy
Hello, This is from the docs, from section 11.6.1 (HTTPConnection Objects) HTTPConnection instances have the following methods: request( method, url[, body[, headers]]) [.] The headers argument should be a mapping of extra HTTP headers to send with the request. AFAIK the only standard map

Re[2]: httplib question

2004-11-29 Thread Laszlo Zsolt Nagy
Hello Stuart, Monday, November 29, 2004, 8:59:57 PM, you wrote: > Laszlo, > The "request" method call expects a "body" parameter that defaults to None > as the 3rd method parameter. You will either need to pass in an empty > string as the body parameter, or assign the headers property by named

Re[2]: weird behaviour of "0 in [] is False"

2004-11-30 Thread Laszlo Zsolt Nagy
>> (0 in l) is False >>> True This gives me the same exception. >>> 0 in 1 Traceback (most recent call last): File "", line 1, in ? TypeError: iterable argument required Did you really try these examples? Best, Laci mailto:[EMAIL PROTECTED] web:http://designasign.biz -- http://ma

Re[3]: weird behaviour of "0 in [] is False"

2004-11-30 Thread Laszlo Zsolt Nagy
Tuesday, November 30, 2004, 3:15:27 PM, you wrote: >>> (0 in l) is False True > This gives me the same exception. 0 in 1 > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argument required Sorry, It was 0 in l, not 0 in 1. :-) My fault. > Best,

PIL and antialiasing problem

2004-12-02 Thread Laszlo Zsolt Nagy
Hi all, I have a little problem with PIL. I need to display images in a browser (thumbnails) (this is the selector window). I also need the original version of the image to be displayed in a Java applet. One example: thumbnail: http://designasign.biz/applet/GIF_Small/AIRCRAFT/a10per.png origina

Re[2]: PIL and antialiasing problem

2004-12-02 Thread Laszlo Zsolt Nagy
> Try running ImageFilter.MinFilter on the image before you thumbnail it. > This should make dark lines thicker. > HTH, > Will McGugan You are my man! It worked perfectly! Statement: Sometimes PIL is better than Adobe Photoshop. :-) I also found these with the aid of the wonderful dir() function

import fails

2004-12-05 Thread Laszlo Zsolt Nagy
Hello all, Can anyone explain this: C:\Python\Projects\DbDesigner>python Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from Db.FieldTypes import IdentifierFieldType >>> from Db.FieldTypes

Re[2]: import fails

2004-12-05 Thread Laszlo Zsolt Nagy
> [EMAIL PROTECTED]:~$ cat foo.py > x = 10 > __all__ = [x] > [EMAIL PROTECTED]:~$ cat bar.py > x = 20 > __all__ = ['x'] > [EMAIL PROTECTED]:~$ python -c "from foo import *; print x" > Traceback (most recent call last): > File "", line 1, in ? > TypeError:

Re[2]: import fails

2004-12-05 Thread Laszlo Zsolt Nagy
Hello Fredrik, Sunday, December 5, 2004, 8:31:45 PM, you wrote: > Laszlo Zsolt Nagy wrote: >> Definitely. However, it would be better if the exception occurred on the >> bad assignment (e.g. __all__ = [x]) > it does happen on the bad assignment (i.e. from foo import *) W

Re: byte code generated under linux ==> bad magic number under windows

2004-12-06 Thread Laszlo Zsolt Nagy
> I understand from my reading that a .pyc generated by python anywhere should > run anywhere else - is that true ? > If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I get a 'bad > magic number' trying to execute it under windows (2.4). > What am I doing wrong ? You should use the

Re: httpconnection class handle 302 redirect?

2004-12-07 Thread Laszlo Zsolt Nagy
Hello Joe, Tuesday, December 7, 2004, 3:50:53 AM, you wrote: > Hi , it looks like that HTTPConnection class is not capable to > handle 302 redirect response. Is there any sample implementation > that tackle this problem? I am using python 2.3.3 on Windows > platform. I'm using this method (ins

Re: PIL

2005-03-31 Thread Laszlo Zsolt Nagy
suresh mathi wrote: I use PIL for image manipulation. For drawing rectangles and other shapes PIL was really good. Now i am trying to paste 3 images into a single image. All 3 images that i try to paste are having a transparent background. When i try to open the image and paste the background becom

property and virtuality

2005-03-31 Thread Laszlo Zsolt Nagy
My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. I had the same problems in Delphi before and the solution was the same. I created a private _get method and a public get method. The former one will call the

Re: How To Do It Faster?!?

2005-03-31 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: Hello NG, in my application, I use os.walk() to walk on a BIG directory. I need to retrieve the files, in each sub-directory, that are owned by a particular user. Noting that I am on Windows (2000 or XP), this is what I do: for root, dirs, files in os.walk(MyBIGDirecto

Re: property and virtuality

2005-03-31 Thread Laszlo Zsolt Nagy
I'm not aware of possibility that works as you first expected. You yourself explained why. But _maybe_ you can use lambda here - that creates the layer of indirection one needs. foo = property(lambda self: self.get_foo(), lamda self,v: self.set_foo(v)) Great. I'll think about this and decide w

Re: client-client connection using socket

2005-04-07 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: Hello, I have two client computers, each has its own host name. Hello, I did not understand your problem. I do not see cleary what you want to do? When you say "client", do you mean a client in a client-server architecture? Maybe you want to create a peer-to-peer connec

import statement - package visibility problem

2005-04-07 Thread Laszlo Zsolt Nagy
Hi All! I have the following structure: /Lib/Server/Db/ __init_.py DatabaseConnection.py Adapters/ __init__.py FireBirdConnection.py Important file contents are: /Lib/Server/Db/__init__.py: import DatabaseConnection import Adapters /Lib/Server/Db/DatabaseConnection.py:

Re: doubt regarding main function

2005-04-07 Thread Laszlo Zsolt Nagy
if __name__ == '__main__': test() What is the advantage of this way calling a function. For example, you can have a python script that has this function: def search(keywords,engine='www.google.com') At the end of the script, you can have this: if __name__ == '__main__': import sys

  1   2   >