Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-26 Thread Ed Leafe
On Jan 26, 2021, at 18:16, Grant Edwards  wrote:
> 
>> How do you troubleshooting/debugging in Python?
> 
> Mostly I read exception trace and read the code and think about it.
> 
> If that doesn't work, I add some print() or syslog() calls.
> 
> If I really get stuck, I try to write as small a program as possible
> that demonstrates the problem.

I do the first two, but if I get really stuck, I use the pudb debugger 
(https://pypi.org/project/pudb/).

Using that, I can see all the locals, jump to any point in the stack and see 
the locals there, or shell into ipython if I need to run some quick code. For 
me, this is much faster than trying to write an additional program that is 
close enough to the problem code to be useful.

-- Ed Leafe






-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What user-defined request error levels are recommended?

2020-04-30 Thread Ed Leafe via Python-list
On Apr 30, 2020, at 15:14, Dan Campbell  wrote:
> 
> Hi, what range of error codes are recommended, if we wanted to return a 
> user-defined code?
> 
> Obviously, we don't want to use a code in the 200+ range, or the 400+ range, 
> e.g.
> 
> I want to throw, or just return, a code that represents that the size of a 
> web page (len(response.content)) is less than the expected size.

You can create your own internal codes as long as they don’t clash with the 
standard code. If the custom code is for a success, a 2xx code would be 
appropriate. If it is a user error, you could use a 4xx code.

However, I would prefer to use the standard codes, and add a custom header with 
more information on the issue.


-- Ed Leafe






-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to force "python -m site" ENABLE_USER_SITE to false?

2019-06-21 Thread Ed Leafe
On Jun 21, 2019, at 8:49 AM, Malcolm Greene  wrote:
> 
> Any suggestions on how one can force the "python -m site" ENABLE_USER_SITE 
> value to false?
> 
> Is it possible to globally force this setting - across all users - when 
> installing a system wide version of Python ... or via a command line option 
> when starting a Python session?

>From StackOverflow: 
>https://stackoverflow.com/questions/25584276/how-to-disable-site-enable-user-site-for-an-environment

-- Ed Leafe





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 3:08 PM, Joel Goldstick joel.goldst...@gmail.com wrote:

 Would following
 this recommendation improve script performance?
 
 Not performance, but human readability

IMO, this isn't always the case. There are many lines of code that are 
broken up to meet the 79 character limit, and as a result become much less 
readable. 


-- Ed Leafe





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 5:30 PM, Devyn Collier Johnson devyncjohn...@gmail.com 
wrote:

 Evidently, it is personal preference. I prefer to read computer code like a 
 book (yes, I am a weirdo (^u^)). The only time I exced 79 characters is when 
 I write a set of commands that perform similar tasks. I do not make too many 
 lines over 79 char. Thanks everyone for the comments and feedback.

I have heard this statement before, and so I'm wondering: do you read books 
printed in monospaced typefaces, or do they have proportional fonts? I've yet 
to come across anything meant to be read as literature that was monospaced, 
because it is much harder to read.

I had read about a developer who switched to using proportional fonts for 
coding, and somewhat skeptically, tried it out. After a day or so it stopped 
looking strange, and after a week it seemed so much easier to read. I only 
switched back because I found I lost productivity switching from vim to a 
graphical text editor.


-- Ed Leafe





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDE for GUI Designer

2013-04-04 Thread Ed Leafe
On Apr 4, 2013, at 10:41 AM, Renato Barbosa Pim Pereira 
renato.barbosa.pim.pere...@gmail.com wrote:

 Guys, is this, I wonder if there is an IDE with native support for the 
 development of GUI's such as Netbeans with Swing,Visual Basic, etc., already 
 tested the Boa Constructor, and PyQt, but did not like what I'm looking for 
 is an IDE all in one, ie power encode and draw the screens of the program, 
 someone indicates some?, but what I would like to knoweverything together 
 with an IDE: Coding + GUI (via visual elements) without the need to import or 
 export anything, like so: I want a button, I click and drag it to a window, 
 give two clicks and encode their actions, understand?

Check out Dabo: http://dabodev.com


-- Ed Leafe (one of the authors)





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dbf.py API question

2012-08-07 Thread Ed Leafe
On Aug 2, 2012, at 10:55 AM, Ethan Furman wrote:

 SQLite has a neat feature where if you give it a the file-name of ':memory:' 
 the resulting table is in memory and not on disk.  I thought it was a cool 
 feature, but expanded it slightly: any name surrounded by colons results in 
 an in-memory table.
 
 I'm looking at the same type of situation with indices, but now I'm wondering 
 if the :name: method is not pythonic and I should use a flag (in_memory=True) 
 when memory storage instead of disk storage is desired.

When converting from paradigms in other languages, I've often been 
tempted to follow the accepted pattern for that language, and I've almost 
always regretted it.

When in doubt, make it as Pythonic as possible.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 17, 2012, at 5:57 PM, Ethan Furman wrote:

 In Foxpro if you do a
 
 GOTO 7
 
 with deleted off and record 7 is deleted, the record pointer doesn't
 move (at least in version 6).
 
 I don't like that.
 
 I see four other options:
 
 0) don't move the pointer (listed for completeness)
 1) go to that record anyway
 2) go to the next undeleted record
 3) go to the seventh undeleted record (possibly the least practical)
 4) raise an exception
 
 Any opinions?

It's been many years since I fired up VFP, but the above doesn't sound 
correct. If you have SET DELETED OFF and the GOTO 7, the pointer should move to 
the 7th record, whether it is marked deleted or not. With SET DELETED ON, the 
pointer should not move, since 7 is not a valid record.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:16 PM, Ethan Furman wrote:

 Your memory is good!  I typed it in wrong.

Well, I was an MVP for Visual Foxpro for 10 years, so... 

;-)

 I see four other options:
 
 0) don't move the pointer (listed for completeness)
 1) go to that record anyway
 2) go to the next undeleted record
 3) go to the seventh undeleted record (possibly the least practical)
 4) raise an exception
 
 I still don't like it.  Any opinion on the other four choices?  I'm leaning 
 towards 1, possibly with 4 as an option:

#4 is probably the most Pythonic approach. The calling code can then 
decide how to react to attempting to access a deleted record. Even if you're 
accessing data stored in VFP tables, your module should be as Pythonic as 
possible.

 Part of the reason I feel this is reasonable is that with my dbf module it is 
 possible to create an index that does /not/ include certain records:

Deleting a record in VFP doesn't remove it from the index; I believe it 
marks that index entry as deleted, too. I think that as long as you treat the 
deleted status as the same as any other boolean column you'll be good.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:57 PM, MRAB wrote:

  #4 is probably the most Pythonic approach. The calling code can then 
 decide how to react to attempting to access a deleted record. Even if you're 
 accessing data stored in VFP tables, your module should be as Pythonic as 
 possible.
 
 I disagree. I think that if you can see it should be able to go to it.

The use case was a deleted record with SET DELETED ON, which means you 
shouldn't see it. 


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo 0.9.4 Released!

2011-10-07 Thread Ed Leafe
On Oct 6, 2011, at 12:18 PM, Neal Becker wrote:

 What is it?

Sorry, I guess I should have included that. We've been around for so 
long I sometimes assume that everyone knows what Dabo is.

Dabo is a framework for building desktop applications. It is strongly 
geared toward database applications, although a database connection is 
completely optional. We wrap the wxPython GUI toolkit, hiding its C++ roots and 
presenting a more Pythonic interface for creating your UI.

 See more at http://dabodev.com, and feel free to ask any more 
questions.



-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Dabo 0.9.4 Released!

2011-10-06 Thread Ed Leafe
Yes, it's been over a year, but today we're finally releasing Dabo 
0.9.4!

What can I say? While we've been actively developing Dabo all along, 
and committing improvements and fixes regularly, we don't seem to get around to 
doing releases as often as we should. Since Dabo has a Web Update feature that 
lets developers receive regular updates between releases, most people are 
fairly current, but creating a new release will help newcomers to Dabo get up 
to speed quicker.

The changes won't be too big for most current users of the framework, 
but compared to the 0.9.3 release, lots has been fixed and improved! Full 
release notes are at:
http://svn.dabodev.com/dabo/tags/dabo-0.9.4/ChangeLog

...but here are just a few of the major changes since 0.9.3:

- better handling of edge cases in bizobj relations
- addition of support in bizobjs for many-to-many relationships
- improved efficiency in detecting changed records
- added the dDatePicker control
- added the option of vertical text for grid headers
- integrated a code editor into the command window

You can grab the latest version, as always, from 
http://dabodev.com/download



-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hello, and request for help with 'dynamic grids'

2011-10-03 Thread Ed Leafe
On Sep 5, 2011, at 8:33 AM, Simon Cropper wrote:

 Dabo is a great product. Spoke extensively with Ed Leafe and Paul McNett. 
 Unfortunately the framework is not 'dynamic'. If you have an fixed database 
 and tables it can quite quickly create a basic data entry setup and menu. 
 Looks great when it runs. The problem is creating the window and grid on the 
 fly.

Sorry, someone just pointed me to this message.

Of course we can build a window and grid on the fly: the command is:

form, grid = dabo.ui.browse(data)

...where data is a data set, or any object with a getDataSet() method, such 
as a bizobj or a cursor. I demonstrated this at my session at PyCon 2007: 
http://www.youtube.com/watch?v=y8G8AefXDo8t=3m6s

If you don't want to do this in a separate window, you can call the 
grid's buildFromDataSet() method directly. This command has a ton of optional 
parameters to control just how you would like the grid to appear.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Ed Leafe
Religious fervor is one thing; freedom of religion is another!  ;-)

We strive for readability in our code, yet every printed material designed to 
be read, such as books, newspapers, etc., uses a proportional font. I switched 
to proportional fonts years ago, and am only reluctantly using fixed width 
because of vim. It doesn't take as long to get used to as you might think. 

-- Ed

Sent from my iPhone, so please excuse any top-posting.

On Jul 21, 2011, at 8:12 PM, Roy Smith r...@panix.com wrote:

 There are very few things I am absolutely religious about, but 
 programming in a fixed width font is one of them.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Style question for conditional execution

2010-11-24 Thread Ed Leafe
On Nov 24, 2010, at 1:46 PM, Gerald Britton wrote:

 Say that I have some function f that I will execute if some variable
 v evaluates true.  Using a classical procedural approach, I might
 write:
 
if v:
f()
 
 I might, however, think more in a functional-programming direction.
 Then I might write:
 
v and f()
 
 Interestingly, this second expression compiles smaller (though only by
 a little) in both Python 2.6 and 3.1, which I currently have
 installed.  If I had thousands of such expressions, I could boast
 about a measurable difference but practically speaking, it is not
 significant.
 
 What I _am_ interested in, however, is feedback from a style perspective.
 
 What do the rest of you think about this?

Readability is key. The first is instantly understandable; the second 
only if you are familiar with that particular programming construct. Explicit 
is better than implicit, so I'd go with the first form.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Dabo 0.9.3 released

