Re: A useful, but painful, one-liner to edit money amounts

2010-08-05 Thread DarkBlue
On Aug 5, 7:06 pm, Chris Withers ch...@simplistix.co.uk wrote: Peter Otten wrote: locale.setlocale(locale.LC_ALL, (en_US, UTF-8)) 'en_US.UTF8' print locale.currency(13535, grouping=True) $13,535.00 Okay, so if I'm writing a wsgi app, and I want to format depending on the choices of the

Re: KinterBasDB - how to change the mode: embedded/server

2010-06-11 Thread DarkBlue
On Jun 11, 5:07 pm, durumdara durumd...@gmail.com wrote: Hi! I want to use KinterBasDB in mixed mode: sometimes embedded, sometimes real local/remote server. How can I set up the connection to KinterBasDB can determine, what mode I want to use? Thanks for your help:    dd you could use 2

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-24 Thread DarkBlue
On Apr 22, 4:55 pm, joamag joa...@gmail.com wrote: Does anybody know a cross platform way to retrieve the default DNS server IP address in python ? Thanks ! João import os,urllib2,re def getIpAddr(): Function for parsing external ip adress by pinging dyndns.com

Re: PyQt processEvents not processing

2009-11-07 Thread DarkBlue
On Nov 8, 12:04 am, David Boddie da...@boddie.org.uk wrote: On Saturday 07 November 2009 05:12, DarkBlue wrote: qt 4.5.3 pyqt 4.6.1 python 2.6 I have this QtTable widget which I want to refresh once about every 2 seconds with new data. so I do :  def updateSchedule(self

Execution order

2009-09-11 Thread DarkBlue
Here is some code from a pyqt4.5.4 application on python 2.6 def findData(self): self.ui.label.setText('Processing... ') # here we do something which takes a few seconds self.refreshGrid() The problem is that the text in the self.ui.label is only changed on screen after

Re: Execution order

2009-09-11 Thread DarkBlue
On Sep 11, 9:34 pm, Diez B. Roggisch de...@nospam.web.de wrote: DarkBlue wrote: Here is some code from a pyqt4.5.4  application on python 2.6 def findData(self):       self.ui.label.setText('Processing... ')       # here we do something which takes a few seconds

print() a list

2009-09-04 Thread DarkBlue
I am trying to get used to the new print() syntax prior to installing python 3.1: test=[[VG, Virgin Islands, British],[VI, Virgin Islands, U.S.], [WF, Wallis and Futuna],[EH, Western Sahara],[YE, Yemen], [ZM, Zambia],[ZW, Zimbabwe],] #old print for z in test: if z[0].startswith('W'):

pyuno store OO object into blob

2008-10-12 Thread DarkBlue
Hello Python 2.5.1 Qt 4.4.0 PyQt 4.4.2 OO 2.4.1 Firebird 2.1 I want to store an openoffice writer object into a blob field using the pyuno bridge. I read about the possibility of using streams , but only see some old basic or java examples . The writer document has been created and stored into

Re: sqlobject issue/question...

2007-12-29 Thread DarkBlue
On Dec 29, 12:27 pm, bruce [EMAIL PROTECTED] wrote: hi i'm playing around, researching sqlobject, and i notice that it appears to require the use of id in each tbl it handles in the database. if i already have a db schema, and it doesn't use 'id' as an auto-generated field, does that

Re: kniterbasdb and datetime

2007-12-13 Thread DarkBlue
On Dec 13, 7:45 pm, Laszlo Nagy [EMAIL PROTECTED] wrote: Hi All, I connected to a FireBird 1.5 database this way: import kinterbasdb kinterbasdb.init(type_conv=200) # Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx... Then I try to update the database: sql =

Kinterbasdb needs new maintainer

2007-08-26 Thread DarkBlue
Sorry to interrupt the regular programming here . As has been reported on some websites the maintainer of kinterbasdb David Rushby has died last month after a diving accident. Kinterbasdb is the python wrapper around the Firebird database api and an excellent opensource project. The hope is ,

Document creation with odfpy

2007-07-20 Thread DarkBlue
Hello I hope here is the right place to ask this: I use the python odfpy library to create and load an odt file , however, spaces in the passed in text are removed. http://opendocumentfellowship.org/development/projects/odfpy python2.4 from odf.opendocument import OpenDocumentText from

wx.grid 2.6.1.0 events

2007-06-11 Thread DarkBlue
Hello pythoncard wx 2.6.1 python 2.4.x kinterbasdb firebird I have a wx.grid filled with data from a database one of the fields is a blob field with text data, which I want to display in some adjacent text control when I scroll through the grid. The question is which wx.EVT_XXX do I need to use

Re: Mastering Python

2007-04-01 Thread DarkBlue
Before we get to far away from the original question... as you have may have noticed you reached one of the best user groups on the net , where help from the top gurus and best minds in the python universe is only a question away. Go for it, you are in good hands. Db --

Re: How can I speed this function up?

2006-11-18 Thread DarkBlue
Just to show how much a system set up impacts these results: Result from suse10.1 64 , python 2.4 with AMD FX-55 cpu and about 12 active apps running in the background. 7200rpm sata drives. Preparing data... [write_data1] Preparing output file... [write_data1] Writing... [write_data1] Done in

Kde Taskbar

2006-10-07 Thread DarkBlue
Hello In linux I use kmail as my email client under KDE, if a message comes in the Kontact button in the taskbar changes to blue. How can I have the same behaviour in a python app ? I have a python script which runs nicely under linux now every so often I want to be notified by some event, in

Re: Kde Taskbar

2006-10-07 Thread DarkBlue
Diez B. Roggisch wrote: pykde afaik supports systray-iconified apps. And you could use the dcop-mechanisms that are available as command line tools as well I guess, and invoke knotify. Hope this gives you some pointers - I'm currently on my mac so I can't provide an actual example.

Re: Kde Taskbar

2006-10-07 Thread DarkBlue
David Boddie wrote: On Saturday 07 October 2006 14:59, DarkBlue wrote: In linux I use kmail as my email client under KDE, if a message comes in the Kontact button in the taskbar changes to blue. How can I have the same behaviour in a python app ? You need to activate the window

baffling sql string

2006-09-27 Thread DarkBlue
Following is a code snippet from a pythoncard app the problem is with the sql string called iq1 If either mysubject or mytalktext contains an apostrophe the update fails : Example: mysubject=Let's Eat this fails mysubject=Lets Eat this works fine What options do I have to avoid this

Re: baffling sql string

2006-09-27 Thread DarkBlue
Duncan Booth wrote: ... depending on your actual database you might need to use something other than %s to specify the parameters. Check out 'paramstyle' for your database connection. Thank you all for prompt suggestions I am using firebird 1.5.3 with kinterbasdb Db --

mac address

2006-09-07 Thread DarkBlue
Hello Is it possible to get the mac address of a device with python 2.4 using code which works in wxp and linux rather than requiring some code for windows and some other code for linux ? Db -- http://mail.python.org/mailman/listinfo/python-list

Netstat Speed

2006-09-02 Thread DarkBlue
Following code works . My question is can I make it faster ? def activeip(checkip): # if there is any line returned we set activeb to 1 indicating that # this ip is active during a netstat run activeb=0 for line in os.popen(netstat -a -n | grep '%s' % checkip)

Re: Netstat Speed

2006-09-02 Thread DarkBlue
s=line is actually indented even if it does not appear to be so :) Db -- http://mail.python.org/mailman/listinfo/python-list

