Which Python API for PostgreSQL?

2006-08-04 Thread Redefined Horizons
I have been working with PostgreSQL for a while, and have just made
the move to Python a couple of months ago. I noticed that there are at
least 2 Python API's to PostgreSQL. I have looked at PygreSQL and
PostgrePy.

What are the advanatages and disadvantages of each? Which one do you
use? What do you like about it?

I appreciate any information that will help me to choose the best API.
I plan on designing some data-entry applications in PyGTK that work
with Python. My server will be running on a Linux box, but most of the
clients will be connecting on MS Windows boxes.

Thanks,

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


Questions about extending Python...

2006-06-09 Thread Redefined Horizons
I've got a third-part application that exposes a C API. I'd like to
wrap it in Python. Is there a specific forum that covers extending and
embedding Python, or are those type of questions O.K. on this list?

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


Python or Ajax?

2006-06-09 Thread Redefined Horizons
I've been hearing a ot about AJAX lately. I may have to build a web
application in the near future, and I was curoius:

How does a web application that uses Python compare with one that uses AJAX?

I've done some basic web page design with HTML and CSS, but never any
web applications. I don't want to learn a new language if I can use
Python. Would AJAX offer me any significant advantages?

Thanks,

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


First question on extending Python...

2006-06-09 Thread Redefined Horizons
I still new to Python, and I've only dabbled in C, but I've got my
first project I need to tackle that involves both languages. I was
hoping to get some advice on how to proceed.

There is a third-party application that I need to work with. It is
closed-source, but it exposes a C API. I want to wrap this C API so
that it is available from Python. I have no ability to modify the C
API of the third part application.

Do I the C functions that I wrap in an extensions module for Python
need to be in a certian format? If so, I will have to write an
intermediate DLL in C that wraps the third-party application and
exports the functions in a form that Python can use.

Or can an extension module for Python wrap any C function? If this is
the case I think I can skip the intermediate C DLL.

Are there any advantages to using the intermediate DLL written in C in
this particular case where I will not have ability to manipulate the C
API of the third party application directly? (For example, if the
third-party application developers are willing to call a "call-back"
function that must be written in C, but not Python. Could the same
extension module export both C functions and serve as a Python
module?)

Thanks,

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


Extending Python - Understanding Flags...

2006-06-12 Thread Redefined Horizons
I'm trying to understand the argument flags that are used in the
method table of an extension module written in C.

First let me ask this question about the method table. Is it an C
array named "PyMethodDef"?

Now, onto my questions about the arguments:

[1] I see that even when the Python function we are supplying takes no
arguments, (the argument flag is METH_NOARGS), that we still pass the
C function a reference to "self". Is this "self" actually a pointer to
the section of memory that represents the object in Python that is
calling the method?

[2] What is the difference between "positional" arguments indicated by
the METH_VARARGS argument flag, and "keyword" arguments that are
indicated by the METH_KEYWORDS argument flag? Does one determine the
identity of an argument based on the order or position in which the
arguments are passed to the C function, while the other uses keys in a
dictionary to identify the arguments?

That should be the start of my customization questions... :]

If it is any consolation I hope to take what I learn and put together
a tutorial on expanding Python for those that only have a little
experience with C programming, like myself. I plan to explain
everything like I was teaching a 6-year old. :]

I was just going to put this on a wiki, but is there a way to include
with other Python documentation on an "official" site?

Thanks for the help.

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


Dividing integers...Convert to float first?

2007-01-05 Thread redefined . horizons
I'm still pretty new to Python. I'm writing a function that accepts
thre integers as arguments. I need to divide the first integer by te
second integer, and get a float as a result. I don't want the caller of
the function to have to pass floats instead of integers. How do I
convert the arguments passed to the function into floats before I do
the division? Is this necessary, or is their a better way?

Thanks,

Scott Huey

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


Adding a directory to the Python System Path - Edit the registry?

2007-01-05 Thread redefined . horizons
I have been trying to find a way to add a directory to Python's sytem
path on my MS Windows XP computer. I did some searching online, but the
only solution I found involved editing the MS Windows Registry. That
seemed a little to hard core. Is there another easier way to do this?