2010-09-13 Thread Ed Leafe
It's been a while, but we've finally released version 0.9.3 of the Dabo 
framework! Since Dabo has a Web Update feature that lets developers receive 
regular updates between releases, the changes won't be too big for most current 
users of the framework, but compared to the 0.9.2 release, lots has been fixed 
and improved! Full release notes are at:
http://svn.dabodev.com/dabo/tags/dabo-0.9.3/ChangeLog

...but here are the major changes since 0.9.2:

- integration of the native Python logging module for all Dabo logging
- support for DES3 cryptography in Dabo encryption
- changed all pathing to be relative to the app's HomeDirectory
- full parameterization of SQL calls
- addition of the dRichTextBox control
- improvement of unicode support with the dabo.lib.ustr() method

You can grab the latest version, as always, from 
http://dabodev.com/download


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WMI in Python

2010-09-13 Thread Ed Leafe
On Sep 13, 2010, at 9:51 AM, KING LABS wrote:

 I am trying to learn Python programming. Since I need a custom
 inventory management tool for my work place. I am considering it as a
 project in the process of learning Python.
 
 I am not looking for easiest way of doing things.
 I am considering using Python . Also I would need to build a setup of
 the tool for easy installation.
 
 Hope I am clear this time


If you're looking for a rich client (i.e., desktop) application, and 
not a web app, you should check out Dabo: http://dabodev.com. We have hundreds 
of developers around the world using Dabo to build many different kinds of 
business applications.


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: combined functionality of ipython's %whos and pdb's next (without a resource heavy IDE)

2010-07-30 Thread Ed Leafe
On Jul 29, 2010, at 3:39 PM, Benjamin J. Racine wrote:

 I am trying to combine the ability to move line-by-line through the code as 
 is done with pdb's next function with ipython's ability to list all 
 variables at once... without the use of a full-fledged IDE.
 
 I am not seeing how this might be done.  Many thanks for your help...

Check out PuDB - I use it all the time. http://pypi.python.org/pypi/pudb

Intro screencast is at http://vimeo.com/5255125


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python app development

2010-07-06 Thread Ed Leafe
On Jul 3, 2010, at 1:48 PM, mo reina wrote:

 an anyone recommend a resource (book,tutorial,etc.) that focuses on
 application development in python? something similar to Practical
 Django Projects, but for stand alone applications instead of web apps
 (for now).

You should definitely check out Dabo. Several years ago we were looking 
for something in Python for developing desktop apps, and while there were 
several useful tools, there wasn't anything that integrated them together. That 
was our motivation for creating Dabo.

We have a few screencasts to help you get acquainted with Dabo; I'd 
recommend these two to start:

http://cdn.cloudfiles.mosso.com/c129431/dataenvironment1.html
http://cdn.cloudfiles.mosso.com/c129432/dataenvironment1.html

We also have a pretty comprehensive tutorial document, available at:

http://dabodev.com/pycon_tutorial

If you have any other questions, join our email discussion list and 
post them there. There are many helpful people there to answer your questions.

http://leafe.com/mailman/listinfo/dabo-users



-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DB Table Processor?

2009-12-28 Thread Ed Leafe
On Dec 27, 2009, at 11:31 AM, A. Shore wrote:

 Folks, I'm considering developing a particular app in Python - I've
 been working in PHP for some years now - and it will be db-intensive.
 Whether it's based on sqllite or mySQL is TBD as of right now.
 
 One tool that's done me well in the past is a generalized table
 processor, which I use as a way of getting early visualization into
 the app's requirements.  That is, given an existing schema, it will
 generate or perform the C R U D  functions on each table comprising
 the schema, with no/little code needing to be written.
 
 I've searched without success in trying to locate some - hopefully FOS
 - py-based utility that will do this for me.

If you prefer a rich client app instead of a browser-based app, you 
should look into Dabo. We have an AppWizard that creates a searchable CRUD app 
in less than a minute. You can view a screencast of the AppWizard in action at 
http://j.mp/6kRp0u. It works with MySQL, SQLite, PostgreSQL, and MS Sql Server.

More information can be found at http://dabodev.com


-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Dabo 0.9.2 released

2009-06-04 Thread Ed Leafe
	At long last, we are finally releasing Dabo 0.9.2. This fixes the  
errors that were found in 0.9.1; adds a brand-new Web Update  
implementation that should make keeping current much easier, as well  
as a whole bunch of improvements under the hood.


You can grab the latest version at http://dabodev.com/download.


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Dabo 0.9.2 released

2009-06-01 Thread Ed Leafe
	At long last, we are finally releasing Dabo 0.9.2. This fixes the  
errors that were found in 0.9.1; adds a brand-new Web Update  
implementation that should make keeping current much easier, as well  
as a whole bunch of improvements under the hood.


You can grab the latest version at http://dabodev.com/download.


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Dabo 0.9.0 Released

2008-12-10 Thread Ed Leafe
We are proud (and relieved!) to finally release Dabo 0.9.0, the first  
official release of the framework in six months. We haven't been  
taking it easy during that period; rather, we made some changes that  
clean up some weak spots in the codebase, and as a result can offer a  
much more solid framework, and are on course for a 1.0 release in the  
near future.


To do this, we made some decisions that break backwards compatibility.  
We dropped support for Python versions earlier than 2.4, and wxPython  
versions below 2.8. Supporting everything is nice to aim for, but  
completely impractical.


There is also a major addition to the framework: the ability to deploy  
Dabo applications as true web apps. Imagine: being able to develop a  
rich internet app using nothing but Python on both the client and  
server! It's still early in the development process, so it's lacking a  
lot of the supporting tools, and almost no documentation has been  
created, but that will be coming in the next few weeks/months. When  
you deploy your app as a web app, all data access and business logic  
is on the server, and the framework automatically handles the  
communication between the client and server. The framework also  
automatically grabs file changes from the server, making UI updates  
seamless and quick. Lots more interesting stuff will be happening in  
this area in the near future, so stay tuned!


If you're not already familiar with Dabo, we're the premier open  
source framework for developing desktop (and now web!) applications in  
Python. We make the difficult stuff like binding databases to UI  
controls simple.


You can grab the latest version from http://dabodev.com/download

A fairly comprehensive list of the changes we've made since the last  
release can be found at http://svn.dabodev.com/dabo/tags/dabo-0.9.0/ChangeLog


And if you want to learn more, join our email list: 
http://leafe.com/mailman/listinfo/dabo-users


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: RELEASED Python 3.0 final

2008-12-03 Thread Ed Leafe

On Dec 3, 2008, at 7:51 PM, Barry Warsaw wrote:

On behalf of the Python development team and the Python community, I  
am happy to announce the release of Python 3.0 final.



	Props to all the folks whose hard work made this possible! You guys  
rock!



-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: Spawning a new UI process

2008-11-09 Thread Ed Leafe

On Nov 9, 2008, at 4:42 PM, Steve Holden wrote:


Ed! Good to see you on c.l.py!


	I usually only get around to reading the list when I'm having a  
problem I can't figure out.  blush.


Simply too busy most of the time.


a) Try using the subprocess module
b) Use *.pyw programs to ensure no console window is created.



	OK, I didn't see subprocess. I'll give that a whirl. In the meantime,  
I did find that wxPython has wx.Execute, and it seems to be working,  
although it prints some odd messages when running under OS X. Thanks!



-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Spawning a new UI process

2008-11-08 Thread Ed Leafe
	I'm working on a wxPython app (well, a Dabo app, but it's basically  
the same thing) that presents the user with a selection of several  
wxPython apps that exist on their system. They choose one, and I want  
to then launch that app, as if they had typed python myapp.py from  
a terminal window. The initial app can either terminate or continue;  
that's not terribly important. The important thing is to get the  
selected app to run in a separate process.


	I've tried all the variants of os.spawn* and os.exec*, without  
success. Either nothing happens, or a Python interpreter is opened in  
the Terminal window I used to run the launcher. I want to do something  
like:


cd (appdir)
pth = os.path.join(os.getcwd(), main.py)

followed by one of:

os.spawnl(os.P_NOWAIT, main.py)
os.spawnl(os.P_NOWAIT, pth)
os.spawnl(os.P_NOWAIT, python, pth)
os.spawnl(os.P_NOWAIT, python, main.py)
os.spawnl(os.P_NOWAIT, /usr/bin/python, pth)
os.spawnl(os.P_NOWAIT, /usr/bin/python, main.py)

	The only result I've gotten is a Python interpreter is started, but  
the GUI app that should be launched by 'main.py' is never run.


	So what am I missing? How do I launch a python app in a separate  
process from another Python app?



-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: Porting VB apps to Python for Window / Linux use

2008-10-24 Thread Ed Leafe

On Oct 18, 2008, at 8:12 AM, Dotan Cohen wrote:


I often see mention of SMBs that either want to upgrade their Windows
installations, or move to Linux, but cannot because of inhouse VB
apps. Are there any Python experts who I can reference them to for
porting? I have nothing on hand at the moment, but I see this as a
need without an obvious answer.


	Sorry for the delay in responding, but someone just pointed out this  
post to me.


	You might want to take a look at Dabo, which is an integrated desktop  
application framework for Python (disclosure: I'm one of the authors).  
It allows you to visually create UIs that run unmodified on Windows,  
Linux and OS X.


You can learn about it at http://dabodev.com


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


compile() and comments

2008-10-13 Thread Ed Leafe
	I've noticed an odd behavior with compile() and code that does not  
contain a trailing newline: if the last line is a comment inside of  
any block, a syntax error is thrown, but if the last line is a non- 
comment Python statement, there is no error. Here's an example (using  
2.5.1 on OS X)


 txt = 
... def foo():
...   print 'bar' 
 compcode = compile(t.strip(), , exec)
 compcode
code object module at 0x79608, file , line 2

 txt +=   # Comment on last line
 compcode = compile(txt.strip(), , exec)
Traceback (most recent call last):
 File stdin, line 1, in module
 File , line 4
   # Comment on last line
   ^
SyntaxError: invalid syntax
 compcode = compile(txt.strip() + \n, , exec)
 compcode
code object module at 0x79a40, file , line 2

	Obviously the easy workaround is to add a newline and all is well, so  
this isn't a show-stopper, but is this a bug?


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: compile() and comments

2008-10-13 Thread Ed Leafe

On Oct 13, 2008, at 8:35 AM, Fuzzyman wrote:


It is certainly an odd restriction, but the docs for compile [1] do
explicitly state that the input must be newline terminated.



	Understood; what I found odd was that if the last non-newline- 
terminated statement was *not* a comment, no error was thrown.



-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: compile() and comments

2008-10-13 Thread Ed Leafe

On Oct 13, 2008, at 7:20 PM, Terry Reedy wrote:

I would prefer more consistent behavior.  I have opened a separate  
doc issue that includes the documentation of this issue.

http://bugs.python.org/issue4118


	Again, it was not a show-stopper by any means; more of a curiosity.  
Thanks for verifying the inconsistency.


-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python and MS-SQL Server

2008-06-24 Thread Ed Leafe

On Jun 23, 2008, at 11:10 AM, [EMAIL PROTECTED] wrote:


The current script that I am working on requires pulling in some
information from a Microsoft SQL Server.

I was wondering if anyone could suggest the best way of doing this?  I
have looked at the different modules that are specific to SQL server,
but none of them seem to be active or up to date.



	Dabo may be what you need. It is a 3-tier framework for developing  
