Re: Code reformater?

2007-01-21 Thread Vincent Delporte
On Sun, 21 Jan 2007 14:15:46 +1100, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Still, it is better not to lose the indentation in the first place.

Thanks for the tips. But it does happen when copy/pasting code from
either a web page or an e-mail that TABs are messed up, which is not a
problem with other languages, but is a problem with Python. Too bad.
-- 
http://mail.python.org/mailman/listinfo/python-list


Code reformater?

2007-01-19 Thread Vincent Delporte
Hello

When I copy/paste Python code from the web, every so often,
the TABs are wrong, which means that the code won't work and I have to
manually reformat the code.

Is there a code reformater that can parse the code to make it right?

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


Re: Good Looking UI for a stand alone application

2006-12-20 Thread Vincent Delporte
On Tue, 19 Dec 2006 08:15:18 -0600, Chris Mellon [EMAIL PROTECTED]
wrote:
There's a few more caveats I haven't addressed, and there are places
where wx isn't perfect. 

BTW, do you know of a good article/book on writing cross-platform GUI
apps, with recommendations, pitfalls, etc. especially using wxWidgets?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-18 Thread Vincent Delporte
On 17 Dec 2006 21:20:14 -0800, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
You could write it as a web app, with an executable which launches the
server and points a browser at it.

Right, I was thinking of this too, but since the OP was talking of a
fat app...

Python GUI work is a bit of a drag, really. One of the worst things
about it, IMHO.

But then, it was built for write text-based scripts. I assume someone
could take it, and turn it into a GUI-based solution for Windows, but
it's probably quite a lot of work, and maybe there just isn't anyone
willing to pay for it. It'd be cool, though to be able to just send
someone a 10KB GUI Python script and have it run in Windows natively
:-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-17 Thread Vincent Delporte
On Sun, 17 Dec 2006 09:37:04 +0100, [EMAIL PROTECTED] (Luc Heinrich)
wrote:
Crossplatform toolkits/frameworks suck. All of them. No exception. If
you want your app to look *AND* feel great on all platform, abstract the
core of your application and embed it in platform native GUI code.

+1. Applications beyond very basic GUI's are better off rewriting the
GUI for each application, while keeping the business logic separate.
Even something as basic as QuickTime sucks on Windows.

I'd be curious to see the source code to Skype: I just installed the
Linux version, and it looks very nice. Maybe it was recompiled with
Kylix.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-17 Thread Vincent Delporte
On Mon, 18 Dec 2006 01:23:10 +0100, Christophe Cavalaria
[EMAIL PROTECTED] wrote:
They use QT. Back to read the first part of your post.

It doesn't make much difference: 
- QT is big, so even small apps carry a lot of baggage
- by not using the native widgets, you're dependent on that layer to
keep up with changes in the look  feel of the platform (eg. XP's
widgets that look different from previous widgets).

Bottom line: GUI apps are better off extracting the maximum amount of
logic into OS-agnostic code, and then rewrite the GUI for each
platform.