Thanks,

Scott Huey

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


Re: Adding a directory to the Python System Path - Edit the registry?

2007-01-05 Thread redefined . horizons
Thanks Martin.

I'll take a look at the documentation you pointed out.

Scott

Martin P. Hellwig wrote:
> [EMAIL PROTECTED] wrote:
> > I have been trying to find a way to add a directory to Python's sytem
> > path on my MS Windows XP computer. I did some searching online, but the
> > only solution I found involved editing the MS Windows Registry. That
> > seemed a little to hard core. Is there another easier way to do this?
> >
> > Thanks,
> >
> > Scott Huey
> >
>
> Take a look at:
> http://docs.python.org/tut/node8.html
>
> Specifically 6.1.1 and 6.2, perhaps that might answer your question.
> 
> Cheers
> 
> -- 
> mph

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


Pausing for Python Interpreter error messages...

2007-01-05 Thread redefined . horizons
I've written a few classes that I have been testing in IDLE. However,
every time I make a change to the classes based on the testing I have
to walk through all he steps of preparing the classes for testing
again.

So I wrote a script that does all the set-up work for me. The only
problem is when I run this script using the Python interpreter I can't
get the command prompt to stay up long enough for me to read the
message.

How do I get the command prompt to stay up? Is there a way to run my
script and view the error message in IDLE?

Thanks for the help.

Scott Huey

P.S. - I'm using Windows XP with the latest Python 2.3.

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


Re: Pausing for Python Interpreter error messages...

2007-01-07 Thread redefined . horizons
Thanks Bruno.

I'll get the 2.5 python install, and I'm checking out the unit testing
module that you mentioned.

Scott Huey


Bruno Desthuilliers wrote:
> [EMAIL PROTECTED] a écrit :
> > I've written a few classes that I have been testing in IDLE. However,
> > every time I make a change to the classes based on the testing I have
> > to walk through all he steps of preparing the classes for testing
> > again.
> >
> > So I wrote a script that does all the set-up work for me.
>
> You may want to have a look at the unittest module then:
> http://docs.python.org/lib/module-unittest.html
>
> > The only
> > problem is when I run this script using the Python interpreter I can't
> > get the command prompt to stay up long enough for me to read the
> > message.
> >
> > How do I get the command prompt to stay up?
>
> first open the "command prompt", then launch your script from the
> command prompt.
>
> > Is there a way to run my
> > script and view the error message in IDLE?
>
> menu run->run module, or just hit the F5 key.
>
> > Thanks for the help.
> >
> > Scott Huey
> >
> > P.S. - I'm using Windows XP with the latest Python 2.3.
> > 
> 
> Python 2.3 is years old. Latest is 2.5.

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


Java Developer Exploring Python

2006-04-17 Thread redefined . horizons
I've traditionally been a Java developer, although I play around with
LISP. I recently migrated to Linux and I was exploring Mono as an
option for development on Linux. However, I've had some problems with
the maturity and support when working with Mono. So I was considering
Python as an alternative development language.

Is Python actively developed and supported on Linux? Would it be a
viable option for cross-platform application development?

Can anyone recommend an open source IDE for Python that runs on Linux?

Thanks,

Scott Huey

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


Re: Java Developer Exploring Python

2006-04-17 Thread redefined . horizons