Re: Netstat Speed

2006-09-02 Thread DarkBlue
Sybren Stuvel wrote: DarkBlue enlightened us with: Following code works . No it doesn't - it's indented badly. I guess you mean something like: def activeip(checkip): # if there is any line returned we set activeb to 1 indicating that # this ip is active during a netstat run

PythonCard question

2006-08-17 Thread DarkBlue
Is it possible to create pythoncard textField components dynamically during run time ? Something on the lines of pseudo code : def make_textfield(length,topleftposx,topleftposy): doit self.make_textfield(120,20,20) Thanks for any ideas. --

Re: Time out question

2006-07-03 Thread DarkBlue
Sure, see function setdefaulttimeout in module socket. Just call it as you wish before trying the DB connection and catch the resulting exception. Alex That should do it. Thanks Db -- http://mail.python.org/mailman/listinfo/python-list

Time out question

2006-07-02 Thread DarkBlue
My application makes several connections to a remote database server via tcp/ip. Usually all is fine,but occasionally the server is down or the internet does not work and then there is the 30 sec to several minutes timeout wait for the tcp to give up. Is there anything I can do without using

Re: wxPython GUI designer

2006-06-19 Thread DarkBlue
Take a look at pythoncard , we use it to produce database frontends , but apparently it also can be used for simple graphics apps and others. However if you are used to things like the Delphi IDE to build a gui app , then prepare to shed lots of tears before overcoming the initial disbelieve,

wxPython install question

2006-06-14 Thread DarkBlue
Trying to install wxPython on Suse10.1 64 with gcc4.1.0 and get wxPython-src-2.6.3.2/wxPython # python setup.py install Found wx-config: /usr/local/bin/wx-config Using flags: --toolkit=gtk2 --unicode=no --version=2.6 Preparing CORE... Preparing GLCANVAS... Preparing STC... Preparing