desktop applications, so even if you are doing web apps, the data  
access layer is fully usable by itself. We support MS SQL Server, as  
well as several other database backends.


-- Ed Leafe
-- http://dabodev.com



--
http://mail.python.org/mailman/listinfo/python-list


Re: Making wxPython a standard module?

2008-06-12 Thread Ed Leafe

On Jun 12, 2008, at 10:55 AM, Andrea Gavana wrote:


And on a personal note: I find it *buttugly*.


Do you mind explaining why you find it *buttugly*? I am asking just
out of curiosity, obviously. I am so biased towards wxPython that I
won't make any comment on this thread in particular, but I am curious
to know why some people find it ugly or bad or whatever. It has
its own bugs and missing features, of course, but it is one of the
major GUI player in the arena, together with PyQt and PyGTK.


Perhaps he meant the code, and not the results?

-- Ed Leafe



--
http://mail.python.org/mailman/listinfo/python-list


Re: Does Python 2.5.2's embedded SQLite support full text searching?

2008-04-21 Thread Ed Leafe
On Apr 21, 2008, at 1:05 PM, Daniel Fetchinson wrote:

 Sqlite itself is not distributed with python. Only a python db api
 compliant wrapper is part of the python stdlib and as such it is
 completely independent of the sqlite build.

Don't most binary distributions include SQLite itself? I installed  
2.5.2 on a new WinXP VM, and SQLite is working fine.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for Agile Python Consulting

2008-04-03 Thread Ed Leafe
This isn't a specific job request, which is why I'm not placing it on  
the Python Job Board. Rather, I'm in the process of gathering  
information for an upcoming project, and I need to determine what  
resources, if any, are available in the Python community.

We're in the planning stages of a fairly long-term project (1-2  
years), and the management here has been very impressed by the work of  
a consulting group used on another project in the company. They use  
Agile programming techniques, and have a lot of experience managing  
these sorts of projects. Unlike other projects with consultants,  
theirs have been very successful, and thus management is leaning  
towards using them for this one.

The problem, though, is that these consultants are a Rails shop, and  
it would mean changing a large part of our coding efforts to Ruby. My  
very strong preference is to stay with Python, so I'm trying to locate  
Python-centric consultants who use a similar disciplined Agile  
approach so that I can propose an alternative to the Rails solution.  
I'm not terribly concerned with Django vs. TurboGears vs. any other  
framework; at this point I'm only concerned with Python vs. Ruby.

If you are part of such a consulting group, or know of one that fits  
these requirements, please reply to me off-list.

-- Ed Leafe





Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace. 
Any dissemination, distribution or copying of the enclosed material is 
prohibited.
If you receive this transmission in error, please notify us immediately by 
e-mail
at [EMAIL PROTECTED], and delete the original message. 
Your cooperation is appreciated.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class super method

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 7:23 AM,  
[EMAIL PROTECTED] wrote:

 I've also found myself wondering:

 1. What are the two arguments to super used for?

To determine the type (1st arg) for which the superclass hierarchy is  
to be determined, and the instance (2nd arg) if the super object is to  
be bound. In typical usage, they are the class of the current  
instance, and the 'self' reference to the instance.

 2. What happens when the method supplied *after* the super is
 different from the containing method?

 In the above example what happens if:

 class DaboUIClass(dabo.ui.dControlMixin, someWxPythonClass):
   def __init__(self, *args, **kwargs):
   doOurCustomStuffBeforeTheSuperCall()
   super(DaboUIClass, self).callRandomMethod(foobar)
   doOurCustomStuffAfterTheSuperCall()


super() returns an object that doesn't know in what method it was  
derived, so as long as the superclass has the 'callRandomMethod'  
method, and 'foobar' is defined, there is no problem at all. IOW, the  
only context is the class of the instance, not any particular method  
of the instance.

You could also do something like this:

class DaboUIClass(dabo.ui.dControlMixin, someWxPythonClass):
def __init__(self, *args, **kwargs):
doOurCustomStuffBeforeTheSuperCall()
self.super = super(DaboUIClass, self)
self.super.__init__(*args, **kwargs)
doOurCustomStuffAfterTheSuperCall()

def someMethod(self, foo, bar):
self.super.someMethod(foo, bar)

def someOtherMethod(self):
self.super.someOtherMethod()

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class super method

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 8:43 AM, George Sakkis wrote:

 Did you follow the links I gave by any chance? With all the gotchas
 and rules of how to use it properly, it's far from what I would call
 elegant.

Please. Anything powerful can be dangerous if used indiscriminately.  
But in a language that supports multiple inheritance, it is amazingly  
elegant to use a simple function to create a superclass object for a  
class with multiple mixins at various levels of the inheritance  
hierarchy that just works. Yes, having to specify the current class  
is a bit of a wart that is being addressed in 3.0, but the approach is  
still the same.

 Pehaps, at least as long as you make sure that all superclasses have a
 compatible signature - which in practice typically means accept
 arbitrary *args and **kwargs in every class in the hierarchy like your
 example. Good luck figuring out what's wrong if it's not used
 consistently.

See my comment above. If you do not know what you're doing, you  
shouldn't be doing it. This is not the fault of super(); it's the  
fault of a poor programmer. And I used generic *args and **kwargs in  
the method sig since I was using made-up class names and methods.  
Would you have reacted more favorably if I had used (self, foo, bar)  
instead?

 Also doOurCustomStuffBeforeTheSuperCall() works as long as all
 ancestor methods to be called need the same CustomStuff massaging.

Oh, c'mon. Of course that's the case; if you are overriding method  
behavior, it is your job as the programmer to ensure that. Again, this  
is nothing to do with the super() function, and everything to do with  
the abilities of the developer.

 In a sentence, it's better than nothing but worse than anything.


I guess I must be the world's most amazing Python developer, as I've  
used super() extensively for years without ever suffering any of the  
pitfalls you and others describe.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class super method

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 12:53 PM, Michele Simionato wrote:

 It is just that you did not run (yet) in a corner case of super. The
 interesting question would be: did any of your users run into issues
 using you library which is heavily relying on super? Especially when
 composing it with their own classes?

None so far, and our users are pretty good about reporting bugs!

 I personally have changed my opinion about multiple inheritance over
 the years.
 At the beginning I thought it was a very cool idea, but now I think it
 is a pretty  bad idea. If I were to design a language, I would not
 implement multiple inheritance. In Python I never use multiple
 inheritance and actually I try very hard to avoid even single
 inheritance, preferring composition whenever it is viable.

I think MI is great as long as you understand how to use it. I would  
never encourage anyone to mix dissimilar classes; that's just poor  
design. But a well-designed mixin class is a wonderful thing.

I also don't consider inheritance and composition to be either/or  
choices. Both can (and usually should) be part of a well-designed  
application. In my experience, using either incorrectly can get you in  
trouble.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What motivates all unpaid volunteers at Pycon?

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 1:20 PM, [EMAIL PROTECTED] wrote:

 There really isn't any simple answer.  Most people seem to be  
 motivated
 to help out their communities,

 I still think all this unselfishness is noteworthy
 and curious.


Assuming that people get nothing back by participating in a  
community, yes, it would be curious. My experience, though, is that I  
get a lot more out of it than I could ever contribute. IOW, it's a  
great example of synergy.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What motivates all unpaid volunteers at Pycon?

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 5:37 PM, [EMAIL PROTECTED] wrote:

 What do the people get back who did all the hard work at registration
 desk and
 preparing conference attendee bags? ...who did all hotel preparations?


You'll have to ask them. When I've been a part of events like this,  
just knowing that I contributed is a great feeling. I also usually end  
up meeting several people I might not have otherwise met, and  
invariably that makes the experience much, much richer.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class super method

2008-04-01 Thread Ed Leafe
On Apr 1, 2008, at 6:10 PM, Steve Holden wrote:

 Ed is a good enough designer to avoid the corner cases. Strangely  
 enough
 the one place where I have ended up making significant use of super()
 was in providing mixins for wxPython interface classes!

Thanks much for the compliment. Yes, wrapping the disparate and  
confusing wxPython classes to have a consistent interface is where we  
also make the most use of super(), but our database wrappers also  
provide consistent functionality to all the dbapi cursors, no matter  
what the backend database may be.

The only reason this works is that we are working with a single known  
class interface; we control all our own mixin class designs. With the  
wxPython stuff, each class has a well-defined set of methods and  
method signatures, and with the database stuff, we only mixin with the  
dbapi-standard methods, and avoid hooking into module-specific  
enhancements.

My point in these postings is that working with multiple inheritance  
is fraught with potential pitfalls; super() doesn't create these  
pitfalls, although it can make it easier to fall into them. If you try  
to create a PotBelliedElephant class by using MI with a PotBelliedPig  
class and an Elephant class, well, you *should* crash and burn,  
whether you use super() or not.

http://en.wikipedia.org/wiki/An_Elephant_Makes_Love_to_a_Pig

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class super method

2008-03-31 Thread Ed Leafe
On Mar 31, 2008, at 5:58 PM, George Sakkis wrote:

 is there any tutorial for super method (when/how to use it)?

 or maybe someone could explain me how it works?

 thx

 Super is one of the dark corners of the language [1,2]... a good rule
 of thumb is to stay away from it, or at least stick to its basic
 usage.


I disagree - super is quite elegant and dependable.

Because Python support multiple inheritance, it is difficult to  
manually ensure that when augmenting a method that the correct  
superclass calls are made. super() handles that without having to  
guess as to what the correct inheritance hierarchy is.

In my own project (Dabo), we use mixin classes liberally to provide  
consistent behavior across our UI classes. The use of super makes  
customizing __init__() behavior, for example, quite straightforward.  
The general form looks like:

class DaboUIClass(dabo.ui.dControlMixin, someWxPythonClass):
def __init__(self, *args, **kwargs):
doOurCustomStuffBeforeTheSuperCall()
super(DaboUIClass, self).__init__(*args, **kwargs)
doOurCustomStuffAfterTheSuperCall()

This has worked reliably for us in every place where we have used it.  
There's nothing dark and mysterious about it at all.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pycon disappointment

2008-03-20 Thread Ed Leafe
On Mar 20, 2008, at 11:54 AM, [EMAIL PROTECTED] wrote:

 Number Three:  Too much code, not enough concept.

 Presenters this one's for you.  I can't count the number of
 presentations I attended where the presenter would click through three
 slides of pycode just to show us a two or three-line snippet that
 illustrated their point.  Worse yet, it was often at the bottom of the
 screen so no one but the front row could see it.  This goes for text
 two.  I saw some great presentations as well, and they had limited
 text on each slide.  The last thing your audience wants to see is a
 slide drenched in text of any kind.