Ravi Teja wrote:
> >> I've traditionally been a Java developer, although I play around with LISP.
>
> For most java developers, understanding dynamic typing is a big step.
> Your Lisp background however would mean that you will pick up Python
> very quickly.
>
> >> I recently migrated to Linux and I was exploring Mono as an
> option for development on Linux. However, I've had some problems with
> the maturity and support when working with Mono.
>
> IronPython (still a beta) BTW, runs on Mono as well and you can use
> Mono through Python when you deem it ready. There is also Jython, which
> runs on the Java platform if you feel married to Java platform or class
> libraries.
>
> >> Is Python actively developed and supported on Linux?
>
> Yes and very well so. Many Linux distributions come with Python
> pre-installed and Python has quite a bit of following in the Linux
> crowd. Red Hat / Fedora installer - Anaconda, for example uses Python.
>
> >> Would it be a viable option for cross-platform application development?
>
> Python is a very good candidate for open source development. But then
> again, most open source languages these days are. The culture is a bit
> different though. Although Python is byte code compiled just like Java,
> Python programmers are not averse to using native extensions (which in
> most cases can be compiled painlessly on all popular platforms thanks
> to Python's distutils). Java programmers on the other hand generally
> extol 'Pure Java'. Both approaches have their own advantages and
> disadvantages (Swing vs SWT) and you can use either with Python.
>
> >> Can anyone recommend an open source IDE for Python that runs on Linux?
>
> Most Python IDEs are open source along with a few commercial ones.
> http://wiki.python.org/moin/IntegratedDevelopmentEnvironments
> Everyone has their favorites and you should pick your own.
>
> Since you have a Java background, PyDev is probably the best choice for
> you. JEdit also has a Python plugin. I just use SciTE (just an editor)
> most of the time.

Ravi,

Thank you for taking the time to answer my questions. It sounds like
Python may be the solution I am searching for. I took a look at lists
of the IDEs on the wiki. Looks like I might be sticking with the IDLE
editor for now. :] Perhaps I will have to write a simple IDE for Python
that integrates Glade and supports pyGTK when I have some more
programming experience...

Scott Huey

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


Missing interfaces in Python...

2006-04-17 Thread redefined . horizons
I'm coming from a Java background, so please don't stone me...

I see that Python is missing "interfaces". The concept of an interface
is a key to good programming design in Java, but I've read that they
aren't really necessary in Python. I am wondering what technique I can
use in Python to get the same benefits to a program design that I would
get with interfaces in Java.

For example, if I want to have a program with a Car object, and a Bus
object. I want both of these objects to present a common group of
methods that can be used by Mechanic objects, but slightly different
methods that can be used by Driver objects.

In Java I would accomplish this by defining an IFixable interface that
would be implemented by both the Car and Bus objects. Mechanic objects
would work with any object implementing this interface.

How would I approach this problem in Python? I think I would use an
abstract class instead of an interface for IFixable, since Python
supports multiple inheritance, but I'm not sure this is correct.

Thanks for any suggestions.

Scott Huey

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


Re: Missing interfaces in Python...

2006-04-17 Thread redefined . horizons
Thanks for the responses...Looks like I might have opened Pandora's box
here. Could I accomplish the above with an abstract class?

If the mechanic class had a "fixIt()" method defined, could I pass it
any object I wanted, and then just call the method that I expect to
find there, or do I need to strictly define the type, or class, of an
object that is passed to a method.

Scott Huey

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


Plug-Ins In A Python Application

2006-04-18 Thread redefined . horizons
Its the Java developer again...

I'm working on an application framework that I would like to implement
in Python. Part of the application framework is a plug-in model that is
similar to the one used in Eclipse.

Is it possible to load and use "modules" containing plug-in code
written by third party developers into a running instance of the
framework? How would I do this? Do I need to "dynamically load" the
module at runtime? (I will scan a folder in the application direcotry
for XML files containing information about the plug-ins, including the
modules that implement them.)

Thanks,

Scott Huey

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


Thanks from the Java Developer

2006-04-19 Thread redefined . horizons
I wanted to thank those members of the Python community that took the
time to answer my questions about interfaces and plug-ins in Python. I
have discovered that Python is a very powerful language, and one that I
look forward to using for Linux development. I have found the support
for Python much better than that for Mono, and I will be moving
development of my Linux applications to Python.

Thank you again for the help.

Scott Huey

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


Confused about properties, descriptors, and attributes...

2006-04-20 Thread redefined . horizons
I've been reading about Python Classes, and I'm a little confused about
how Python stores the state of an object. I was hoping for some help.

I realize that you can't create an empty place holder for a member
variable of a Python object. It has to be given a value when defined,
or set within a method.