Import elfclass32 issue

2006-06-11 Thread DarkBlue
Hello Suse10.1 64 new install if I try to import anything into python2.4.2 like : python - c import kinterbasdb I get this : wrong ELF class: ELFCLASS32 Before doing anything wrong , what would be the right thing to do to get rid of this error ? Thanks. --

Re: Import elfclass32 issue

2006-06-11 Thread DarkBlue
Sybren Stuvel wrote: file /path/to I installed the package on other 64 machines running suse9.2 64 and 9.3 64 without trouble That's the way : python setup.py build result: successfull python setup.py install result: successfull then tried to import and I get the elfclass32 error and

Re: Import elfclass32 issue

2006-06-11 Thread DarkBlue
Fredrik Lundh wrote: if you do, it's a SuSE problem (this wouldn't be the first time SuSE ships broken Python software) Thanks for the input . Following your message I reinstalled python2.4 and the modules I want to use and now everything is fine. --

Pythoncard question

2006-05-04 Thread DarkBlue
I am trying to port a Delphi database application to python on linux with a firebird database backend and I am using pythoncard to recreate the gui. I will have about 25 delphi forms to be recreated and I would like to know what is the best way to call them up from within each other . There is a

Re: Unpacking of query result

2006-04-30 Thread DarkBlue
Hello Following part of an database query works fine : self.cur=con1.cursor self.cur.execute('select a,b,c,d from t1') for (a,b,c,d) in self.cur: print a,b,c,d but how to do this: self.cur.execute(sql_select_text_put_in_at_runtime) for (whatever_was_in_the_select_text_part_of_the_query)

Re: Unpacking of query result

2006-04-30 Thread DarkBlue
Thank you Mission accomplished. Have a nice sunday Db -- http://mail.python.org/mailman/listinfo/python-list

Re: finding IP address of computer

2006-04-28 Thread DarkBlue
Chris wrote: How do I find and print to screen the IP address of the computer my python program is working on? def readip(): import re, urllib f = urllib.urlopen('http://checkip.dyndns.org') s = f.read() m = re.search('([\d]*\.[\d]*\.[\d]*\.[\d]*)', s) return m.group(0) myip = readip()

Re: ssh question

2006-01-14 Thread DarkBlue
should read ssh , (probably should not post anything so late in the evening) Db -- http://mail.python.org/mailman/listinfo/python-list

ssl question

2006-01-13 Thread DarkBlue
Hello python 2.4 I want connect to another linux machine via ssl , after password entry execute : cat /home/myfile.txt and return the result into a list for further processing then close the connection What is the safest and best way to do this ? Db --

Line replace

2006-01-01 Thread DarkBlue
Hello I need some help I have a text file which changes dynamically and has 200-1800 lines. I need to replace a line , this line can be located via a text marker like : somelines # THIS IS MY MARKER This is the line to be replaced somemorelines My question is how to do this

Re: Line replace

2006-01-01 Thread DarkBlue
Steven D'Aprano wrote: Let me see if I understand your problem... you need to edit a text file in place at the same time that another process is also changing the file in place? That's hard. You need some way to decide who gets precedence if both you and the other process both try to change

Re: Line replace

2006-01-01 Thread DarkBlue
Why don't you use the database to store those markers? It should support concurrent updates properly. That's a database's job. The markers are just there to have a static way to find the line after the marker, which is the one which might have to be changed. Nx --

Re: Line replace

2006-01-01 Thread DarkBlue
OK, why don't you store those changing lines in the database? Can you arrange for those changeable lines to be fixed length, i.e. by padding with spaces or something? If you can, then you could just overwrite them in place. Use flock or fcntl (Un*x) or the comparable Windows locking

Re: Line replace

2006-01-01 Thread DarkBlue
Thank you for all the suggestions It appears the safest solution still is using a temp file as was so apt suggested further up here without it I maybe white water rafting without a canoe. I also will test the feasibility to regenerate the whole file from the database. Nx --

Automate webpage refresh

2005-12-01 Thread DarkBlue
I am trying to write a script (python2.3) which will be used with linux konqueror to retrive 2 webpages alternatively every 2 minutes. My question is how can I send alternative args (the url) to the same invocation of konqueror which I started with def pipedreams(program, *args): pid =

Re: Automate webpage refresh

2005-12-01 Thread DarkBlue
Thanks for replies . dcop , hmmm I had not thought of this . D.B. -- http://mail.python.org/mailman/listinfo/python-list