Hi,
i made a backup script to backup my postgres database.
Problem is that it prompts for a password. It thought i
could solve this by using popen2.
I tested popen2 with dir (i'm on windows 2000, python 2.4.3)
and it works.
However when i try popen2 and my pg_dump command, it prompts
for a
flupke schreef:
snip
Thanks for all the info.
I'm sure i will get it right this time :)
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh schreef:
snip
def get_seconds(td):
... return td.days * (24*60*60) + td.seconds
...
import dis
dis.dis(get_seconds)
2 0 LOAD_FAST0 (td)
3 LOAD_ATTR0 (days)
6 LOAD_CONST 4 (86400)
[EMAIL PROTECTED] schreef:
Hi,
String formatting can be used to converting an integer to its octal or
hexadecimal form:
a = 199
%o % a
'307'
%x % a
'c7'
But, can string formatting be used to convert an integer to its binary
form ?
Thanks in advance.
xiaojf
I don't actually
Duncan Booth schreef:
flupke [EMAIL PROTECTED] wrote:
Using 86400 instead of (24*60*60) is faster
s/is/was/
upgrade to Python 2.5
Indeed, i'm still on 2.4.
I thought 2.5 might give a different result :)
Thanks for the info
Benedict
--
http://mail.python.org/mailman/listinfo/python
Frank Millman schreef:
snip
Not that I know of. The results of my investigations so far seem to
indicate that we have a problem :-(
Here is a link to an article dated 1998 -
https://svn.python.org/www/trunk/pydotorg/windows/OdbcHints.html
Among other interesting stuff, it states -
I'm using a solid DB and i'm accessing it via the odbc module
(activepython).
I get a DbiDate object returned but i don't find a way to decently print
it or get a format like %d/%m%/%y.
I found a few posts but the code doesn't work.
birthd = results[0][4] #info from db
birthd
DbiDate object at
Frank Millman schreef:
flupke wrote:
I'm using a solid DB and i'm accessing it via the odbc module
(activepython).
I get a DbiDate object returned but i don't find a way to decently print
it or get a format like %d/%m%/%y.
I convert it to a datetime() instance, like this -
mydate
Frank Millman schreef:
snip
Well waddyaknow - I get exactly the same, for dates earlier than
1970-01-02. Thanks for finding a bug that would have bitten me sooner
or later.
I will do some investigation. If I find an answer I will post it here,
unless some kind soul saves me the trouble and
flupke schreef:
snip
When i do the same sql from a client, i get this: 1961-02-15
Seems ok.
If i check the catalog, the native field type is listed as 10 positions
and of type date.
Yet when i print it after i got the values i get this which looks very
weird (print value ,str(i), type ,type(i
[EMAIL PROTECTED] schreef:
Hey people!
For the first time I'm doing a client/server application, and I'm
really confused with IPC stuff.
I read the fastest method is shared memory, but I tryed mmap and found
it tedious for the amount of data I'm handling (which is 30K at most,
but mmap
Vinay Sajip schreef:
flupke wrote:
If this bug is fixed, where will i find a fixed version and how do i
install it?
Also, more important to me, what am i doing wrong to get this error
message in the first place?
You're not doing anything particularly wrong, though it's not exactly
good
flupke schreef:
snip
Hi Vinay,
thanks for the info.
I tried to change the handlers.py file.
First, i changed some code in doRollover.
if os.path.exists(dfn):
os.remove(dfn)
try:
#os.rename(self.baseFilename, dfn)
- The rename fails for some reason.
I tried with the move
Vinay Sajip wrote:
flupke wrote:
File C:\Python24\lib\logging\handlers.py, line 134, in doRollover
self.handleError(record)
NameError: global name 'record' is not defined
There's a bug in doRollover's exception handling, which is masking the
true error - which is most probably
Hi,
i'm getting errors with the log module concerning RotatingFileHandler.
I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous
python versions but since i upgraded to 2.4.3 i get these errors:
Traceback (most recent call last):
File C:\Python24\lib\logging\handlers.py,
Is there an easy to convert following hour notation hh:mm
to decimals?
For instance 2 hours and 30 minutes as 2:30 to 2,50
I don't really know where to search for this kind of conversion.
Thanks,
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
flupke wrote:
Is there an easy to convert following hour notation hh:mm
to decimals?
For instance 2 hours and 30 minutes as 2:30 to 2,50
I don't really know where to search for this kind of conversion.
Thanks,
Benedict
I found a way. Not sure if it's the best:
time = 2:3
factor = 100.0
Fredrik Lundh wrote:
flupke wrote:
Is there an easy to convert following hour notation hh:mm
to decimals?
For instance 2 hours and 30 minutes as 2:30 to 2,50
I don't really know where to search for this kind of conversion.
you mean like
timestamp = 2:30
hour, minute
flupke wrote:
snip
I forgot to add that if i check the shared.lib py2exe creates, the
program1 dir and subdirs/files are there so they are included in the
package.
Benedict
Hi,
i solved it by adding the same import statement to the py2exe setup.py
script as in my code:
import sys
Hi,
i have a program with is built like this:
startup.py
dir1/__init__.py
dir1/file1.py
dir2/__init__.py
dir2/file2.py
dir3/__init__.py
dir3/file3.py
The program works but now i want to add the functionality into an
existing program 2. This is program 2:
program2.py
program2dir1/__init__.py
flupke wrote:
Hi,
i have a program with is built like this:
startup.py
dir1/__init__.py
dir1/file1.py
dir2/__init__.py
dir2/file2.py
dir3/__init__.py
dir3/file3.py
The program works but now i want to add the functionality into an
existing program 2. This is program 2:
program2
Thomas Heller wrote:
snip
This has been discussed on the py2exe-users lists, and a fix was found
by David Hess. Fortunately he added it to the wiki:
http://starship.python.net/crew/theller/moin.cgi/LoggingModule
Thomas
Cool, thanks Thomas, i'll give that a whirl
Benedict
--
Hi,
when i run my program and use the logging component, i see this:
2005-09-02 17:07:48,193 INFO windowmain 97 Main window created
2005-09-02 17:07:49,020 DEBUG windowmain 103 Frame wx._windows.Frame;
proxy of C++ wxFrame instance at _b8dd9401_p_wxFrame
2005-09-02 17:07:49,145 INFO firebird
Hi,
i have a property in a class that gets changed
and i would want to know who changes it.
Is there a way i can find out the calling function of a property?
Thanks,
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
Dave Cook wrote:
On 2005-07-19, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
On the other hand I even in its current form I don't see how I would to
the simple things that I need every day. Create a session, set a
cookie, redirect to another url, perform HTTP autentication, create
filter, use
Robert Kern wrote:
chris wrote:
When I think about what I should do I end up with a class XY that has a
method for everything I want to do eg.
class XY:
def read_file
def scale_data
def plot_data
def shelve_data
But somehow that doesn't feel right, especially when I expect the
I have the following test code setup, trying to get the class name of a
subclass in the super class. (Reason why i want this is described below)
file class_name_start.py
import class_name as cn
obj = cn.B()
obj.printclass()
file class_name.py
George Sakkis wrote:
snip
Make printclass a class method:
class A(object):
def __init__(self):
print I'm A
# for python 2.4
@classmethod
def printclass(cls):
print Module, cls.__module__
print Class, cls.__name__
# for 2.3 or older
I need to program and setup serveral webservices.
If i were still using jsp, i would use Tomcat to make the several
applications available on a given port.
How can i accomplish this in Python?
I was thinking about Twisted but it's not clear to me what parts i need
to make a webserver listen on a
Hi,
I developed a package with a structure like this
src/
tesfile.py
dir1/
__init__.py
file1.py
dir2/
__init__.py
file2.py
The testfile is meant to try the code out that is specified in file1.py
and file2.py
Now i have another project where i want to
Damjan wrote:
I developed a package with a structure like this
src/
tesfile.py
dir1/
__init__.py
file1.py
dir2/
__init__.py
file2.py
Importing dir2/file2 from dir1/file1.py works here, because when yuo started
the testfile script the src/ directory
.
10 0001 = 2 clubs
01 1000 = K spades
...
[flupke]
As for straights, if i understand correctly, you make all possible
straights of the cards in the hand and then see if one matches?
Yeah, I originally thought that's what you meant, too. But if you take
the scheme above
Erik Max Francis wrote:
flupke wrote:
Which projects are you talking about? I only found a library in c to
evaluat ranks but i didn't find the code to be very understandable.
pokersource is the main was I was thinking about, yes.
With histogram do you mean something like this:
Card
Hi,
i've included the code so interested people can take a look.
I've tried to expand on the thread of 26/05/2005 on Checking for a full
house. Code is suboptimal as I coded it rather quickly.
I've added the normal classes one would expect from a cardgame: card,
deck, hand etc.
1. I can detect
Hi,
i've included the code so people can take a look.
I've tried to expand on the thread of 26/05/2005 on Checking for a full
house. Code is suboptimal as I coded it rather quickly.
I've added the normal classes one would expect from a cardgame: card,
deck, hand etc.
1. I can detect most things
Erik Max Francis wrote:
flupke wrote:
snip
First of all, my apologies for the double posts. I can only see this
reply and can't see my original messages. I posted the message from home
and work and they didn't show up. We use the same isp at home and at
work so it's probably a problem
Hi,
i've included the code so interested people can take a look.
I've tried to expand on the thread of 26/05/2005 on Checking for a full
house. Code is suboptimal as I coded it rather quickly.
I've added the normal classes one would expect from a cardgame: card,
deck, hand etc.
1. I can detect
flupke wrote:
snip
Thanks for the good ideas people.
Regards,
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
I'm going to be distributing a program based on wxPython python in a
few weeks time. The code will run on windows machines.
Because i don't want the users to move the folders around or mess with
the program or taking copies home to fiddle with it, i was thinking of a
way to check when the
Jarek Zgoda wrote:
flupke napisa(a):
I'm thinking of a function that will generate such a code and put it
in a file. Then when the program starts it checks this file and checks
the code in there with a code that it generates at that time again
based for instance on the current directory
Michael Onfrek wrote:
Hi!
I'm playing with entry again and trying to restrict length of entry
widget to certain number of character, so users cannot enter more
character into it. Any ideas?
Reg. Michael Onfrek
What widget set are you talking about, wxPython pygtk, tkinter?
In wxPython:
Paul Rubin wrote:
Raymond Hettinger [EMAIL PROTECTED] writes:
Your use case for gathering roll statistics probably needs a more
general solution:
hands = {
(1,1,1,1,1): 'nothing',
(1,1,1,2): 'one pair',
(1,2,2): 'two pair',
(1,1,3): 'three of a kind',
(2,3): 'full house',
Raymond Hettinger wrote:
[Benedict]
It would be interesting to see how complicated it would get to write
code to detect the correct hands in poker with wildcards included.
There is an interesting SF project with code written in C:
http://pokersource.sourceforge.net/
In contrast,
Hi,
i tried to use timeit on a function in a class but it doesn't do what i
think it should do ie. time :)
In stead it starts printing line after line of hello time test!
What am i doing wrong in order to time the f function?
class TimeTest(object):
def f(self):
print hello time
Fredrik Lundh wrote:
flupke wrote:
i tried to use timeit on a function in a class but it doesn't do what i
think it should do ie. time :)
In stead it starts printing line after line of hello time test!
What am i doing wrong in order to time the f function?
how do you expect timeit
Kent Johnson wrote:
flupke wrote:
Hi,
i tried to use timeit on a function in a class but it doesn't do what
i think it should do ie. time :)
In stead it starts printing line after line of hello time test!
What am i doing wrong in order to time the f function?
Hmm, by default
DE wrote:
Hello,
I have an app with embedded Python. Python scripts create their own
threads and I need to terminate these threads at the point where the
user wants to leave the application. I use threading.Thread as base
classes.
I have tried to use call the join method of the python
flupke wrote:
snip
I solved it by getting the latest py files from CVS and overwriting the
existing ones. It gave an Attribute error but that was gone after
commenting this line:
#isc_info_isc_version = _k.isc_info_isc_version
I'm not sure if this is a safe way of working. It's
Hi,
i'm developing an app that uses wxPython and Firebird via kinterbasdb on
Win XP SP2. On insert of a record i get this error:
(kinterbasdb.InterfaceError)
(0, Type mismatch: Input parameter for field named [name n
ot known at this stage of query execution] must be a string, rather than
a
flupke wrote:
snip
I finally succeeded in making a proper mci.dll that works. I will
document what i did in the coming days and place it here. I developed
the dll with DevC++.
Anyway, it all works :)
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
i am in search of a cddb module for Python on windows. I stumbled upon
http://sourceforge.net/projects/cddb-py but couldn't use it since the
mci.dll is compiled against Python2.0.
So i'm trying to rebuild it using Dev-C++. I've succeeded in building a
dll but when i try a test program it
phil wrote:
Then i got a tip that you can register a function that needs to be
called when the object is going to be deleted.
For instance to register a function __exit, you do this:
Here is the complete line class with your suggestion:
Below is the output.
Nice idea, maybe I did
I'm using wxPython and design the gui via wxglade. One of the gui
components is a simple dialog class that gets displayed when a user
exits the program.
I want to use the same dialog but with a different text for closing
certain dialogs in the program. (it's a pure do you want to exit
insert
Fredrik Lundh wrote:
flupke wrote:
Then i got a tip that you can register a function that needs to be
called when the object is going to be deleted.
For instance to register a function __exit, you do this:
class line:
def __init__(s,glob,argl,color=''):
atexit.register(s
flupke wrote:
I'm using wxPython and design the gui via wxglade. One of the gui
components is a simple dialog class that gets displayed when a user
exits the program.
I want to use the same dialog but with a different text for closing
certain dialogs in the program. (it's a pure do you
phil wrote:
snip
A class instance based language doesn't have to BE C++ to have a
destructor method.
All I wanted to know is: is the apparent treatment of __del__
which SEEMS to work fine for me in 2.3.4 deprecated or mangled
in some later release or future plans.
If someone doesn't know
Vinay Sajip wrote:
flupke flupke at nonexistingdomain.com writes:
Hi,
i have a class and a class attribute log which is a logger object. In
the __del__() function i want to log a message but it fails even if i
use self.__class__.log.
The error i get is this:
Traceback (most recent call
Hi,
i have a class and a class attribute log which is a logger object. In
the __del__() function i want to log a message but it fails even if i
use self.__class__.log.
The error i get is this:
Traceback (most recent call last):
File C:\Python24\lib\logging\__init__.py, line 712, in emit
Hi,
i'm starting work and a simple database layer and wanted to use the
__del__ to open and close a connection. However, i get an erro when
executing this script:
class Table:
refcount = 0
def __init__(self, name):
self.name = name
print table %s % repr(self)
[EMAIL PROTECTED] wrote:
look at this discussion:
http://www.dbforums.com/archive/index.php/t-1100372.html
it looks like we have to use other way, hold the data we want to
preseve in an object, because it is possible the class is removed
before the instance cleaned, and we can not expect __del__
Richard Lyons wrote:
Has anyone been successful in using Glade for Windows with Python?
Yeah, i'm using it right now.
See the previous email for the links
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
Dave Cook wrote:
On 2005-04-09, flupke [EMAIL PROTECTED] wrote:
i create my GUIs mainly via wxGlade. However when you start of to
program and want to do some rearranging to the gui, wxglade overwrites
your file and you've got to put your own code back in.
How about generating XRC files instead
Hi,
i create my GUIs mainly via wxGlade. However when you start of to
program and want to do some rearranging to the gui, wxglade overwrites
your file and you've got to put your own code back in.
I think i can work around that (at least a bit) by making a second file
that imports the gui
Jeremy Bowers wrote:
snip
Domain-specific abstractions do that *faster* than GUI designers, not
slower. And better, too, since every iteration tends to be fully
functional and not just a let's see what this looks like prototype.
Heck, switch 'em out dynamically based on what day of the week it is
Hi,
i need to develop a gui which will load several windows depending on
what the users selects in the menu and i thought i could accomplish this
with panels.
What i'm trying to do to test this is load an initial panel and then
when the user hits a button load a second panel. This doesn't seem
Lucas Raab wrote:
flupke wrote:
Hi,
i capture a movie from mividv to an avi containing the dv video. I
found a program that reads the timestamp from the avi so you know the
exact date and time the video was shot. However, the source of that
program is not available and it doesn't allow to batch
Hi,
for an old intranet that is still used here, i would like to add a
search function.
I think there migth already be an indexer/search script available in
python. I've googled and come across a few scripts but i'm not sure
which one is really easy and good at the task.
Any good scripts (and
Hi,
a lot of applications here a made with access. Tables, forms, reports
and the like. Now i rather use Python to do this but i'm not sure how to
proceed. I can use wxPython for a gui via wxGlade for rapid testing and
design (forms), MySQL as db (tables) but the report part is what's
flupke wrote:
Hi,
a lot of applications here a made with access. Tables, forms, reports
and the like. Now i rather use Python to do this but i'm not sure how to
proceed. I can use wxPython for a gui via wxGlade for rapid testing and
design (forms), MySQL as db (tables) but the report part
Hi,
i need to develop an app here which will be used to produce stats.
I'm going to go with twisted pb for the client server communication.
And wxPython for the GUI.
Now i would want to split the GUI code from the pb code to make
debugging easier amongst other things but i'm not sure how i would
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 15
Message-ID: [EMAIL PROTECTED]
Date: Thu, 06 Jan 2005 15:13:42 GMT
NNTP-Posting-Host: 212.123.8.34
X-Complaints-To: [EMAIL PROTECTED]
X-Trace: phobos.telenet-ops.be 1105024422 212.123.8.34 (Thu, 06
Peter Hansen wrote:
snip
On my machine, I have a folder called c:\bin where I put useful
batch files. I have a python23.bat and a python24.bat file,
which basically just call c:\python23\python.exe or
c:\python24\python.exe as required. For various reasons which
may or may not apply to you as
Vinay Sajip wrote:
It works for me:
#file3.py
import file1
import file2
a = file1.A()
b = file2.B()
b.otherfunction()
gives
2004-12-28 00:18:34,805 DEBUG file2 6 creating class B
2004-12-28 00:18:34,805 DEBUG file2 9 in otherfunction
yeah, the classes where a simplification of the classes i'm
I searched with Google and on this newsgroups and i didn't find any info
regarding this. If there is more info, please redirect me to that info.
I have version 2.3.4 and 2.4 installed on windows and i thought that by
switching the PYTHONPATH parameter to the dir of the 2.4 version that
that
Hi,
at work we use a solid database and i need to develop an application
that accesses it. Problem is the drivers: i only have some dll's lying
around and jar.
On winsdows i could get by by using ODBC and the dll's to access the
solid database but i want to eventually run it on a linux server.
flupke wrote:
snip
Thanks for the info.
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
previously i made an application that used sockets to
do some network based processing.
My next app is again going to be a client/server app
and i wanted to see if i can't find an easier way to
make the networking going.
I bumped into xmlrpclib and also twisted (pb).
I'm not sure which on of
77 matches
Mail list logo