This is good advice: simple slides serve as organization cues, but  
the content should come from the speaker. The worst case (only saw  
this twice at this year's PyCon) is when there is a text-heavy slide  
that the presenter simply reads. We can all read it ourselves! Your  
job is to elaborate on the topic.

I'd like to see two things regarding slides: first, if at all  
possible, set a limit on the percentage of the talk that can consist  
of slides. I would much rather see the presenter show actual  
demonstrations of what they're talking about than simply talking about  
it. If that's not possible, then in the session description, clearly  
state the % of the talk that will be slides. Perhaps there are people  
who like to sit in a room and watch long PowerPoint (-type)  
presentations, but I'm not one of them. Let's see some code! Let's see  
stuff working (and sometimes crashing!), and how changes affect the  
results. When I've presented at PyCon and other conferences, that's  
the part that I spend the most time on: preparing demonstrations. It's  
not easy to do; certainly much more difficult than creating a slide  
that sums up what the demo does. But it makes for a much more  
interesting session!

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a trick with lists ?

2008-02-07 Thread Ed Leafe
On Feb 7, 2008, at 3:19 PM, James Turk wrote:

 if you do
 a = [1,2,3]
 b = []
 b = a

 then assign: b[1] = 9
 now a[1] == 9 as well

 with a[:] = b you are actually getting a copy of the list rather than
 an alias


Of course, this only works if 'b' is already a list. A more common  
and more general usage for making list copies would be:

a = [1,2,3]
b = a[:]

In this usage, 'a' and 'b' are separate lists, but 'b' doesn't need  
to be defined as a list first.

-- Ed Leafe



-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Dabo 0.8.2 Released

2007-10-26 Thread Ed Leafe
We are pleased to announce the release of Dabo 0.8.2, the latest  
version of our desktop application framework. It is available on our  
download page: http://dabodev.com/download

If you're not familiar with Dabo, it is the leading framework for  
building desktop applications in Python. You can get more information  
about Dabo on our website: http://dabodev.com

Probably the biggest change is in the way we will be handling  
updates and releases. We will no longer maintain separate 'stable'  
and 'development' versions, as the 'stable' got out-of-date so  
quickly that the name became ironic. Instead, we will only have a  
single development branch.

What's made this possible is the incorporation of Web Update into  
the framework. This will check our servers regularly for updates, and  
notify you if any are available. If you want to grab those updates,  
you simply need to click the 'OK' button, and your framework is  
updated for you. Of course, nothing is ever updated without you  
knowing about it, and you can turn the whole thing off if you so desire.

We are also including DaboDemo and the visual tools in the download,  
instead of making you grab those separately. We plan on integrating  
Web Update-like features into these in the near future.

As usual, there have been a bunch of minor changes and bugfixes;  
instead of including them here, you can see them at: http:// 
svn.dabodev.com/dabo/tags/dabo-0.8.2/ChangeLog

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Dabo 0.8.2 Released

2007-10-26 Thread Ed Leafe
On Oct 26, 2007, at 1:23 PM, Dennis Lee Bieber wrote:

  We are also including DaboDemo and the visual tools in the download,
 instead of making you grab those separately. We plan on integrating
 Web Update-like features into these in the near future.

   Let's see if I have this right before doing an empty trash... I
 can delete the directory I had for stable (containing three
 TortoiseSVN enabled subdirectories: Dabo, DaboIDE, DaboDemo), along  
 with
 the DaboIDE and DaboDemo subdirectories I had under dev...

That's right. The 'stable' branches are still available in  
Subversion, but only read-only. No changes will be made to these from  
now on.

You can continue to use Subversion if you wish, but note that the  
URLs have changed, since the framework, demo and visual tools are all  
in the same trunk:

  svn checkout http://svn.dabodev.com/dabo/trunk/dabo
  svn checkout http://svn.dabodev.com/dabo/trunk/ide
  svn checkout http://svn.dabodev.com/dabo/trunk/demo


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: super() doesn't get superclass

2007-09-19 Thread Ed Leafe
On Sep 19, 2007, at 6:52 AM, Michele Simionato wrote:


 Well, I am personally *against* multiple inheritance (i.e. IMO it
 gives more troubles than advantages)

For the sorts of examples that have been used in this thread, it  
isn't MI that's problematic; it's the poor quality of the design.

Mixing two complete classes to create a multiply-inherited class is  
almost always the sign of poor design. OTOH, mixin-style classes are  
a wonderful way to ensure consistency across several different  
classes that all need a common behavior added to them. We use mixins  
extensively throughout Dabo, and they allow us to give several  
classes the desired behaviors, while only having one mixin class to  
maintain.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Database Apps

2007-09-12 Thread Ed Leafe
On Sep 11, 2007, at 2:56 PM, [EMAIL PROTECTED] wrote:

 It's gonna be a desktop app.  The
 database engine is going to be the critical component.  I like sqlite
 so that I don't need a database server on the client side.  It would
 help though if there is a way to sync between multiple clients to a
 central server database.  That's the tough part.  To give you a better
 idea of what i'm trying to do, I am trying to write an app where
 multiple technicians have an issue tracker that is available both
 offline and online.  I was looking to use sqlite as the local side
 that would sync new and updated issues to a central server when
 online.  Any technician may work on any issue.  Generally they will
 not be working on the same issue at the same time.  The technicians
 are geographically diverse (anywhere in the southeast US, not in an
 office.)

As far as the server goes, you can't go wrong with PostgreSQL, as  
others have mentioned. I have more experience with MySQL, but their  
recent licensing changes have simply made it easier to go with  
Postgres, as I don't have to worry about which clause of which  
document I might be violating.

For the local data store, SQLite is far and away the best choice,  
since you don't have to use two types of data access, as you would if  
you went with SQL on the server and, say, pickling on the local.

If you create both data stores with the same structure, you can use  
UUIDs as your keys, along with a timestamp flag for records that are  
added or modified when disconnected so that you can re-sync later.  
You will have to handle conflicts (i.e., someone changed a record  
that another also changed while disconnected) on your own,  
implementing your own business logic to determine who wins, and how  
the conflicted data is handled.

I'll close with a plug for our product: Dabo. It is a desktop  
application framework with support for SQLite, PostgreSQL, MySQL,  
Firebird and Microsoft SQL Server databases. For disconnected data,  
you would simply define a local connection (to SQLite) and a remote  
connection (to your server database), and switch between the two  
depending on whether you are disconnected or not. The framework will  
handle the rest, allowing you to focus on the stuff that is unique to  
your app, such as the conflict resolution and business logic.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Database Apps

2007-09-12 Thread Ed Leafe
On Sep 12, 2007, at 10:53 AM, [EMAIL PROTECTED] wrote:

 Thanks for ideas Ed.  I am checking out dabo now.  I do have a few
 questions about it.  Packaging.  Is it easy to package into a quick
 install for windows.  The users are going to want to get too in
 depth.

py2exe is your friend here. I know several developers who have used  
this to distribute Dabo apps, so we could certainly help you get your  
setup.py working.

 Second, data sources.  When I'm adding a data source to the
 window in class designer, it always picks up the one I created (which
 incidentally was a sample, my form for connection manager isn't
 working at the moment.)  My idea is to have the the local sqlite
 database as the only viewable data source, and the server side only
 for syncing.  So they logon, sync up, sync down, and view.  I'm
 worried about having to get them to install python, dabo, and the app.

The users would never see any of the Class Designer, connection  
editor, or any of the other development tools. I would imagine that  
you would need to code the sync parts by getting the current changed  
data from the local SQLite database, creating a connection to the  
server DB, doing the insert/update as needed, grabbing the latest  
from the server, disconnecting from the server, and then updating the  
local data. The user would probably need to do nothing more than  
click a button to start running your code.

As far as what the user must install, that's what will happen with  
any Python solution. py2exe takes care of all of that, bundling  
Python, Dabo, your database modules, and any other dependencies into  
a single .exe file. You can then use something like Inno Setup to  
create a basic Installer that will look and work like any other  
Windows application installer.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Database Apps

2007-09-11 Thread Ed Leafe
On Sep 10, 2007, at 10:52 PM, [EMAIL PROTECTED] wrote:

 Kindof a poll, kindof curiosity...

 What is your favorite python - database combination?  I'm looking to
 make an app that has a local DB and a server side DB.  I'm looking at
 python and sqlite local side and sql server side.

Are you asking for opinions on what sort of database engine to use?  
Or are you trying to get a feel for what people use to develop their  
apps? Are you looking for a web app, or a desktop app, or a non-UI app?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a tar file with python

2007-08-24 Thread Ed Leafe
On Aug 23, 2007, at 11:27 PM, Brian McCann wrote:

 I ran the code as you suggested, didn't work, tried variations of  
 it didn't work,
 If you don't know the answer don't pretend you do!

 Apology not accepted, please don't wake up!

 Future correspondence on any python questions from you go to trash.
 May your pillow not have pity on your head!

What a tool.

Add another to the twit filter...

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a tar file with python

2007-08-24 Thread Ed Leafe
On Aug 24, 2007, at 11:24 AM, Carsten Haese wrote:

 You clearly have no idea who you're talking to. I suggest you  
 Google for
 'Steve Holden Python' to get a clue. Good luck finding any more help
 here.

Even if it were Joe Nobody to whom he was directing those comments,  
it was *way* out of line. The fact that it was Steve only reinforces  
the cluelessness of the writer.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Ligmail bug?

2007-08-12 Thread Ed Leafe
On Aug 12, 2007, at 7:06 AM, Steve Holden wrote:

 [Please reply via the list when a response is made via the list.  
 You may
 now have detached the follow-ups from your original question, but at
 least if you use the list there's a chance someone else will help  
 you if
 I give up or don't have time. Note I have sent this response to the
 list; you are Cc'd to make sure you pick it up even though it may not
 appear in the same thread.]

I've seen others comment on this, so I'll throw in my 2 cents.

The default behavior for this list should be to reply to the list,  
as you have pointed out. Yet for some unfathomable reason, the  
keepers of the list have set it up to default to reply to the  
original sender. This is nothing short of stupid, and I cast my vote  
(if I even have one) for changing this default to a more intelligent  
one, if for no other reason than to not have to constantly read  
comments like this chiding someone for acting in a predictable fashion.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (no) fast boolean evaluation ?

2007-08-03 Thread Ed Leafe
On Aug 3, 2007, at 11:57 AM, Bruno Desthuilliers wrote:

 Sorry, I forgot to mention the language did not allow to have else  
  if
 in the same statement. IOW :

 if some_condition then
do_sometehing
 else
if some_other_condition then
  do_something_else
else
  if yet_another_condition then
do_yet_another_thing
  else
if your_still_here then
   give_up('this language is definitively brain dead')
end if
  end if
end if
 end if

Usually that's because the language provides a switch/case statement  
construct. If it does and you try to write the above code, it isn't  
the language that's brain-dead!  ;-)

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: bool behavior in Python 3000?

2007-07-11 Thread Ed Leafe
On Jul 11, 2007, at 2:04 AM, Stargaming wrote:

 No, I think Bjoern just wanted to point out that all those binary
 boolean operators already work *perfectly*. You just have to emphasize
 that you're doing boolean algebra there, using `bool()`.
 Explicit is better than implicit.

I think that the assignability to the names 'True' and 'False' is  
incorrect, or at the very least subject to all sorts of odd results.  
Look at this:

  True, False
(True, False)
  True = False
  True, False
(False, False)
  True == False
True
  (True == False) == True
False

Yeah, I know: Doctor, it hurts when I do this. Doc: So don't do  
that!. I haven't kept up with all the Python 3000 docs, so does  
anyone know if True and False will become true keywords, and whether  
oddball stuff like the above will no longer be possible?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Properties for modules?

2007-06-11 Thread Ed Leafe
I have a simple module that reads in values from disk when imported,  
and stores them in attributes, allowing for code like:

  import moduleFoo
  print moduleFoo.someSetting
'the value'

What I'd like to do is have a more property-like behavior, so that  
if they try to set the value of moduleFoo.someSetting, it also  
persists it to disk. But properties are really only useful in  
instances of classes; if I define 'someSetting' as a property at the  
module level, I get:

  import moduleFoo
  print moduleFoo.someSetting
property object at 0x78a990

Does anyone know any good tricks for getting property-like behavior  
here?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Properties for modules?

2007-06-11 Thread Ed Leafe
On Jun 11, 2007, at 5:55 PM, Steven Bethard wrote:

 I typically define a module wrapping class like::

  class GiveThisModuleProperties(object):
  def __init__(self, module_name):
  self._module = sys.modules[module_name]
  sys.modules[module_name] = self
  # now define whatever behavior you need
  def __getattr__(...):
  ...
  def __setattr__(...):
  ...

 Then, in the module you want wrapped, you write::

  GiveThisModuleProperties(__name__)

 The trick here is basically that we replace the module object in
 sys.modules with a class instance that wraps the module with whatever
 extra behavior is necessary.

OK, I see the trick involved. Yes, that does work for what I need.  
Thanks!

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython / Dabo demo shell ?

2007-06-08 Thread Ed Leafe
On Jun 8, 2007, at 3:14 AM, stef wrote:

 I was impressed by the demo shell of wxPython,
 and a few days ago (finally getting Dabo to work),
 I saw Dabo uses the same demo shell.

 Is there any more information available about this shell,
 because it seems a very nice / good way to show
 (many) demos, in an organized way to newbies.

There isn't a common shell. I wrote DaboDemo from scratch, using the  
Dabo Class Designer visual tools; you can actually open up the demo  
in the Class Designer and edit the entire thing!

I just thought that the wxPython demo was such a great way to  
explore wxPython and try out new things that I blatantly copied it.  ;-)

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython / Dabo demo shell ?