Even better: Considering that Windows has a 95% market share, make
doubly-sure that it makes financial sense to provide a cross-platform
GUI application (the server can be written in text mode, and can then
be available for multiple OS's with no major problem).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 5 Dec 2006 17:05:06 -0800, fumanchu [EMAIL PROTECTED] wrote:
In a nutshell, mod_python gives you
access from Python to the Apache API, whereas CherryPy and friends give
you their own API.

I didn't know Apache had an API of its own, or that it was even needed
when writing a web application in Python. What does it provide in
addition to Python/mod_python?

 CherryPy allows me to focus
on the application layer and leave the server/deployment layer for
another day.

So you recommend using Apache as the front-end, and run an application
server like CherryPy in the background?

 But IMO CherryPy has a cleaner API
for process control (engines and servers), application composition (via
the object tree and via WSGI), and plugins (like gzip, static content,
and header management).

Interesting. I'll see if I can find more information on writing an app
with Python in pure CGI, in FastCGI, in mod_python, and as an
application server with eg. CherryPy.

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


Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 6 Dec 2006 14:55:58 -0800, Graham Dumpleton
[EMAIL PROTECTED] wrote:
Although WSGI is an extreme case because of the level it pitches at,
other systems such as CherryPy and Django aren't much different as they
effectively duplicate a lot of stuff that could be achieved using more
basic functionality of Apache as well.

Mmm... So how can I use those goodies from Apache? Just through their
configuration files, or do I have to somehow call them from Python?

Is the fact that Python developers tend to ignore resources in Apach
due to difficulties in making calls from Python, making the scripts
unpythonic?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 6 Dec 2006 16:32:14 -0800, Graham Dumpleton
[EMAIL PROTECTED] wrote:
Getting perhaps back to the answer you were seeking right back at the
start, that is if you are new to web application and development and
Python, then you may well be better of just using a higher level
framework as they will make it easier and isolate you from any pains in
understanding Apache and how to use it properly.

Thanks a lot for the feedback. It's beginning to make sense :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Mod_python vs. application server like CherryPy?

2006-12-05 Thread Vincent Delporte
Hi

I'm still a newbie when it comes to web applications, so would like
some help in choosing a solution to write apps with Python: What's the
difference between using running it through mod_python vs. building an
application server using Python-based tools like CherryPy, Quixote,
Draco, etc.?

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


Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Tue, 28 Nov 2006 04:30:09 -0600, Nick Craig-Wood
[EMAIL PROTECTED] wrote:
I'm not sure how you do open stdout to /dev/null in python though!

I suspect something like this...

  import posix
  posix.close(1)
  posix.open(/dev/null, posix.O_WRONLY)

Thanks everyone, but no go :-/ Neither the above nor sys.stdout =
open(os.devnull, 'w')  trigger the application.

This is a script that is launched by the Asterisk open-source PBX
server when a call comes in. Its goal is to broadcast some messages to
a Windows caller ID application that is installed on all client hosts
so that they know who's calling.

Before I go ask in an Asterisk forum, is there some Python-related
issue that experienced Python developers can spot in this rewrite of a
Perl script that works?

Here's the original Perl script:
http://www.voip-info.org/wiki/view/Asterisk+NetCID

Here's my Python rewrite:
http://codecomplete.free.fr/asterisk/python_cid.txt

Yes, I changed the UDP port from 42685 to 42687 so that my development
client host is the only one getting the broadcast :-)

Thank you!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 15:38:11 +0100, Vincent Delporte [EMAIL PROTECTED]
wrote:
Here's my Python rewrite:
http://codecomplete.free.fr/asterisk/python_cid.txt

More information. Here's what Asterisk says when I call in:

*CLI

-- Executing LookupCIDName(SIP/fxo-0844e458, ) in new stack

-- Changed Caller*ID name to Work

-- Executing AGI(SIP/fxo-0844e458,
ncid.python.agi|087077|Bureau Freebox) in new stack

-- Launched AGI Script /var/lib/asterisk/agi-bin/ncid.python.agi
Failed to execute '/var/lib/asterisk/agi-bin/ncid.python.agi': Exec
format error

-- AGI Script ncid.python.agi completed, returning 0

FWIW, I wrote the original in a Windows text editor, and copy-pasted
the script in Asterisk by sshing into the server. CRLF vs. CR issue?
Something else?

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


Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 15:48:53 +0100, Vincent Delporte [EMAIL PROTECTED]
wrote:
-- Launched AGI Script /var/lib/asterisk/agi-bin/ncid.python.agi
Failed to execute '/var/lib/asterisk/agi-bin/ncid.python.agi': Exec
format error

Stupid me :-/ Forgot the all-important

#!/usr/bin/python

Sorry for the disturbance..
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 10:18:24 -0500, Mike C. Fletcher
[EMAIL PROTECTED] wrote:
which is how Linux knows what interpreter to use for the script.

Thanks. That's what I found out after a bit more research. I didn't
pay attention to this because it's not needed to run under Windows,
and I was focusing on the fork() and stdout thing.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fork and exit needed?

2006-11-28 Thread Vincent Delporte
On Tue, 28 Nov 2006 08:30:03 -0600, Nick Craig-Wood
[EMAIL PROTECTED] wrote:
  import os,sys,time
  print pre:, os.getpid()
  sys.stdout = open(os.devnull, 'w')
  print post:, os.getpid()
  time.sleep(60)
 
  (Granted, I'm on WinXP; I also suspect the original stdout is still open
  in the background, maybe dualled with stderr?)