But what is the difference between an Attribute of a Class, a
Descriptor in a Class, and a Property in a Class?

If I had a Monster Class, and I wanted to give each Monster a member
variable called ScaryFactor, how would I define it? Does a Property
simply provide methods that access an Attribute?

Thanks,

Scott Huey

P.S. - I'm speaking about the "new" Python classes, not the "old" ones.
I hope my questions make sense.

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


Events in Python?

2006-04-26 Thread redefined . horizons
Here is another non-pythonic question from the Java Developer. (I beg
for forgiveness...)

Does Python have a mechanism for events/event-driven programming?

I'm not necessarily talking about just GUIs either, I'm interested in
using events for other parts of an application as well.

If there isn't some sort of event mechanism built into Python, where
might I find some information about implementing one?

Thanks,

Scott Huey

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


Re: Events in Python?

2006-04-26 Thread redefined . horizons
Thank you for all of the responses. I will check out the Traits link.
It looked very interesting.

It seems like Python doesn't have a "standard" implementation of an
event or messaging system. That is really what I was curious about. I
wanted to check before I implemented something of my own.

Thanks again for the help.

Scott Huey

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


What do you use __init__.py for?

2006-04-27 Thread redefined . horizons
I have just started learning about Python Packages. I know that a
directory must contains the '__init__.py'  script to be considered a
Python package, and that this script is executed when the package is
imported.

But what other uses does the '__init__.py'  script have? What do you
use it for?

I imagine it could provide, at the least, some helpful metadata about
the contents and dependencies of the package.

I'm just looking for ideas...

Thanks,

Scott Huey

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


Protocols for Python?

2006-04-27 Thread redefined . horizons
I think I have reached an important moment in my growth as a Python
Developer. I realize now why interfaces aren't really necessary in
Python. :]

Still, I'm designing an application that I want to be extendable by
third-party developers. I'd like to have some sort of documentation
about what behavior is required by the components that can be added to
extend the application. I'd thought I might try documenting these
behaviors as "protocols" instead of creating abstract classes with no
method implementations.

I stumbled across PyProtocols, but I don't think it is what I am
looking for. I don't want to "implement" a form of interfaces in the
python language, just document the required behavior for certain
objects in my application for other developers.

Is there a standard way to document protocols in Python? Of should I
come up with something tailored to my needs.

Thanks,

Scott Huey

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


Using Parts of PEAK

2006-04-27 Thread redefined . horizons
I was intriuged by the concept of Python Eggs and some of the work that
has been done on PEAK.

http://peak.telecommunity.com/

However, I think PEAK might be overkill for the particular design I am
considering. Is anyone using just part of PEAK in their Python
development. Are there alternative distribution enhancements for Python
besides PEAK that I might take a look at?

Thanks,

Scott Huey

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


Foriegn contents in Python Packages...

2006-04-27 Thread redefined . horizons
Is it possible to store "non-python" files in a directory that serves
as a Python Package? (Like an image file or an XML file.)

Is this allowed for sub-directories that are not Python Packages? In
other words, can I have a Python Package that contains other Python
Packages and also folders that aren't Python Packages?

Thanks,

Scott Huey

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


Help System For Python Applications

2006-05-16 Thread redefined . horizons
I did some searching for this topic, but couldn't find anything. A
search of this list only turned up an old post from 2002.

I'd like to add a comprehesive help system to my Python Application. By
"comprehensive" I mean regular "read-like-a-book" help and context
sensitive help that can be launched from the application.

Is there an existing system in Python that would support this, or would
I need to start from scratch?

On a related note, is there a way to fire up Adobe's Acorbat Reader or
and Web Browser from Python and have the external application open a
specified PDF or HTML file? (For example, I want to open the file
"myhelp.pdf" in reader from Python code.)

Could you give me an example of the code that would do this?

Thanks for all the help on my help. :]

Scott Huey

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


Re: Help System For Python Applications