2007-06-08 Thread Ed Leafe
On Jun 8, 2007, at 8:59 AM, Chris Mellon wrote:

 The shell in the wxPython demo (but apparently not in the dabo demo,
 as per Ed's email) is from the wx.py package. It's quite trivial to
 add to your own applications, documentation is at
 http://www.wxpython.org/PyManual.html

I may be wrong, but I believe that the OP was interested in the  
overall frame, contents, and inner workings of the wxPython demo  
application (and DaboDemo), not the PyShell interpreter.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython / Dabo demo shell ?

2007-06-08 Thread Ed Leafe
On Jun 8, 2007, at 10:01 AM, stef wrote:

 I'm interested in the overall demo setup,
 really beautiful and powerful, just one thing missing (user  
 configurable
 tree).

 And if you can copy it,
 I'm allowed to do so also ;-)

You can certainly copy and customize the DaboDemo code. There is a  
folder named 'samples' that contains the the code for each individual  
demo. If you look at a few of those, you should be able to figure out  
how to create your own. The tree is created dynamically at startup,  
based on the files in the 'samples' directory, and each of those  
files' 'category' attribute.

If you have any further questions, it would probably be best to post  
them to the dabo-users list. You can sign up for it at http:// 
leafe.com/mailman/listinfo/dabo-users

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PythonCard or Dabo?

2007-06-02 Thread Ed Leafe
On Jun 2, 2007, at 7:22 AM, SPE - Stani's Python Editor wrote:

 Another alternative are GUI designers such as wxGlade or XRCed, both
 of which ship with SPE (http://pythonide.stani.be). Dabo is especially
 usefull (but not limited to) developping database applications as it
 is an open source alternative to Visual Fox pro.

Sorry for coming into this discussion late; I was away celebrating  
our 21st anniversary with my wife!

I think that the most important thing to consider in deciding  
between one or the other is what it is you want to do. PythonCard is  
much easier if you want to create a simple GUI app. In fact, when I  
first started working with Python, I used PythonCard to develop my  
first GUI apps, and we've paid homage to PythonCard in Dabo by  
incorporating some of their better ideas. :-). The problem I found  
was that I quickly ran into a wall where I needed to do something  
that PythonCard didn't do, and the workaround was more complex than  
if I had started with plain wxPython in the first place. Since at  
that time PythonCard didn't support sizers, and I needed cross- 
platform apps, it really didn't handle the hard stuff like sizers  
very well.

When I started with the Dabo Class Designer, I made it sizer-centric  
from the start, since I felt then that sizers are a necessity in UI  
design. Yes, we also support fixed-position/size controls, but I  
think that the investment in grokking sizers pays off many times  
over, especially when you can see exactly how something will look up  
front, rather than guessing in code and then modifying your code when  
the result isn't what you wanted.

The other thing I would point out is that the Dabo Class Designer is  
written in 100% Dabo code: no raw wxPython or external libraries are  
used. The Class Designer is probably one of the most complex  
applications I have ever written in my 20+ years as a developer, and  
Dabo can handle it just fine. To me, that demonstrates that not only  
is the UI class library rich and robust, but the event model that we  
wrote is also very powerful. If you have an app that requires a more  
complex UI than the Dabo Class Designer, I'd sure like to see it!

So if you ask me which product to use, I would naturally be inclined  
to say Dabo, but really, the main question is just how complex is  
your app. If you need to work with a backend database, well, then  
it's a no-brainer - Dabo is designed to handle data as well as any  
free or commercial tool on the market. But for a simple UI app, such  
as many of the PythonCard demos, I'd have to say that you should look  
at both and see which one feels more comfortable to you, and go with  
that.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: gui application on cross platform

2007-05-28 Thread Ed Leafe
On May 28, 2007, at 2:01 AM, james_027 wrote:

 I am using delphi to develop gui application, and wish to make a shift
 to python. here are some of my question/concern...

 1. is python develop gui application a cross platform? just like java
 swing?

wxPython is probably the best cross-platform GUI toolkit available  
for Python. That's why we chose it for our primary UI toolkit for Dabo.

 2. delphi makes things easy for me like coding for a specific event on
 a specific component, could it be the same for python?

Not in Python per se, but I know exactly what you mean.

I come from the Visual FoxPro world, which is very similar to  
Delphi. I stumbled upon Python, and quickly discovered that it was  
far and away the best language I've programmed in in over 3 decades  
of coding. Yet it lacked anything like the power of GUI development  
that tools such as Delphi or Visual FoxPro offered. So along with my  
partner Paul McNett, we set out to create such a tool, and that is Dabo.

 3. are there cool library of component like in delphi available for
 python that will make database application more usesable?

One word: Dabo. We do database apps.

 4. where do I start the learning curve? I did some research and I
 don't know which one to take among wxwdiget, pygtk, and etc.

Check out our collection of screencasts to see what Dabo can do for  
you (http://dabodev.com/documentation). Post messages to the dabo- 
users list to get answers to any questions you might have (sign up at  
http://leafe.com/mailman/listinfo/dabo-users).

There are a ton of web frameworks out there. But for Python, there  
is only one desktop app framework: Dabo.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and GUI

2007-05-26 Thread Ed Leafe
On May 26, 2007, at 3:17 PM, rzed wrote:

 If there were a standard Python GUI API (call it the PGA,
 say) that be the target for app developers, they wouldn't have to
 worry about the back end. The PGA would have to be flexible enough
 to handle incompatibilities among the various approaches to
 displaying widgets and text.

FWIW, this has been a design goal of Dabo from Day One. While we  
currently wrap only wxPython, the ui module is not tied to it. We  
have standardized on a syntax for control names, property names,  
etc., that is independent of wxPython, and then is implemented in the  
ui.uiwx module. Throughout Dabo, the only place where you will ever  
see import wx is in the ui.uiwx module; when you write Dabo UI  
code, you never need to import wx; instead, you write to the Dabo  
uiapi. The same will be true when we get around to wrapping Tkinter,  
Qt, etc.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and GUI

2007-05-24 Thread Ed Leafe
On May 24, 2007, at 10:22 AM, Brian Blais wrote:

 Then there is Dabo, which I personally have had problems with.  I  
 am looking for a
 pythonic, professional looking GUI framework.  I first tried dabo  
 with python 2.4,
 and had to install sqlite, which seemed a bit odd for trying to  
 just get a GUI
 framework...I understand why, but when you're looking for one  
 thing, having it tied
 to a completely different thing feels a little strange.

FWIW, we made that decision only after Python itself committed to  
including SQLite as part of the standard distribution. While there  
may have been some problems during the transition, such as you  
apparently had, it made for a much better product in the long run.

 I never got it working in
 Python2.5, either on Linux or OS X, and the problem is most  
 definitely mine and I
 didn't have the patience to debug it.  I am really not trying to  
 diss dabo here,
 because there enough people who swear by it, that it must be doing  
 many things right.

I checked the archives, and didn't find any messages from you asking  
for help. We know that the documentation is far from complete, and  
the installation process can be problematic, but one thing we pride  
ourselves on is quick response to help requests, and then fixing  
whatever it was that caused the initial problem.

 My problem with Dabo is not what it is, it is what I am looking  
 for...a pythonic GUI
 framework.  Coming from Unix, I generally feel that a program  
 should try to do one
 thing, and one thing well.  To mix really different functionality  
 seems to me to be a
 bad idea.  If you can use the GUI parts separately, why not package  
 it separately?
 One might find a lot of users who only what that.

We've thought about doing exactly that, but to be honest, it would  
take a large investment of time without a corresponding increase in  
value. Right now all you have to do is install Dabo, and then just  
use the dabo.ui classes. You never need to touch the database or  
business object layers if you don't want to.

Also, I don't feel that we are mixing different functionality.  
Rather, we are creating an integrated environment for those wishing  
to create rich desktop apps. Nearly all such apps require displaying  
and persisting information, and that's what Dabo is designed to do.  
If you don't need persistent information, the display stuff works  
just fine.

I'd encourage anyone who is curious about what dabo.ui offers to  
view the part of my recent PyCon presentation that discusses exactly  
this topic. Take a look at http://dabodev.com/pycon2007?3 to see an  
example of simpler and more Pythonic Dabo code is compared to what  
you would have to write in either raw wxPython or even Wax.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie Question

2007-02-12 Thread Ed Leafe
On Feb 12, 2007, at 9:59 AM, Stef Mientki wrote:

 but to be honest ...
 ... I never even tried to write a GUI in Python, ...
 ... just looked at others examples,
 ... and still not seen what I can perform in Delphi ;-)

You should definitely look at our product: Dabo. Both myself and my  
partner come from a desktop application background in which GUI tools  
made it easy to focus on what the app was doing instead of worrying  
about if it would look like you think it will look when writing the  
UI in code.

Dabo is still a work in progress; we have most of the individual  
tools working well, and are just beginning to put them all together  
in a full IDE.

Take a look at our screencasts to see Dabo in action; I'd recommend  
the more recent ones, as they show the current state of the tools:

Building a Database Application using the Dabo Class Designer (Parts  
1  2)
http://leafe.com/screencasts/dataenvironment1.html
http://leafe.com/screencasts/dataenvironment2.html

Populating a Grid Using Business Objects
http://leafe.com/screencasts/populategrid.html

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Good Intro to wxpython/PostgreSQL Applications?

2007-01-08 Thread Ed Leafe
On Jan 8, 2007, at 12:22 PM, PAllen wrote:

 I am trying to get rid of a few of my old MS Access applications and
 move them to PostgreSQL and Python/wxpython.  Does anyone have any
 suggestions on the easiest way to learn to program small database
 applications with python  wxpython?  Does anyone have a few small
 examples at least?

 I will mainly need forms with/without subforms for viewing and
 inserting data into the database.  Nothing too complicated to get
 started.

Dabo is designed to do exactly what you describe. It is a desktop  
application framework with an emphasis on database apps. Both myself  
and the other Dabo author, Paul McNett, come from MS Visual FoxPro  
backgrounds, so we know what people expect in a GUI app tool. Be sure  
to check out our screencasts, which show you what is involved in  
creating database applications in Dabo. The screencasts are listed at  
the top of http://dabodev.com/documentation.

We support several backend databases, and PostgreSQL is one of them.  
We use wxPython as our UI toolkit, but wrap the controls so that they  
have a consistent, property-based API instead of the C++ style of  
getter/setter methods with odd names.

I will be the first to admit that the how-to documentation is far  
from complete, but there is a good amount of information on the Wiki  
(http://dabodev.com/wiki). And we have our own mailing list that is  
frequented by both the authors and several other helpful folks. You  
can sign up for the dabo-users list at http://leafe.com/mailman/ 
listinfo/dabo-users.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execution time of lines within a function

2006-12-07 Thread Ed Leafe
On Dec 4, 2006, at 11:36 PM, Paul McGuire wrote:

 The PythonDecoratorLibrary page on the Python wiki has a link to a  
 @profile
 decorator, that I have used to profile the contents of targeted  
 functions
 (only just now, I don't seem to be able to get to the wiki to get  
 the exact
 link).

http://mg.pov.lt/blog/profilehooks-1.0.html

Note that the license has been changed from GPL to MIT, making it  
distributable with non-GPL projects.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface Designer

2006-12-05 Thread Ed Leafe
On Dec 4, 2006, at 5:41 PM, Gabriel Genellina wrote:

 I'm starting to program in python, i need a soft  interface  
 designer and adapt this interface to python. Somebody can help me  
 with this?
 Sorry, my english is very bad.

 Mine too. I don't understand what you want - what do you mean by  
 interface designer?

If by chance a visual tool for designing the user interface of an  
app is needed, then there are two good choices, both of which are  
based on the wxPython toolkit. One would be PythonCard (http:// 
pythoncard.sourceforge.net/), which features a simple, quick tool for  
laying out controls and binding code to them. The other is the Dabo  
Class Designer (of which I am the author; see URL in my sig), which  
gives you a choice of sizer-based layout or absolute positioning for  
laying out your GUI designs, as well as a simplified, more Pythonic  
API than wxPython provides.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Dabo 0.7 released!

2006-11-17 Thread Ed Leafe
It's been a while since we've had the chance to take a breath and  
compile a release, but it's here! Dabo 0.7 is now official, and it is  
available for download on our download page: http://dabodev.com/download

If you're not familiar with Dabo, it is the leading framework for  
building desktop applications in Python. You can get more information  
about Dabo on our website: http://dabodev.com

There have been a bunch of changes and bugfixes; instead of  
including them here, you can see them at: http://svn.dabodev.com/dabo/ 
tags/dabo-0.7/ChangeLog

We hope to have the 0.7 releases of the demo programs as well as the  
visual tools available in the next few days. Stay tuned for those  
announcements.

One important thing to note: Dabo works with wxPython 2.6, but  
several of the changes in the wxPython 2.7 and 2.8 products break our  
code. We will be focusing on making Dabo work with these later  
wxPython versions in the coming weeks, but for now, you need to stick  
with 2.6.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython TextCtrl - weird scrolling behavior

2006-10-31 Thread Ed Leafe
On Oct 31, 2006, at 3:22 PM, John Salerno wrote:

 After I watched the screencasts for how Dabo uses sizers, I really
 understood them a lot better. I've never used Dabo itself for GUI
 design, but the screencast, though it shows them in terms of that
 program, still gives a great visual presentation of how sizers work in
 general and I suggest you take a look at that:

 http://leafe.com/screencasts/sizers1.html
 http://leafe.com/screencasts/sizers2.html

Thanks for the good feedback. It took me a while to wrap my brain  
around sizers when I first started using them; now I hate working  
without them!

Also, I wanted to mention that our visual Class Designer has another  
helpful feature: you can right-click control to bring up a context  
menu. One of the choices is 'Edit Sizer Settings...', which brings up  
a dialog with all the relevant settings in one place. As you change  
them in the dialog, the design surface updates so that you can see  
the effect of your changes before you commit them. If you don't like  
your changes, click 'Cancel' and things return to the way they were  
before you started.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting a lot of SPAM from this list

2006-10-23 Thread Ed Leafe
On Oct 23, 2006, at 3:13 PM, [EMAIL PROTECTED], Bates Larry  
Bates larry dot bates at websafe dot  com@bag.python.org wrote:

 I'm getting a lot of spam to the email address I use to post
 to this list.  Since this email address doesn't appear elsewhere,
 I know that people are scanning this list to get the email
 address and spam me.  Does anyone have a suggestion as to a
 way that I can get less of this spam?  I could have another
 email address, but that won't help as I'd still get the spam
 and have to wade through it.  I'm running spamassassin, but it
 isn't catching all that much of it.  Any suggestions would be
 greatly appreciated.

Spammers don't scan lists as much anymore; they now rely on machines  
infected with malware to extract addresses out of email programs. I  
know this doesn't help you, but it is good to recognize that it isn't  
always the fault of the list admins.

I have an advantage in that I run my own mail server, and can create  
as many aliases to my account as I like. When a particular address  
goes bad, I change that alias to point to /dev/null, and create a  
new one. If it's an alias for a list, I first unsub using the old  
alias, and then re-sub with the new one.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python component model

2006-10-11 Thread Ed Leafe
On Oct 10, 2006, at 1:47 PM, fumanchu wrote:

 4) Custom property and component editors: A component editor can  
 present
 a property editor or an editor for an entire component which the  
 visual
 design-time RAD environment can use to allow the programmer end- 
 user of
 the component to set or get component property values. Normally a  
 design
 time environment will present default property editors for each
 component property type, but a component can override this.

 This is the hard part. I believe Dabo has done some work in this  
 space,
 but this is where the tight coupling comes in between code and tool, a
 coupling which Python has traditionally resisted.

FWIW, the Dabo design tools store the design in a basic XML file,  
and are completely transparent to outside editing. There is nothing  
that prevents you from modifying a design in the editor of your  
choice; the Dabo visual editing tools simply give you WYSIWYG  
feedback as you edit.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python component model

2006-10-11 Thread Ed Leafe
On Oct 10, 2006, at 9:59 PM, Edward Diener No Spam wrote:

 The Visual Studio RAD IDE environment actually modifies source code
 constructors, via an InitializeComponent() function called from it, in
 order to set properties and events in components. It does mark the
 function as such with comments in the source code. OTOH Borland's VCL
 uses the resource file technique you scorn above, linking in the code
 via resources and automatically updating a component's properties and
 events from base class components constructors. I believe Java's JVM
 automatically deserializes .ser files at run-time saved by a RAD
 designer in order to set properties and events on an object of a  
 class.

 There are obviously numerous techniques, so one should theoretically
 work well with Python.

With Dabo, we've taken what we feel is a 'best of breed' approach.  
The constructors for the various objects are defined in XML-formatted  
files, making them accessible by any editor. The code behind these  
objects is stored in regular .py files, with special comment lines  
that provide the linkage back to the original object definition. So  
you can edit your code in your favorite Python editor, and it all  
just works.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Capturing instant messages

2006-07-19 Thread Ed Leafe
On Jul 18, 2006, at 3:17 PM, Yu-Xi Lim wrote:

 This is going to be quite off-topic.

But helpful nonetheless.

 I'm not entirely familiar with SOX regulations. Is it necessary to
 capture it at the gateway?

I'm no lawyer either, so I probably know as much about this as you  
do. It was the client who proposed this type of solution; I'm in the  
process of figuring out if it's at all possible.

 The best solution would be to provide logging
 at the individual chat clients. Piecing together conversation threads
 from individual packets while filtering out other non-chat junk can be
 extremely tedious.

I got the impression that they want to capture the IM traffic and  
record it somewhere JIC they are ever audited or subpoenaed, but that  
most of it would never get looked at again.

 I understand the standard AIM client doesn't provide logging. Probably
 won't any time soon, since it wasn't made for enterprise. There are
 enterprise gateways for AIM, but I'm not sure of the cost or other
 deployment issues. (Try looking at Jabber) You should consider  
 those. Or
 a switch to a more enterprise-friendly protocol if that's possible.

 Other alternatives would be to use a better client. Multi-protocol
 clients like GAIM, Trillian, Miranda, and Adium X generally provide
 logging. Most provide the ability to toggle logging for specific
 sessions, thus reducing privacy issues.

Thanks for the suggestions; I'll run them by the client. They don't  
want to do it at the individual desktop level; they want a central  
location to ensure that someone doesn't have the capability to  
disable the logging, so perhaps an enterprise gateway might be a  
better solution.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Capturing instant messages

2006-07-18 Thread Ed Leafe
I've been approached by a local business that has been advised that  
they need to start capturing and archiving their instant messaging in  
order to comply with Sarbanes-Oxley. The company is largely PC, but  
has a significant number of Macs running OS X, too.

Googling around quickly turns up IM Grabber for the PC, which would  
seem to be just what they need. But there is no equivalent to be  
found for OS X. So if anyone knows of any such product, please let me  
know and there will be no need for the rest of this post.

But assuming that there is no such product, would it be possible to  
create something in Python, using the socket or a similar module?  
They have a number of servers that provide NAT for each group of  
machines; I was thinking that something on those servers could  
capture all traffic on port 5190 and write it to disk. Is this  
reasonable, or am I being too simplistic in my approach?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Capturing instant messages

2006-07-18 Thread Ed Leafe
On Jul 18, 2006, at 7:36 AM, Nick Vatamaniuc wrote:

 It depends on what IM protocol the company is using. If there is more
 than one, your job might end up being quite complicated. You indicated
 port 5190 in your post, does it mean that the company is using only  
 AOL
 IM?

Yes, they've told me that the users routinely use AIM to contact  
clients and each other. I don't believe that their firewalls permit  
other IM protocols.

 1) As far as capturing the traffic, I would use a specific tool like
 tcpick ( a cousin of tcpdump but actually dumps the data to console  
 not
 just the headers and recreates the tcp streams -- good stuff!).  Again
 if you know the exact port number and the exact protocol this might be
 very easy because you will set up your capturing program to capture
 traffic from only 1 port.

Thanks; I'll have to play around with tcpick today.

 2) The decoding will depend on your protocol, if you have more than  
 one
 IM protocol then the capture idea from above won't work too well, you
 will have to capture all the traffic then decode each stream, for each
 side, for each protocol.