Yes that is the point - the original stdout is still open.

I don't think this discussion is relevant to windows though - windows
has its own way of making daemons.

Thanks everyone. I'll see if the Python script runs OK in an Asterisk
PBX on Linux.
-- 
http://mail.python.org/mailman/listinfo/python-list


fork and exit needed?

2006-11-27 Thread Vincent Delporte
Hi

I'm a Python newbie, and would like to rewrite this Perl scrip
to be run with the Asterisk PBX:

http://www.voip-info.org/wiki/view/Asterisk+NetCID

Anyone knows if those lines are necessary, why, and what their
alternative is in Python?

---
open STDOUT, '/dev/null'; 
fork and exit;
---

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


Re: Compiling wxPython app for Windows; Single EXE

2006-08-15 Thread Vincent Delporte
On Mon, 14 Aug 2006 17:46:11 -0500, Philippe Martin
[EMAIL PROTECTED] wrote:
Yes there is a way to make one .exe/.msi for everything ... but it does
require purchasing a tool such as VC++.

I have python + wxWindows + my stuff + many other libraries in one installer
(takes 120 Megs (sigh))

I know. An empty frame with wxPython runs at ... 12MB :-/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compiling wxPython app for Windows; Single EXE

2006-08-14 Thread Vincent Delporte
On 14 Aug 2006 09:39:02 -0700, ajaksu [EMAIL PROTECTED] wrote:
I'm using PyInstaller (http://pyinstaller.hpcf.upr.edu/) precisely to
compile a wxPython-based program. So I'm curious about what makes
py2exe the best tool..., because I'm about to miss that due to my
ignorance.

I didn't know about PyInstaller. I'll check it out. Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Compiling wxPython app for Windows; Single EXE

2006-08-13 Thread Vincent Delporte
Hi

I browsed the archives, but since some messages date back a bit, I
wanted to make sure that

- py2exe is still the best tool in town to compile Python scripts to
run on a Windows host that doesn't have Python installed, including
wxWidgets/wxPython

- there's no way to build a single EXE, to make deployment easier (if
multiple files, I need to build an installer with eg. NSIS or
InnoSetup)?

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


Re: Compiling wxPython app for Windows; Single EXE

2006-08-13 Thread Vincent Delporte
On 13 Aug 2006 13:46:14 -0700, Tim N. van der Leeuw
[EMAIL PROTECTED] wrote:
I have a wxPython app, which I compile into one EXE file. Then there's
just 1 support file needed: a MS DLL (which, once distributed, you will
not need to update).

OK. So you compile the Python app into an EXE using py2exe, and then
use eg. 7Zip to combine all the files into a single EXE, that
1. uncompresses itself in the directory validated by the user
2. when done, runs the Python EXE?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Linux] What toolkit for a good grid/spreadsheet widget?

2006-08-04 Thread Vincent Delporte
On Fri, 04 Aug 2006 10:58:42 GMT, Dave Cook [EMAIL PROTECTED]
wrote:
But both pyqt and wxpython also offer that.  Try running the demos for each.

Thx everyone!
-- 
http://mail.python.org/mailman/listinfo/python-list


[Linux] What toolkit for a good grid/spreadsheet widget?

2006-08-03 Thread Vincent Delporte
Hello