2006-05-16 Thread redefined . horizons
Thanks for the responses. I'll check out the web browser module, and
I'll make sure that I release any work ona help system to the
community.

Scott Huey

bruno at modulix wrote:
> [EMAIL PROTECTED] wrote:
> > I did some searching for this topic, but couldn't find anything. A
> > search of this list only turned up an old post from 2002.
> >
> > I'd like to add a comprehesive help system to my Python Application. By
> > "comprehensive" I mean regular "read-like-a-book" help and context
> > sensitive help that can be launched from the application.
> >
> > Is there an existing system in Python that would support this, or would
> > I need to start from scratch?
>
> This depends on the system and UI, so their can be no one-size-fits-all
> builtin solution. Hint : look at how other programs using the same
> system and UI solved the problem.
>
> > On a related note, is there a way to fire up Adobe's Acorbat Reader or
> > and Web Browser from Python and have the external application open a
> > specified PDF or HTML file? (For example, I want to open the file
> > "myhelp.pdf" in reader from Python code.)
>
> os.system() may be a good start.
>
> HTH
> --
> bruno desthuilliers
> python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
> p in '[EMAIL PROTECTED]'.split('@')])"

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


Re: Help System For Python Applications

2006-05-16 Thread redefined . horizons
Thanks for the link Paul. It looks like you've done some good work on
that module.

I'll check it out.

Scott

Paul Boddie wrote:
> bruno at modulix wrote:
> > [EMAIL PROTECTED] wrote:
> >
> > > On a related note, is there a way to fire up Adobe's Acorbat Reader or
> > > and Web Browser from Python and have the external application open a
> > > specified PDF or HTML file? (For example, I want to open the file
> > > "myhelp.pdf" in reader from Python code.)
> >
> > os.system() may be a good start.
>
> Take a look at the desktop module for a partial solution:
>
> http://www.python.org/pypi/desktop
>
> An example:
>
> import desktop
> desktop.open("itools-0.9.0.pdf")
>
> Apparently, os.startfile will expose (or already exposes) other
> parameters which may specify that the file be printed, amongst other
> things. I may well add such functionality to the desktop module, since
> various non-Windows systems have supported such things for a while.
> 
> Paul

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


Re: Using python for a CAD program

2006-05-23 Thread Redefined Horizons
This is a very interesting discussion. :]
 
I regularly use CAD and GIS programs at work, and have dabbled in traditional RDBMS design. I ran into a problem with an open source GIS program I work with, that reads all features in a shapefile into memory. This limits the use of the program, given the size of many geospatial data sets. 

 
I decided we needed to implement a system for storage of features and geometries that would overcome this memory limitation. I looked at existing RDBMS and Object-Oriented Databases and decided it would be better to start from scratch. I am designing an object oriented-database that will work with CAD and GIS systems. The first implementation will be in Java, but I hope to create an implementation in Python as well. 

 
It will have features like undo/redo (transactions) and mulit-user access. I am no expert programmer, so I'm not sure how great this will work, but I know it will be better than the system we have now.
 
Scott Huey 
On 5/22/06, baalbek <[EMAIL PROTECTED]> wrote:
 
David Cuthbert wrote:> This does not mean the design itself should be stored as an RDBMS.  As
> I've stated previously, CAD data (both electrical and, it appears,> mechanical) does not lend itself to RDBMS relationship modeling.I simply do not agree with this.A CAD program (like Autocad) is nothing 
but an advanced database editor: the program loads data from a binaryfile and creates its object (in memory) from the tables that it readsfrom the file on the disk.The point is that this could as well have been stored on tables in a 
RDBMS; the process of loading the object once the data has been fetched(either from a binary file, or a RDBMS) the process is similar.The advantage of having the data stored in a RDBMS is many, amongst them 
the ability to check-out just the data one needs, better administrationof the drawings (consistent plotting, dimensioning styles, fonts, etc)and a much better tool for gathering statistics of the project (sums of 
areas, rooms, doors, etc etc).What happens in the CAD program (once loaded in memory) is simplyirrelevant to how the data are stored.Regards,Baalbek--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list