I guess I'll have to start googling for AIM decoding information.

 3) Recording or replay is easy. Save to files or dump to a MySQL table
 indexed by user id,  timestamp, IP etc. Because of buffering issues  
 you
 will probably not get a very accurate real-time monitoring system with
 this setup.

They aren't interested in real-time monitoring; their main concern  
is Sarb-ox compliance.

Thanks for your help!

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Web frameworks and credit cards

2006-05-24 Thread Ed Leafe
I may have an opportunity to develop an online ordering system for a  
client, and will have the ability to develop using any tool I choose.  
Given the fact that there are more web frameworks in Python than  
keywords ;-) , what I need to know is any experience anyone out there  
has had integrating credit card processing with the various Python  
web frameworks. Until now, my only practical experience is with Zope  
2.x, but I'm open to any and all alternatives, so long as it's Python!

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 2 books for me

2006-05-11 Thread Ed Leafe
On May 11, 2006, at 3:32 PM, Robert Hicks wrote:

 Wouldn't portability go with Tkinter since that is installed with  
 every
 Python?

Dunno about other platforms, but it's not on my Mac.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can i set up a mysql db connection as a class ?

2006-04-29 Thread Ed Leafe
On Apr 27, 2006, at 8:15 PM, [EMAIL PROTECTED] wrote:

 my question is, is there a way i can set up a global connection so  
 that
 when the program loads, it connects once, then stays connected ? maybe
 i could assign instances of the cursor ?