I'd like to use Python under Linux to write a business application,
and I'll need a good grid/spreadsheet editable widget, maybe not on 
par with eg. ComponentOne's excellent VSFlexGrid 
(http://www.componentone.com/newimages/flexgrid_02_lg.gif), but
somewhat professional-grade.

Any recommendation? GTK doesn't seem to have one that is good enough
(GTKSheet http://gtkextra.sourceforge.net/ looks like a basic table),
so I was wondering about QT/PyQt and wxWidgets/wxPython. Any
recommendation?

Thank you
VD.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Linux] What toolkit for a good grid/spreadsheet widget?

2006-08-03 Thread Vincent Delporte
On Thu, 3 Aug 2006 22:07:04 +0100, Phil Thompson
[EMAIL PROTECTED] wrote:
PyQt4 has QTableWidget...

Thx for the two pointers. Are those widgets more than just tables, ie.
can I edit the contents, including displaying a combo box, can items
be grouped or hierarchized, or are they just basic, read-only tables
to display results?

I need this kind of widget to build a 2+ column interface to let users
type entries into the application as an alternative to MS Access-style
complicated entry masks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need a compelling argument to use Django instead of Rails

2006-07-31 Thread Vincent Delporte
On 31 Jul 2006 07:05:27 -0700, Ben Sizer [EMAIL PROTECTED] wrote:
Typically you run PHP as a module in your webserver, so there should be
no process startup overhead. mod_python provides the same sort of
functionality for Python, but is not as popular or widely installed as
the PHP Apache module.

So, if mod_python provides the same functionality, it's not the main
reason why Python developers use application servers while PHP users
still program with page codes in /htdocs.

Why do PHP users stick to that old way of things? Because they mostly
use shared hosts, with no way to install their application server?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need a compelling argument to use Django instead of Rails

2006-07-29 Thread Vincent Delporte
On Sat, 29 Jul 2006 04:07:12 GMT, Tim Roberts [EMAIL PROTECTED] wrote:
Exactly.  The Python interpreter can take a significant fraction of a
second to start.  For the typical short web request, the overhead can add
up.

On the other hand, unless you're handling dozens of requests per minute,
users are unlikely to notice.

You can also keep session state in memory instead of spilling to disk, and
you can keep database sessions open.

Thanks for the explanations.
-- 
http://mail.python.org/mailman/listinfo/python-list


War chest for writing web apps in Python?

2006-07-28 Thread Vincent Delporte
Hello

I'm thinking of using Python to build the prototype for a business web
appplication. The development and test machine is XP, while ultimate
deployment will be on a shared Unix web host.

What would you recommend I get, besides the Python engine itself? Good
IDE (Kodomo?) ? Some kind of GUI designer? Add-on's? Other tools?

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


Re: War chest for writing web apps in Python?

2006-07-28 Thread Vincent Delporte
On Fri, 28 Jul 2006 08:06:10 +0200, Vincent Delporte
[EMAIL PROTECTED] wrote:
(snip)

Thanks everyone for the input!

For the IDE: Ideally, I'd like something modern that uses language
wordlists (to show syntax, variables, etc. in different colors), a
window that lists all the procedures so I can easily jump from on to
the other, possibly an edit window that can fold code with the
familiar + sign in the left side, etc. I'll check out WingIDE and
Eric3.

For the GUI builder: It's just that I'm used to Delphi, ie. drawing
the interface with a mouse, but I guess the equivalent is just a
WYSIWYG HTML editor like DreamWeaver etc.

For the application engine: Indeed, I hesitate between CherryPy and
Django, as I've read a lot of nice things about both.

Hopefully, finding web hosters that support Python and those
frameworks won't be an issue?

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


Re: Need a compelling argument to use Django instead of Rails

2006-07-28 Thread Vincent Delporte
On Fri, 28 Jul 2006 17:58:24 +0200, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Ben Sizer wrote:
(snip)
 Pretty much every Python web offering revolves around you having your
 own server with the luxury of running your own long-running processes
 on it. 

BTW, what is the advantage of running a CherryPy/Django server instead
of the regular way of code in pages? Improved performance because the
Python interpreter is already up and running?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: War chest for writing web apps in Python?

2006-07-28 Thread Vincent Delporte
On Fri, 28 Jul 2006 17:31:47 -0400, Dan Sommers [EMAIL PROTECTED]
wrote:
You win that bet.  (We actually tested on both platforms.)  *Not*
testing on the deployment platform is *definitely* asking for trouble.

I did intend to validate it on the deployment platform. It's just that
I prefer to work in Windows than Linux.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: War chest for writing web apps in Python?

2006-07-28 Thread Vincent Delporte
On Fri, 28 Jul 2006 17:33:00 GMT, Dennis Lee Bieber
[EMAIL PROTECTED] wrote:
Well, syntax color coding, and block folding are supported by
PythonWin (comes with the ActiveState Windows install) and SciTE.

   The structural browser isn't as easy...

Thanks for the input.
-- 
http://mail.python.org/mailman/listinfo/python-list