We do something like this in Dabo. We define connections, giving  
each an identifying name, and the application object loads the  
definitions at startup (without actually connecting). When a business  
object needs a connection, they call  
self.Application.getConnectionByName(connName). If that connection  
hasn't been made, the app connects and returns a reference to the  
connection. It also stores the reference, so that the next time a  
business object requests that connection, it simply returns the  
existing reference.

shameless plug
If you're developing database applications, especially if they  
involve a GUI, you really should take a look at Dabo. It's an app  
framework written by database developers for database developers.
/shameless plug

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Dabo Runtime Engine For Windows 0.6.2 released

2006-03-29 Thread Ed Leafe
The Dabo Runtime Engine for Windows is a self-contained environment  
that allows you to run Dabo on Windows without having to first  
install all of the requirements. It comes with its own version of  
Python 2.4.2, wxPython 2.6.3.0, MySQLdb 1.2.0, kinterbasdb 3.2.0a1,  
ReportLab v.2463, and several other modules used in Dabo.

The Dabo Runtime Engine is designed for people who are curious about  
Dabo, but who don't want the bother of installing all the required  
modules just to see what Dabo can do. It doesn't change any Windows  
Registry settings, so it will not affect any existing applications on  
your machine.

This version installs several shortcuts that allow you to simple  
double-click an icon to run the desired file. Such shortcuts include  
the AppWizard, ClassDesigner and ReportDesigner, as well as several  
of the demo applications.

The Dabo Runtime Engine comes in two versions: the regular version  
that just runs the applications, and the Console version that display  
a command line window containing the application output. Besides  
that, they are identical.

You can download either version, along with all other things Dabo,  
from:

http://dabodev.com/download


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com





-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Dabo 0.6 released

2006-03-27 Thread Ed Leafe
It has been a while since the last release of Dabo (version 0.5.1  
back in January), but we haven't been standing still. A big reason  
for the long span was PyCon Dallas back in February, which involved  
lots of preparation beforehand, as well as lots of work after from  
the great response to Dabo we received there. As the number of people  
using Dabo continues to grow, we're getting better feedback,  
increased testing and a lot of great ideas for improvement.

There are too many changes to list here; a pretty comprehensive list  
is available at:
http://dabodev.com/announcements/changeLog-0.6
This is also available in the ChangeLog file in the root of the Dabo  
distribution. While there have been no major functional changes in  
the framework, which has been fairly stable for over a year now, a  
lot of enhancements have been added to enable the development of our  
IDE tools.

In addition to what we've improved in the Dabo framework, we can't  
forget to mention the Dabo Class Designer, and Dabo Report Designer.  
Both of these visual design tools have made the leap from the proof- 
of-concept phase to actual productive tools since the last release.  
We've also released the IDE tools today; this is version 0.5 for the  
Dabo IDE.

The Dabo Runtime Engine for Windows is in the process of being  
updated, and should be available shortly. This allows you to try out  
Dabo on a Windows computer without having to install Python,  
wxPython, or any of the other requirements first.

Grab the latest from the Dabo Download Page:
http://dabodev.com/download

And, as always, post feedback/questions to the Dabo users list:
http:/leafe.com/mailmain/listinfo/dabo-users


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Remote teamwork anecdotes

2006-03-23 Thread Ed Leafe
.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Trace dynamically compiled code?

2006-03-14 Thread Ed Leafe
Hi,

Thanks to the help of many on this list, I've been able to take code  
that is created by the user in my app and add it to an object as an  
instance method. The technique used is roughly:

nm = myMethod
code = def myMethod(self):
print Line 1
print My Value is %s % self.Value
return

compCode = compile(code, , exec)
exec compCode
exec self.%s = %s.__get__(self) % (nm, nm)

This is working great, but now I'm wondering if there is a way to  
enable pdb tracing of the code as it executes? When tracing normal  
code, pdb will show you the name of the script being executed, the  
line number and the source code for the line about to be executed.  
But when stepping through code compiled dynamically as above, the  
current line's source code is not available to pdb, and thus does not  
display.

Does anyone know a way to compile the dynamic code so that pdb can  
'see' the source? I suppose I could write it all out to a bunch of  
temp files, but that would be terribly messy. Are there any neater  
solutions?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trace dynamically compiled code?

2006-03-14 Thread Ed Leafe
On Mar 14, 2006, at 12:45 PM, Ziga Seilnacht wrote:

 Try not using bare exec statements, since they pollute the local  
 scope.
 In your example you could use:

 compCode = compile(code, , exec)
 d = {}
 exec compCode in d
 func = d[nm]

OK, noted and changed in my source.

 exec self.%s = %s.__get__(self) % (nm, nm)

 You don't need dynamic execution here; you can simply use
 setattr and the new module:

 import new
 method = new.instancemethod(func, self)
 setattr(self, nm, method)

 and yes, I remember that I was the one who suggested you
 the __get__ hack.

I've made the change you suggested. May I ask why one is better than  
the other? Namespace pollution doesn't seem to be an issue here.

  Does anyone know a way to compile the dynamic code so that pdb can
 'see' the source? I suppose I could write it all out to a bunch of
 temp files, but that would be terribly messy. Are there any neater
 solutions?

 You should check py lib: http://codespeak.net/py/current/doc/ ,
 specifically the py.code module. Then you can modify the
 function from above:

 import inspect
 f = inspect.currentframe()
 lineno = f.f_lineno - 5 # or some other constant
 filename = f.f_code.co_filename

 import py
 co = py.code.Code(func)
 new_code = co.new(co_lineno=lineno, co_filename=filename)
 new_func = new.function(new_code, func.func_globals, nm,
 func.func_defaults, func.func_closure)

OK, thanks for the lead. I will take a look at this as soon as I  
have the time to sit down and attempt to digest it. But before I do,  
will I be able to add code like this to the same part of the  
framework where the dynamic code is created, and have it work? I ask  
this because an even bigger problem is the matter of creating dynamic  
classes on the fly from saved XML files. I have a class that converts  
the XML to the corresponding Python code for the class, and it's  
working great, except for the tracing through the debugger issue.  
Would I be able to apply the py lib stuff to this, too?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheese Shop: some history for the new-comers

2006-03-12 Thread Ed Leafe
On Mar 12, 2006, at 3:03 PM, [EMAIL PROTECTED] wrote:

 amk Given the endless whiny complaints about the name, though,  
 I think
 amk we should just give up and go back to PyPI (pronounced  
 'Pippy').

 There was already a pippy: Python for Palm...

I second the suggestion earlier for making it a simple, non-silly  
name like 'PPI' for the Python Package Index. I mean, does anyone  
ever feel tempted to refer to the FBI with a cute name like 'fibby'?

I'm a big Monty Python fan from way back, but I still cringe at  
names that sound like they were created at the Ministry of Silly Names.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Write a GUI for a python script?

2006-03-06 Thread Ed Leafe
On Mar 5, 2006, at 7:37 PM, Peter Decker wrote:

 What little info I could find on the Dabo Wiki seems pretty old.   
 I also
 watched the two Sizer videos, but there's not enough info there to  
 learn
 much.

 I have to agree. The videos are great, but so much more is needed. One
 thing I can suggest is to post any questions on the dabo-users list.
 Both the authors are very responsive and helpful.

blush Thanks for the compliment. Both Paul and I are very much  
aware of the lack of documentation, but it feels like anything we  
write now would become out-of-date quickly, since things (especially  
in the visual tools area) are changing so rapidly. I am planning on  
writing some documentation once the Class Designer and Menu Designer  
are largely completed, because then it will be a while before the  
next major change, as we look to integrate these tools into an IDE.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copying a tuple to a list..

2006-03-06 Thread Ed Leafe
On Mar 6, 2006, at 12:42 PM, [EMAIL PROTECTED] wrote:

 i have a result tuple from a MySQLdb call that would like to change in
 place..

 i would like to copy it to a list, so i can modify it in place, but i
 cannot figure out how to do it.

 the result typle is

 dataResults

dataList = list(dataResults)


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Mixin class error

2006-03-06 Thread Ed Leafe
In Dabo, we create cursor classes that combine the backend-specific  
dbapi cursor class with our own mixin class that adds framework- 
specific behaviors. This has been working well for a couple of years  
now with many different backends, but today I'm getting errors with  
our Firebird class. I've checked the kinterbasdb site, and found  
nothing there that was helpful. The error reads:

TypeError: Error when calling the metaclass bases
 type 'kinterbasdb.Cursor' is not an acceptable base type

Here's some simple code that will generate the error:

import kinterbasdb
KCursor = kinterbasdb.Cursor

class TestMixin(object): pass
# This next line will raise the error.
class CombinedCursor(TestMixin, KCursor): pass
myCursor = CombinedCursor()

I'm not sure exactly what this error message means, so I don't know  
how to go about fixing it. Here's my setup:

Windows 2000
Python v. 2.4.1
kinterbasdb 3.2.0a1

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mixin class error

2006-03-06 Thread Ed Leafe
On Mar 6, 2006, at 8:08 PM, Kent Johnson wrote:

 I have no clue but googling 'type is not an acceptable base type'  
 finds
 this thread
 http://groups.google.com/group/comp.lang.python/browse_thread/ 
 thread/628b8ad34a36db17/579f716b143f4967%23579f716b143f4967? 
 sa=Xoi=groupsrstart=0num=3

I spent about an hour Googling and never found that thread!

 So it looks like kinterbasdb.Cursor is a C extension class that may  
 not
 be subclassed because Py_TPFLAGS_BASETYPE is not set. Whether this  
 is by
 design or accident would be a question for the kinterbasdb developers.

OK, I'll ask them.

 One workaround might be to use delegation instead of subclassing...

Yeah, but that would involve a lot more work at this point. The  
mixin approach has been working quite well up until this problem.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [IDE] - The Dynamic Opportunity - ActiveState Komodo IDE / Open Source

2006-01-26 Thread Ed Leafe
On Jan 26, 2006, at 6:37 PM, Ilias Lazaridis wrote:

 As a first step, a free personal edition (non-commercial and academic
 use) would help to spread the Komodo IDE within the communities.

 This would be a gentle contribution to the open source dynamic
 languages, which are a foundation for the ActiveStates business.

 An Open Source Komodo IDE would allow the several dynamic language
 communities to collaborate on a common goal.

If Komodo were to go open source, I would certainly consider it as  
the basis for the Dabo IDE project.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Adding methods to instances

2005-12-16 Thread Ed Leafe
On Dec 16, 2005, at 7:55 AM, Antoon Pardon wrote:

 But this will make the function a method to all instances of the  
 class.
 Is that what you want? From your first post I had the impression you
 only wanted the function to be the method of one particular instance.

 Yes, you're correct - I hadn't noticed that, since all my tests  
had single instances.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Adding methods to instances

2005-12-16 Thread Ed Leafe
On Dec 16, 2005, at 6:26 PM, [EMAIL PROTECTED] wrote:

 You can also just use:

 t.dynamic = dynamic.__get__(t)

 OK, I've tried that, and it does indeed work well. I've never  
had occasion to use descriptors before, and while it's clear what's  
going on, it still has a 'magical' feel to it!

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




-- 
http://mail.python.org/mailman/listinfo/python-list


Adding methods to instances

2005-12-15 Thread Ed Leafe
 Here's what I'm trying to do; please let me know if I'm nuts or  
not.

 Given a string consisting of the code you would normally define  
in a class's method, add that compiled code to an instance of that  
class so that it can be called just like any other bound method.  
Here's an example:

xx = def dynamic(self):
print dynamic, self.testAtt


class Test(object):
 testAtt = sample
 def normalMethod(self):
 print normal, self.testAtt

testInstance = Test()
# Here's where the magic is needed
# so that the rest of this example works.
testInstance.normal()
- 'normal', 'sample'
testInstance.dynamic()
- 'dynamic', 'sample'

 So? Am I nuts? Or is this possible?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Adding methods to instances

2005-12-15 Thread Ed Leafe
On Dec 15, 2005, at 11:51 AM, Lawrence Oluyede wrote:

  So? Am I nuts? Or is this possible?

 Yes it is, use exec() to turn your string in valid Python code
 and bind the dynamic function as a method of class Test

 xx = def dynamic(self):
 print dynamic, self.testAtt
 

 exec xx

 class Test(object):
  testAtt = sample
  def normalMethod(self):
  print normal, self.testAtt

 t = Test()
 Test.dynamic = dynamic
 t.dynamic()

 Thanks! I knew I had done this before. My mistake was that I was  
setting the exec'd code to the instance, and not to the class. That  
works, but makes it a function, which doesn't automatically get sent  
the 'self' reference.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Ed Leafe
On Dec 5, 2005, at 3:13 PM, Paul McNett wrote:

 Indeed, there is only one user interface that needs no  
 documentation whatsoever.

 Yeah, and it sucks!  ;-)

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Ed Leafe
On Dec 3, 2005, at 3:37 PM, Scott David Daniels wrote:

 They appear in different positions on different terminals (older hard-
 copy),

 Is anyone still using such devices to program Python?

 do different things on different OS's,

 Such as? I use OS X, Windows and Linux daily, and tabs work just  
fine on all of those. Which OS is it that is aberrant, and how  
exactly does it pose a problem?

 and in general do not behave nicely.

 Again, specifics would be welcome. I've been using tabs for  
indentation for over a decade, and have not once run into the horror  
stories that everyone who hates tabs says will happen, but who never  
give specifics as to how they cause problems.

 If you want to use spaces, great. I'm certainly not going to  
make up reasons why spaces are bad, just to make me feel better about  
my preference. Just don't make general damning comments without any  
specifics to back them up.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Ed Leafe
On Dec 3, 2005, at 5:55 PM, Sybren Stuvel wrote:

 That depends on your editor. Mine (vim) can be instructed to insert
 the appropriate amount of spaces on a tab, and remove them on a
 backspace.

 So let's say that you are using 4 spaces as your standard, but  
by accident type 5. You hit backspace, which deletes 4 spaces, and  
you now have to mentally compute the difference in order to keep  
things aligned.

 See, I can make up bizarre scenarios where spaces cause  
problems, too.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Dabo 0.5 released!

2005-11-30 Thread Ed Leafe
 forms look, but also how they behave.

The Report Designer continues to improve: it now has an integrated  
Property Sheet for altering the appearance of objects, as well as  
improved layering. It also supports full 2-way editing: both visual  
and XML editing changes are reflected in the other.


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Dabo 0.4.2 released!

2005-10-08 Thread Ed Leafe
 We are pleased to announce the 0.4.2 release of Dabo, the 3-tier  
application framework for Python.

 The primary focus of our work for this release has been a  
tightening up of the various properties of many of the UI controls to  
create a more consistent interface. Since these controls were  
developed one at a time as needed, they had some subtle but  
significant differences in the way they worked. This release  
addresses a lot of those concerns.

 We've also added auto-binding of methods to events. For example,  
if you want to have your code react to MouseEnter event, all you need  
to do is add a method named onMouseEnter(), and Dabo will bind it to  
that event. Thanks to the PythonCard folks for this idea!

 Work on the Report Writer continues to proceed; it now supports  
groups and report variables. These improvements have been integrated  
it into the wizard-generated apps, too.

 Needless to say, there have also been a few bug fixes. A list of  
all the changes follows my sig. You can grab the latest, as always,  
from http://dabodev.com/download.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dabo-0.4.2 (2005-10-07) (Revision 1418):
Added PrimaryBizobj property to dForm, which can replace calls to  
getPrimaryBizobj().

Added Accepted property to dOkCancelDialog, which gets set  
automatically if the
user pressed OK.

Added AutoSQL, UserSQL, CurrentSQL, LastSQL properties to dCursor and  
dBizobj.
When time to requery, the SQL will come from UserSQL if set, or  
AutoSQL will
be regenerated.

Fixed a bug that kept changes to a new record from getting committed.

Added DefaultValues property to bizobj.

Added ListSelection and ListDeselection events to dListControl. Added  
properties
MultipleSelect, HitIndex, LastSelectedIndex, HeaderVisible,  
HorizontalRules,
and VerticalRules. Changed the behavior of both dListControl and  
dListBox so that merely selecting an item doesn't raise the Hit  
event; instead, it raises a ListSelection event, and if another item  
had been previously selected, it raises a ListDeselection event. Hit  
is only raised from double-clicking on an item, or by pressing Enter.

Added new property to dTextBox: StrictDateEntry. Changed the code for
interpreting dates entered by the user to allow for some less explicit
formats (MMDD, YYMMDD, and MMDD). If StrictDateEntry is False (the
default), these other formats will be used when interpreting dates
entered by the user.

Added field-level validation to the framework.

Improved support for decimal.Decimal, both at the database level and in
dTextBox.

Added new auto event binding, which automatically binds events based  
on any
defined callback functions. For example, if you have a method  
onMouseEnter()
defined, the dEvents.MouseEnter will automatically be bound to that  
method.
Inspired by PythonCard.

Added RegID property to forms, that allows for object registration
with the form. Not all objects require RegIDs, but if they have one,
they must be unique among all objects in a form. A reference to that
object can then be gotten from any other object by calling
'self.Form.getObjectByRegID(regid)'.

Linked RegID to the auto event binding, so that if a form has a method
of onHit_cmdOK(), and has a button with a RegID of 'cmdOK', the
cmdOk's Hit will get bound to the form's callback, automatically.

Improved dGrid and dColumn. Many properties added, and you are now in  
much
finer control over the display of grid column headers, grid cell  
attributes,
grid cell editors and renderers, and the grid itself.

Began work of allowing case-insensitive property values for  
properties that
take string values, and for properties that take a limited number of  
values
where the first letter is unique, you can set the property by just  
using the
first letter. dTextBox.Alignment = c sets the property to Center,  
for
example.

Modified dBizobj, dCursorMixin, and dBackend so that the user can  
specify
the Unicode Encoding to use. Changed the default encoding from  
latin-1 to
utf-8.

Added feature to optionally draw sizer outlines on any form that uses  
dSizers.
This is currently accessible via an option in the View menu when the  
base
menu bar is in use, or you can turn it on/off programatically.

Grids now remember the column that is sorted, and resort when next  
instantiated.

Added support in dReportWriter for report groups and report  
variables, and
dynamic band heights (based on the height of contained objects).  
Added showExpr,
which is an expression that evaluates at runtime and if true, shows  
the object
in the report, and not if false.

Improved the automatic print preview report format in datanav. It now:

 + prints column headers

 + mirrors the font size, column width, cell vertical and horizontal
   alignment, and column height of the grid

 + mirrors the font size, header height

Re: MySQLdb - create table problem

2005-09-17 Thread Ed Leafe
On Sep 17, 2005, at 3:04 PM, Ed Hotchkiss wrote:

 There is no oreilly in the code ... I still get an error, any other  
 ideas? sorry ...

 Strange; can you explain where the text quoted (reilly, Python,  
Archive, http://
python.oreilly.com/archive.html) came from, then?

 Also I noticed in another message on the list (this one drifted  
off-list, due to the poor choice of Reply-To: setting by the list  
admins; I'm moving it back) that you had another error:

 cursor.execute (
  INSERT INTO links (Name, URL, category)
  VALUES (%s, %s, %s) % tuple(links[0:3])
 )

 This should be:

 cursor.execute (
  INSERT INTO links (Name, URL, category)
  VALUES (%s, %s, %s), links[0:3]
   )

You don't even need to cast the args into a tuple when you use  
MySQLdb's parameter handling. It will automatically add quotes to any  
string values, and will automatically escape any problematic  
characters, such as single quotes, semi-colons, etc.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wheel-reinvention with Python

2005-08-16 Thread Ed Leafe
On Tuesday 16 August 2005 05:48, Magnus Lycka wrote:

 The fact that his excellent, more or less daily postings are so badly
 needed does indicate a problem, either with the design of the toolkit,
 or with the docs. I'm not sure which.

 I htink that there is such an overwhelming amount of stuff in a UI toolkit 
that it is impossible to create a how-to. Instead, what is needed is a whole 
series of smaller how-tos for various situations. I mean, there are literally 
thousands upon thousands of UI behaviors to work with, and no way to describe 
how to work with low-level drawing primitives in the same document as how to 
process a menu selection.

 When will that wxpython book appear?

 According to one of the authors, Noel Rappin: It'll be called _wxPython In 
Action_ by Noel Rappin and Robin Dunn.  I was told to expect that it would be 
released in November, but the exact date will depend on how quickly we can 
turn around the production.

 So while it's still a little ways off, it's certainly within sight!
-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >