Re: Happy Christmas Pythoneers

2007-12-26 Thread Steven D'Aprano
On Wed, 26 Dec 2007 21:32:54 -0800, [EMAIL PROTECTED] wrote:

>> > Anyway, happy New Years as well to all in the group.
>>
>> watch_fireworks()
>> try:
>>     champagne
>> except NameError:
>>     champagne = any_fizzy_alcoholic_drink_will_do()
>> champagne.drink()
>> shout("Happy New Years!!!")
>> for person in adults_nearby:
>>     if (person.is_appropriate_sex and person.is_pretty):
> 
> Hey, my version of the person module doesn't have an is_appropriate_sex
> attribute, but an is_opposite_sex attribute instead. Is this a new
> version?

Generally instances use:

person.is_appropriate_sex = person.is_opposite_sex

but some instances define it as:

person.is_appropriate_sex = not person.is_opposite_sex

It's an implementation detail, you shouldn't worry about it.


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

Re: Happy Christmas Pythoneers

2007-12-26 Thread Steven D'Aprano
On Thu, 27 Dec 2007 09:09:49 +0200, Hendrik van Rooyen wrote:

> "Zentrader"  wrote:
> 
>> And if you're not a Christian it would be Type Error bug.  Anyway,
>> happy New Years as well to all in the group.
> 
> Followers of Shushla celebrate the new year at the time of the spring
> equinox.
> 
> This has been the cause of  bloody wars between the Northern and
> Southern sects, as She was born in Equador.


I wish you were taking the mickey, but I suspect you're not...

Got any more information? Googling doesn't come up with anything that 
looks promising.



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


Re: Happy Christmas Pythoneers

2007-12-26 Thread Hendrik van Rooyen
"Zentrader"  wrote:

> And if you're not a Christian it would be Type Error bug.  Anyway,
> happy New Years as well to all in the group.

Followers of Shushla celebrate the new year at the time of the spring
equinox.

This has been the cause of  bloody wars between the Northern and
Southern sects, as She was born in Equador.

- Hendrik


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


Re: Accessing Visuall C++ DLL with Python

2007-12-26 Thread Gabriel Genellina
En Thu, 20 Dec 2007 16:48:34 -0300, Murray, John <[EMAIL PROTECTED]>  
escribió:

> I recently obtained USB device. Other users of the device apparently use
> C or C++ to access it. I am more comfortable with Python and have used
> it for other USB devices on a Windows system. I'm more of a hacker than
> a programmer especially when it comes to Windows. The manufacturor
> supplies xxx.h, xxx.lib and xxx.dll generated using Microsoft Visual
> C++. Are all DLLs made equal? Does the manufacturor need to generate a
> specific dll for Python?

In principle, if you can access the device from a C program, you can do  
the same thing with Python and ctypes. Mismatched C runtimes (between  
Python and the library) might be an issue in some cases, like sharing a  
FILE struct or allocating memory from one side and freeing it on the other  
side. But "sane" APIs (for some definition of sanity) should be usable  
without problems.

-- 
Gabriel Genellina

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


Re: Counter-spam: Change the subject

2007-12-26 Thread Carl K
Jan Claeys wrote:
> Op Tue, 11 Dec 2007 14:19:20 -0800, schreef Paul McGuire:
> 
>> My ISP's news server only works for me when I am connected locally, not
>> when I am travelling.

Same here, so I use:

sudo ssh -L119:newsgroups.comcast.net:119 [EMAIL PROTECTED]
[EMAIL PROTECTED]:~$ cat /etc/hosts
127.0.0.1   localhost
127.0.0.1   asus17.personnelware.comasus17
127.0.0.1   newsgroups.comcast.net

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


Re: How to detect when a user switches between windows (in WinXP)?

2007-12-26 Thread Tim Roberts
[EMAIL PROTECTED] wrote:
>
>I'm a beginning-to-intermediate Python programmer with some experience
>in other languages. At the moment I am trying to write a Python
>program that will run in the background and execute a series of
>commands whenever I switch between windows (my OS is Windows XP). For
>example, I want my program to do something when I switch to my Firefox
>browser, and then do something else when I switch to a certain sub-
>window in Photoshop (which has a certain title, and a certain photo
>associated with it), then do yet another thing when I switch to
>another sub-window (with a different title and photo) within
>Photoshop.
>The particular actions will be based on the window's title. I've
>already figured out how to retrieve that, using
>GetWindowText(GetForegroundWindow()) from the win32gui module.
>My question is, how can I detect when the user switches between
>windows? I haven't been able to figure that part out yet.
>Searching the group didn't give me any answers.

The way you do this is to write a Windows hook.  The WH_CBT hook intercepts
WM_ACTIVATE and WM_DEACTIVATE calls system-wide.

However, that requires injecting the hook DLL into every process with a
Windows, and you certainly don't want to do that in Python.  Write a
minimal C DLL to be the hook, and have it send messages to your Python
process.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting images from a PDF file

2007-12-26 Thread Carl K
Doug Farrell wrote:
> Hi all,
> 
> Does anyone know how to extract images from a PDF file? What I'm looking
> to do is use pdflib_py to open large PDF files on our Linux servers,
> then use PIL to verify image data. I want to do this in order
> to find corrupt images in the PDF files. If anyone could help
> me out, or point me in the right direction, it would be most
> appreciated!
> 

If you are ok shelling out to a binary:

pdfimages  -  Portable  Document  Format (PDF) image extractor (version
3.00)
http://packages.ubuntu.com/gutsy/text/xpdf-utils

I am trying to convert the pdf to a png, but without having to run external 
commands.  so I will understand if you arn't happy with pdfimages.

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


Re: standalone python web server

2007-12-26 Thread rishi pathak
See if this helps
www.*django*project.com


On 12/27/07, eric <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I want to setup simple python web server and I want it to just unzip
> and run, without any installation steps (have no right to do it).
>
> I've tried to write by myself, however, I find I am getting into more
> details like processing image file, different file type(like FLV) ..
> etc. Any recommendation or tools suggested for me?
>
> Thanks,
> Eric
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
Regards--
Rishi Pathak
-- 
http://mail.python.org/mailman/listinfo/python-list

standalone python web server

2007-12-26 Thread eric
Hi all,

I want to setup simple python web server and I want it to just unzip
and run, without any installation steps (have no right to do it).

I've tried to write by myself, however, I find I am getting into more
details like processing image file, different file type(like FLV) ..
etc. Any recommendation or tools suggested for me?

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


Re: Happy Christmas Pythoneers

2007-12-26 Thread [EMAIL PROTECTED]
On Dec 26, 9:43 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Wed, 26 Dec 2007 18:04:31 -0800, Zentrader wrote:
> >> Bah, humbug
>
> > And if you're not a Christian it would be Type Error bug.
>
> Not at all: if you inherit from any of the many pagan (that is, non-
> Christian) religions that celebrated midwinter festivals, or the old
> Roman Saturnalia festival that Christianity itself inherited Christmas
> from, you shouldn't raise an exception.
>
> Alternatively, you can delegate to any object that understands about
> holidays, parties, celebrations and gift-giving.
>
> > Anyway, happy New Years as well to all in the group.
>
> watch_fireworks()
> try:
>     champagne
> except NameError:
>     champagne = any_fizzy_alcoholic_drink_will_do()
> champagne.drink()
> shout("Happy New Years!!!")
> for person in adults_nearby:
>     if (person.is_appropriate_sex and person.is_pretty):

Hey, my version of the person module doesn't have
an is_appropriate_sex attribute, but an
is_opposite_sex attribute instead. Is this a new version?

>         kiss(person)
>     else:
>         shake(person.hand)
>
> --
> Steven

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


Re: Python DLL in Windows Folder

2007-12-26 Thread Tim Roberts
"Markus Gritsch" <[EMAIL PROTECTED]> wrote:
>
>Instead of being upset about cutting your word (which was not my
>intention, sorry about that), it would be nice if you could make a
>statement concerning the problem I mentioned: Having an object being
>created by one MSVC runtime, msvcr80.dll and passing it to another
>one, msvcr71.dll.

The C runtime doesn't create objects.  Python does use it to allocate
memory, but in the Microsoft run-times, malloc and free call the Win32 heap
APIs, no matter what the version.

It's true that mallocing in one CRT DLL and freeing in another can cause
problems, but in Python, I don't think that can happen.  Proper Python
add-ins call Python APIs to create and destroy objects, so only the Python
runtime will manage the memory.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Extracting images from a PDF file

2007-12-26 Thread Doug Farrell
Hi all,

Does anyone know how to extract images from a PDF file? What I'm looking
to do is use pdflib_py to open large PDF files on our Linux servers,
then use PIL to verify image data. I want to do this in order
to find corrupt images in the PDF files. If anyone could help
me out, or point me in the right direction, it would be most
appreciated!

Also, does anyone know of a way to validate a PDF file? 

Thanks in advance,
Doug
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Happy Christmas Pythoneers

2007-12-26 Thread Steven D'Aprano
On Wed, 26 Dec 2007 18:04:31 -0800, Zentrader wrote:


>> Bah, humbug
> 
> And if you're not a Christian it would be Type Error bug.


Not at all: if you inherit from any of the many pagan (that is, non-
Christian) religions that celebrated midwinter festivals, or the old 
Roman Saturnalia festival that Christianity itself inherited Christmas 
from, you shouldn't raise an exception.

Alternatively, you can delegate to any object that understands about 
holidays, parties, celebrations and gift-giving.


> Anyway, happy New Years as well to all in the group.


watch_fireworks()
try:
champagne
except NameError:
champagne = any_fizzy_alcoholic_drink_will_do()
champagne.drink()
shout("Happy New Years!!!")
for person in adults_nearby:
if (person.is_appropriate_sex and person.is_pretty):
kiss(person)
else:
shake(person.hand)



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


Subject changed: Bug in combining htmlentitydefs.py and ElementTree?

2007-12-26 Thread André
Sorry for the top posting - I found out that the problem I encountered
was not something new in Python 3.0.

Here's a test program:

import xml.etree.ElementTree
ElementTree = xml.etree.ElementTree
import htmlentitydefs
class XmlParser(ElementTree.ElementTree):
def __init__(self, file=None):
ElementTree.ElementTree.__init__(self)
parser = ElementTree.XMLTreeBuilder(
target=ElementTree.TreeBuilder(ElementTree.Element))
parser.entity = htmlentitydefs.entitydefs
self.parse(source=file, parser=parser)
return

f = open('test.html')
tree = XmlParser(f)
tree.write('test_out.html', encoding='utf-8')
==
This program should be run with the following test file (test.html):
=




test


Α


==
If run as such, it will print out the following:
--



test


Α


---
Notice how it is Α that appears instead of Α

This is the behaviour with both Python3.0 and 2.5.  (When I was
running with Python 2.5, I was always preprocessing the files with
BeautifulSoup, which removed many problems).

If I use "my_htmlentitiesdef.py" described in a previous message, I do
get an Alpha printed out (admittedly, not the character entity).

I would prefer to find a way to process such files and get Α
instead...  (or even, to process files with hard-coded characters e.g.
é instead of é and have them processed properly...).

unicode-challengedly-yrs,

André


On Dec 26, 9:14 pm, "André" <[EMAIL PROTECTED]> wrote:
> On Dec 26, 8:53 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
>
> > > Without an additional parser, I was getting the following error
> > > message:
> > [...]
> > > xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11
>
> > To understand that problem better, it would have been helpful to see
> > what line 401, column 11 of the input file actually says. AFAICT,
> > it must have been something like "&é;" which would be really puzzling
> > to have in an XML file (usually, people restrict themselves to ASCII
> > for entity names).
>
> No, that one was é   (testing with my own name that appeared in
> a file).
>
>
>
> > > for entity in ent:
> > > if entity not in parser.entity:
> > > parser.entity[entity] = ent[entity]
>
> > This looks fine to me.
>
> > > The output was "wrong".  For example, one of the test I used was to
> > > process a copy of the main dict of htmlentitydefs.py inside an html page. 
> > >  A
> > > few of the characters came ok, but I got things like:
>
> > > 'Α':0x0391, # greek capital letter alpha, U+0391
>
> > Why do you think this is wrong?
>
> Sorry, that was just cut-and-pasted from the browser (not the source);
> in the source of the processed html page, it is
> 'Α':0x0391, # greek capital letter alpha, U+0391
>
> i.e.  the "&" was transformed into "&" in a number of places (all
> places above ascii 127 I believe).
>
> Here are a few more lines extracted from the html file that was
> processed:
> =
> 'Â':0x00c2, # latin capital letter A with circumflex, U+00C2
> ISOlat1
> 'À':   0x00c0, # latin capital letter A with grave = latin capital
> letter A grave, U+00C0 ISOlat1
> 'Α':0x0391, # greek capital letter alpha, U+0391
> 'Å':0x00c5, # latin capital letter A with ring above = latin
> capital letter A ring, U+00C5 ISOlat1
> 'Ã':   0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1
> 'Ä': 0x00c4, # latin capital letter A with diaeresis, U+00C4
> ISOlat1
> 'Β': 0x0392, # greek capital letter beta, U+0392
> 'Ç':   0x00c7, # latin capital letter C with cedilla, U+00C7
> ISOlat1
> 'Χ':  0x03a7, # greek capital letter chi, U+03A7
> '‡':   0x2021, # double dagger, U+2021 ISOpub
> 'Δ':0x0394, # greek capital letter delta, U+0394
> ISOgrk3
>   
>
>
>
> > > When using my modified version, I got the following (which may not be
> > > transmitted properly by email...)
> > > 'Α':0x0391, # greek capital letter alpha, U+0391
>
> > > It does look like a Greek capital letter alpha here.
>
> > Sure, however, your first version ALSO has the Greek capital letter
> > alpha there; it is just spelled as Α (which *is* a valid spelling
> > for that latter in XML).
>
> Agreed that it would be... However that was not how it was
> transformed, see above; sorry if I was not clear about what was
> happening  (I should not have cut-and-pasted from the browser window).
>
>
>
> > > I hope the above is of some help.
>
> > Thanks; I now think that htmlentitydefs is just as fine as it always
> > was - I don't see any problem here.
>
> You may well be right in that the problem may lie elsewhere.  But as
> making the change I mentioned "fixed" the problem at my, I figured
> this was where the problem was located - and thought I should at least
> report it here.
>
> Regards,
> André
>
> > Regards,
> > Martin

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

EUROMEDIA 2008, April 9-11, 2008, FEUP-University of Porto, Portugal - 2nd Call for Papers

2007-12-26 Thread [EMAIL PROTECTED]
--

(Apologies for cross-posting)

EUROMEDIA 2008, APRIL 9-11, 2008, FEUP-UNIVERSITY OF PORTO, PORTUGAL
http://www.eurosis.org/cms/?q=taxonomy/term/100

We would appreciate if you could distribute this information by your
colleagues and co-workers.

--

 2ND Call for Papers
 EUROMEDIA 2008
  14TH ANNUAL MULTIMEDIA CONFERENCE

   WEBSITE
  http://www.eurosis.org/cms/?q=taxonomy/term/100
 UNIVERSITY OF PORTO
 PORTUGAL
 APRIL 9-11, 2008

Organized by
 ETI

Sponsored by
  EUROSIS
Delft University of Technology
  Belgacom
TTVI
  Ghent University
  DG-INFSO

Dear Colleague,

this is a reminder that the abstract submission deadline for EUROMEDIA
2008 is next January 20.

As a reminder also please find enclosed the list of the conference
topics:
[] WEBTEC
* Internet Viewers and Programs
* Visual Programming Languages
* 3D Web Programs
* Video and Audio Streaming on the Web
* AI on the Web
* Software for Web-based Business Applications

[] MEDIATEC
* Multimedia Techniques and Telecom
* Multimedia Authoring Tools and Software
* Multimedia Building Blocks

[] COMTEC
* Telecommunications Technologies
* Networks
* Network Security
* Mobile Communications
* TV Technology
* QoS

[] APTEC
* Telematics Consumer Applications
* Cooperative Consumer Application
* Tele-Education
* Integrated Enterprise Software and Groupware
* Telemedicine
* Ubiquitous Computing Applications
* Embedded Systems and Future Product Market Combinations
* Multimodal communication

[] ETEC
* Tele-X and E-Commerce
* Knowledge Management and E-Mobility

Special Tracks:

[] Knowledge Management and e-Mobility
[] In-Car Applications
[] Facial Recognition or Non Verbal Communication [] Virtual Reality
2.0 Applications

Special Workshops:

[] Medical Imaging Systems
In recent years, extensive research has been performed to develop more
and more efficient and powerful medical imaging systems. Such systems
are crucial for medical specialists, allowing a deeper analysis and to
understand what is going inside the human body, and therefore they
play an essential role for adequate medical diagnosis and treatments.
To accomplish efficient and powerful medical imaging systems, many
research works have being done in many domains, like the ones related
with medical image devices, signal processing, image processing and
analysis, biomechanical simulation and data visualization.
The main goal of the Workshop "Medical Imaging Systems" is to bring
together researchers involved in the related domains, in order to set
the major lines of development for the near future.
Therefore, the proposed Workshop will consist of researchers
representing various fields related to Medical Devices, Signal
Processing, Computational Vision, Computer Graphics, Computational
Mechanics, Scientific Visualization, Mathematics and Medical Imaging.
The Workshop endeavors to contribute to obtain better solutions for
more efficient and powerful medical imaging systems, and attempts to
establish a bridge between clinicians and researchers from these
diverse fields.

The proposed Workshop will cover topics related with medical imaging
systems, such as:
* image acquisition
* signal processing
* image processing and analysis
* modelling and simulation
* computer aided diagnosis
* surgery, therapy, and treatment
* computational bioimaging and visualization * software development *
virtual reality * telemedicine systems and their applications

[] D-TV
Scope:
In contrast to traditional TV DTV is a telecommunication system for
broadcasting and receiving moving pictures and sound by means of
digital signals. It uses digitally compressed modulation data, which
requires decoding by a specially designed television set or a standard
receiver (set-top box) as well as via PC-TV based on ADLS (VDSL).
Digital Television has several advantages regarding technically as
well as content and programme related aspects. One of the most
significant is the use of a smaller channel bandwidth.
This frees up space for more digital channels, other non-television
services such as pay-multimedia services and the generation of new
revenue models based on interactive advertisement and marketing
features. Furthermore there are special services such as multicasting
(more than one programme on the same channel), electronic programme
guides and in

Re: Happy Christmas Pythoneers

2007-12-26 Thread Zentrader
>
> Bah, humbug

And if you're not a Christian it would be Type Error bug.  Anyway,
happy New Years as well to all in the group.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing pydoc gui

2007-12-26 Thread TommW
JimG wrote:
> On Dec 26, 1:56 pm, Bernard Delmée <[EMAIL PROTECTED]>
> wrote:
>> (I know replying to self is a sure sign of aging :-)
>> A quick update: after installing the 'tkinter' fedora
>> package (still in live-cd mode), the following 3 lines
>> script does what "pydoc -g " should:
>>
>>  import Tkinter
>>  import pydoc
>>  pydoc.gui()
>>
>> HTH,
>>
>> Bernard.
> 
> Brilliant!  That's an easy solution to my problem.  I'll try posting
> to one of the Fedora forums to see if anyone there knows why.  I
> appreciate your help with this.  I love Linux but every now and then
> you run into one of its annoying little oddities


Jim:

I have a copy of Fedora 8 in a VMachine.  I found that I could get the 
Pydoc Server to start by doing the following.  I also found that I had 
to install tkinter first.  I then modified a copy of "pydoc" in usr/bin 
as follows:

#!/usr/bin env python2.5

import pydoc
if __name__ == '__main__':
 pydoc.gui()# Was pydoc.cli() in the original 
"pydoc"



I then named it "pydocgui", saved it to the desktop for now, then set it 
to open with Python in its document properties.

If I double click on this file, then select run from the dialog, the 
Pydoc Server opens.

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


Re: Python DLL in Windows Folder

2007-12-26 Thread Ross Ridge
Chris Mellon <[EMAIL PROTECTED]> wrote:
>Python (when installed with "for everyone") is not (just) an
>application, it's a runtime.

Whatever you want to call it, the Python DLL is not part of the operating
system, it's not a driver and doesn't belong in the system directory.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  [EMAIL PROTECTED]
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
On Dec 26, 8:53 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > Without an additional parser, I was getting the following error
> > message:
> [...]
> > xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11
>
> To understand that problem better, it would have been helpful to see
> what line 401, column 11 of the input file actually says. AFAICT,
> it must have been something like "&é;" which would be really puzzling
> to have in an XML file (usually, people restrict themselves to ASCII
> for entity names).


No, that one was é   (testing with my own name that appeared in
a file).


>
> > for entity in ent:
> > if entity not in parser.entity:
> > parser.entity[entity] = ent[entity]
>
> This looks fine to me.
>
> > The output was "wrong".  For example, one of the test I used was to
> > process a copy of the main dict of htmlentitydefs.py inside an html page.  A
> > few of the characters came ok, but I got things like:
>
> > 'Α':0x0391, # greek capital letter alpha, U+0391
>
> Why do you think this is wrong?

Sorry, that was just cut-and-pasted from the browser (not the source);
in the source of the processed html page, it is
'Α':0x0391, # greek capital letter alpha, U+0391

i.e.  the "&" was transformed into "&" in a number of places (all
places above ascii 127 I believe).


Here are a few more lines extracted from the html file that was
processed:
=
'Â':0x00c2, # latin capital letter A with circumflex, U+00C2
ISOlat1
'À':   0x00c0, # latin capital letter A with grave = latin capital
letter A grave, U+00C0 ISOlat1
'Α':0x0391, # greek capital letter alpha, U+0391
'Å':0x00c5, # latin capital letter A with ring above = latin
capital letter A ring, U+00C5 ISOlat1
'Ã':   0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1
'Ä': 0x00c4, # latin capital letter A with diaeresis, U+00C4
ISOlat1
'Β': 0x0392, # greek capital letter beta, U+0392
'Ç':   0x00c7, # latin capital letter C with cedilla, U+00C7
ISOlat1
'Χ':  0x03a7, # greek capital letter chi, U+03A7
'‡':   0x2021, # double dagger, U+2021 ISOpub
'Δ':0x0394, # greek capital letter delta, U+0394
ISOgrk3
  



>
> > When using my modified version, I got the following (which may not be
> > transmitted properly by email...)
> > 'Α':0x0391, # greek capital letter alpha, U+0391
>
> > It does look like a Greek capital letter alpha here.
>
> Sure, however, your first version ALSO has the Greek capital letter
> alpha there; it is just spelled as Α (which *is* a valid spelling
> for that latter in XML).

Agreed that it would be... However that was not how it was
transformed, see above; sorry if I was not clear about what was
happening  (I should not have cut-and-pasted from the browser window).

>
> > I hope the above is of some help.
>
> Thanks; I now think that htmlentitydefs is just as fine as it always
> was - I don't see any problem here.
>

You may well be right in that the problem may lie elsewhere.  But as
making the change I mentioned "fixed" the problem at my, I figured
this was where the problem was located - and thought I should at least
report it here.

Regards,
André

> Regards,
> Martin

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

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread Martin v. Löwis
> Without an additional parser, I was getting the following error
> message:
[...]
> xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11

To understand that problem better, it would have been helpful to see
what line 401, column 11 of the input file actually says. AFAICT,
it must have been something like "&é;" which would be really puzzling
to have in an XML file (usually, people restrict themselves to ASCII
for entity names).

> for entity in ent:
> if entity not in parser.entity:
> parser.entity[entity] = ent[entity]

This looks fine to me.

> The output was "wrong".  For example, one of the test I used was to
> process a copy of the main dict of htmlentitydefs.py inside an html page.  A
> few of the characters came ok, but I got things like:
> 
> 'Α':0x0391, # greek capital letter alpha, U+0391

Why do you think this is wrong?

> When using my modified version, I got the following (which may not be
> transmitted properly by email...)
> 'Α':0x0391, # greek capital letter alpha, U+0391
> 
> It does look like a Greek capital letter alpha here.

Sure, however, your first version ALSO has the Greek capital letter
alpha there; it is just spelled as Α (which *is* a valid spelling
for that latter in XML).

> I hope the above is of some help.

Thanks; I now think that htmlentitydefs is just as fine as it always
was - I don't see any problem here.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Counter-spam: Change the subject

2007-12-26 Thread Jan Claeys
Op Tue, 11 Dec 2007 14:19:20 -0800, schreef Paul McGuire:

> My ISP's news server only works for me when I am connected locally, not
> when I am travelling.

Gmane ?


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


Unsubscribe

2007-12-26 Thread Alihuen

- Original Message - 
From: "Peter Pei" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To: 
Sent: Wednesday, December 26, 2007 8:22 PM
Subject: Re: save gb-2312 web page in a .html file


> You must be right, since I tried one page and it worked. But there is
> something wrong with this particular page:
> http://overseas.btchina.net/?categoryid=-1. When I open the saved file 
> (with
> IE7), it is all messed up.
>
>url = 'http://overseas.btchina.net/?categoryid=-1'
>headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows
> NT)' }
>req = urllib2.Request(url, None, headers)
>page = urllib2.urlopen(req).read()
>
>htmlfile = open('btchina.html','w')
>htmlfile.write(page)
>htmlfile.close()
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.9/1197 - Release Date: 
> 25/12/2007 20:04
>
> 

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


Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
On Dec 26, 7:30 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> André wrote:
> > In trying to parse html files using ElementTree running under Python
> > 3.0a1, and using htmlentitydefs.py to add "character entities" to the
> > parser, I found that I needed to create a customized version of
> > htmlentitydefs.py to make things work properly.
>
> Can you please state what precise problem you were seeing? The original
> code looks fine to me as it stands.
>

As stated above, I was using ElementTree to parse an html file and
sending the output to a browser.
Without an additional parser, I was getting the following error
message:

Traceback (most recent call last):
File "/Users/andre/CrunchySVN/branches/andre/src/http_serve.py",
  line 79, in do_POST self.server.get_handler(realpath)(self)
File "src/plugins/handle_default.py",
  line 53, in handler data = path_to_filedata(request.path,
root_path)
File "src/plugins/handle_default.py",
  line 39, in path_to_filedata return cp.create_vlam_page(open(npath),
path).read()
File "/Users/andre/CrunchySVN/branches/andre/src/CrunchyPlugin.py",
  line 98, in create_vlam_page return vlam.CrunchyPage(filehandle,
url, remote=remote, local=local)
File "/Users/andre/CrunchySVN/branches/andre/src/vlam.py",
  line 62, in __init__ self.tree =
parse(filehandle)#XmlFile(filehandle)
File "/usr/local/py3k/lib/python3.0/xml/etree/ElementTree.py",
  line 823, in parse tree.parse(source, parser)
File "/usr/local/py3k/lib/python3.0/xml/etree/ElementTree.py",
  line 561, in parse parser.feed(data)
File "/usr/local/py3k/lib/python3.0/xml/etree/ElementTree.py",
  line 1201, in feed self._parser.Parse(data, 0)
File "/usr/local/py3k/lib/python3.0/xml/etree/ElementTree.py",
  line 1157, in _default self._parser.ErrorColumnNumber)
xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11

So, I tried to specify an additional parser via

if python_version >= 3:
import htmlentitydefs
class XmlFile(ElementTree.ElementTree):
def __init__(self, file=None):
ElementTree.ElementTree.__init__(self)
parser = ElementTree.XMLTreeBuilder(
target=ElementTree.TreeBuilder(ElementTree.Element))
ent = htmlentitydefs.entitydefs
for entity in ent:
if entity not in parser.entity:
parser.entity[entity] = ent[entity]
self.parse(source=file, parser=parser)
return

The output was "wrong".  For example, one of the test I used was to
process
a copy of the main dict of htmlentitydefs.py inside an html page.  A
few
of the characters came ok, but I got things like:

'Α':0x0391, # greek capital letter alpha, U+0391

When using my modified version, I got the following (which may not be
transmitted properly by email...)
'Α':0x0391, # greek capital letter alpha, U+0391

It does look like a Greek capital letter alpha here.


> > It does work for me ... but I don't know enough about unicode to be
> > sure that it is a proper bug, and not a quirk due to the way I wrote
> > my app.
>
> Without knowing what the actual problem is, it is hard to tell.

I hope the above is of some help.

Regards,

André


>
> Regards,
> Martin

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

Re: save gb-2312 web page in a .html file

2007-12-26 Thread Peter Pei
I "view sourced" the original web page in IE7, and it does specify:




So sounds like the encoding is gb2312...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Tkinter DLL conflicts on Windows

2007-12-26 Thread Martin v. Löwis
>  Any help in tracking down the source of this problem 
> would be appreciated.

You could try installing a debugger on machine H, hoping
that the debugger gets entered when pythonw crashes. The
stack trace may provide some insight on what precisely fails.

HTH,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big-endian binary data to/from Python ints?

2007-12-26 Thread Matt Nordhoff
William McBrine wrote:
> Here are a couple of functions that I feel stupid for having written. 
> They work, and they're pretty straightforward; it's just that I feel like 
> I must be missing an easier way to do this...
> 
> def net_to_int(numstring):
> """Convert a big-endian binary number, in the form of a string of
> arbitrary length, to a native int.
> """
> num = 0
> for i in numstring:
> num *= 256
> num += ord(i)
> return num
> 
> def int_to_net(num):
> """Convert a native int to a four-byte big-endian number, in the form
> of a string.
> """
> numstring = ''
> for i in xrange(4):
> numstring = chr(num % 256) + numstring
> num /= 256
> return numstring
> 
> The situation: I'm getting a four-byte packet from a socket that consists 
> of a big-endian 32-bit integer. (It specifies the length of the data that 
> follows.) I have to send the same thing in reply. send() and recv() work 
> with strings... I'm familiar with ntohl() and htonl(), but those expect/ 
> return integers.

The struct module should do it, but do you prefer your code or format
strings? :-P


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


Re: save gb-2312 web page in a .html file

2007-12-26 Thread Martin v. Löwis
> .read() returns the bytes exactly how it downloads them. It doesn't
> interpret them. If those bytes are GB-2312-encoded text, that's what
> they are. There's no need to reencode them. Just .write(page) (of
> course, this way you don't verify that it's correct).

Alternatively, if the page is *not* gb-2312, you must first *decode*
it from its original encoding. Suppose the original encoding is
windows-1252, you do

  page = page.decode("windows-1252")
  page = page.encode("gb-2312")

Of course, for HTML, that may be tricky, as the file may include
an encoding declaration (XML declaration or http-equiv header). So if
you recode it, you might have to change such declarations as well.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread Martin v. Löwis
André wrote:
> In trying to parse html files using ElementTree running under Python
> 3.0a1, and using htmlentitydefs.py to add "character entities" to the
> parser, I found that I needed to create a customized version of
> htmlentitydefs.py to make things work properly.

Can you please state what precise problem you were seeing? The original
code looks fine to me as it stands.

> It does work for me ... but I don't know enough about unicode to be
> sure that it is a proper bug, and not a quirk due to the way I wrote
> my app.

Without knowing what the actual problem is, it is hard to tell.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: save gb-2312 web page in a .html file

2007-12-26 Thread Matt Nordhoff
Peter Pei wrote:
> You must be right, since I tried one page and it worked. But there is 
> something wrong with this particular page: 
> http://overseas.btchina.net/?categoryid=-1. When I open the saved file (with 
> IE7), it is all messed up.
> 
> url = 'http://overseas.btchina.net/?categoryid=-1'
> headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 
> NT)' }
> req = urllib2.Request(url, None, headers)
> page = urllib2.urlopen(req).read()
> 
> htmlfile = open('btchina.html','w')
> htmlfile.write(page)
> htmlfile.close() 

I dunno. The file does specify its charset, so unless IE ignores that
and tries to guess and fails, it should work fine.
-- 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to generate html table from "table" data?

2007-12-26 Thread petr . jakes . tpc
Dennis,
Thank you very much for your code snippet.
I will try to install CherryTemplate and use it.

I did not work with any template tool before and I am not the *
class programmer as other people here, so my questions maybe look
"strange" or "stup..".

I didn't mean to offend somebody here and I am really grateful for all
replies.

Thank you

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


Big-endian binary data to/from Python ints?

2007-12-26 Thread William McBrine
Here are a couple of functions that I feel stupid for having written. 
They work, and they're pretty straightforward; it's just that I feel like 
I must be missing an easier way to do this...

def net_to_int(numstring):
"""Convert a big-endian binary number, in the form of a string of
arbitrary length, to a native int.
"""
num = 0
for i in numstring:
num *= 256
num += ord(i)
return num

def int_to_net(num):
"""Convert a native int to a four-byte big-endian number, in the form
of a string.
"""
numstring = ''
for i in xrange(4):
numstring = chr(num % 256) + numstring
num /= 256
return numstring

The situation: I'm getting a four-byte packet from a socket that consists 
of a big-endian 32-bit integer. (It specifies the length of the data that 
follows.) I have to send the same thing in reply. send() and recv() work 
with strings... I'm familiar with ntohl() and htonl(), but those expect/ 
return integers.

-- 
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 -- pass it on
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python DLL in Windows Folder

2007-12-26 Thread Martin v. Löwis
> Indeed, pywin32 stops working :(  I installed Python "just for me",
> then I installed pywin32-210, and now Pythonwin.exe is not able to
> start.  So for this scenario it seems to be necessary, that the Python
> DLL is installed into the system32 folder.
> 
> Maybe the Python installer should issue a warning that pywin32 will
> not be able to work when using the option "just for me"?

That is not supposed to happen; pywin32 should work. Just COM servers
written in Python may not.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: save gb-2312 web page in a .html file

2007-12-26 Thread Peter Pei
You must be right, since I tried one page and it worked. But there is 
something wrong with this particular page: 
http://overseas.btchina.net/?categoryid=-1. When I open the saved file (with 
IE7), it is all messed up.

url = 'http://overseas.btchina.net/?categoryid=-1'
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 
NT)' }
req = urllib2.Request(url, None, headers)
page = urllib2.urlopen(req).read()

htmlfile = open('btchina.html','w')
htmlfile.write(page)
htmlfile.close() 

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


Re: Read file, and append?

2007-12-26 Thread John Machin
On Dec 27, 9:04 am, Gilles Ganault <[EMAIL PROTECTED]> wrote:
> On Tue, 25 Dec 2007 13:27:09 -0800, Dennis Lee Bieber
>
> <[EMAIL PROTECTED]> wrote:
> >Ignoring the question of the proper I/O mode, I believe the I/O
> >system MAY require one to perform a seek() when switching from read to
> >write and vice versa...
>
> I thought about this, but I don't understand why I would need to do
> this:
>
> myfile=open('test.txt','r+')
> content = myfile.read()
> myfile.seek()

The above would not execute; seek needs at least one argument.
"Perform a seek()" was an abbreviated way of telling you to seek to
the position at which you want to write i.e. (current) end of file so
you would use seek(0, 2).

"Why": already explained; some stdio implementations require it.

> myfile.write('added this')
> myfile.close
>
> Is there really no way to read from a file and append data to it while
> keeping the file open?
>
> Also, I noticed a problem with the code given by Garry: When opening a
> file in binary mode, the EOF character is 0A, while Windows apps
> expect 0D0A. VisualBasic was not happy :-)

I'm sorry, but your statement of the alleged problem doesn't make much
sense. Possibly you mean EOL (end of line), not EOF (end of file). In
any case, when opening a file in binary mode, lines (and end-of-line
conventions) are quite irrelevant -- you use a_string = f.read(nbytes)
to read (or f.write(a_string) to write) as many bytes as you think you
need, starting at the current position in the file.

Perhaps if you provided more precise information than "VisualBasic was
not happy", like: the exact code that you ran, and the exact [hint:
use the repr() function] contents of the two input files and the
output file, plus what you expected the contents of the output file to
be, plus whatever VB had to say about the output file, we might be
able to help you with the problem.

Cheers,
John

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


Re: save gb-2312 web page in a .html file

2007-12-26 Thread Matt Nordhoff
Peter Pei wrote:
> I am trying to read a web page and save it in a .html file. The problem is 
> that the web page is GB-2312 encoded, and I want to save it to the file with 
> the same encoding or unicode. I have some code like this:
> url = 'http://blah/'
> headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 
> NT)' }
> 
> req = urllib2.Request(url, None, headers)
> page = urllib2.urlopen(req).read()
> 
> file = open('btchina.html','wb')
> file.write(page.encode('gb-2312'))
> file.close()
> 
> It is obviously not working, and I am hoping someone can help me.

.read() returns the bytes exactly how it downloads them. It doesn't
interpret them. If those bytes are GB-2312-encoded text, that's what
they are. There's no need to reencode them. Just .write(page) (of
course, this way you don't verify that it's correct).

(BTW, don't use 'file' as a variable name. It's an alias of the 'open()'
function.)
-- 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance on local constants?

2007-12-26 Thread William McBrine
Thanks for all the answers on this. (And, sorry the lousy Subject line; I 
couldn't think of a better one.)

-- 
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 -- pass it on
-- 
http://mail.python.org/mailman/listinfo/python-list


save gb-2312 web page in a .html file

2007-12-26 Thread Peter Pei
I am trying to read a web page and save it in a .html file. The problem is 
that the web page is GB-2312 encoded, and I want to save it to the file with 
the same encoding or unicode. I have some code like this:
url = 'http://blah/'
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 
NT)' }

req = urllib2.Request(url, None, headers)
page = urllib2.urlopen(req).read()

file = open('btchina.html','wb')
file.write(page.encode('gb-2312'))
file.close()

It is obviously not working, and I am hoping someone can help me.

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


Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
In trying to parse html files using ElementTree running under Python
3.0a1, and using htmlentitydefs.py to add "character entities" to the
parser, I found that I needed to create a customized version of
htmlentitydefs.py to make things work properly.

The change needed was to replace (at the bottom of the file)

for (name, codepoint) in name2codepoint.items():
codepoint2name[codepoint] = name
if codepoint <= 0xff:
entitydefs[name] = chr(codepoint)
else:
entitydefs[name] = '&#%d;' % codepoint

by

for (name, codepoint) in name2codepoint.items():
codepoint2name[codepoint] = name
entitydefs[name] = chr(codepoint)


It does work for me ... but I don't know enough about unicode to be
sure that it is a proper bug, and not a quirk due to the way I wrote
my app.  So, I thought it would be appropriate to post it here so that
unicode experts could determine if it was indeed a bug - and file a
bug report/write a patch.   The same code is present in Python 3.0a2 -
but I have not tested it under this new version.

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


Re: convert pdf to png

2007-12-26 Thread Piet van Oostrum
> Carl K <[EMAIL PROTECTED]> (CK) wrote:

>CK> Here is what the code looks like that generates the pdf:

>CK> buffer = StringIO()
>CK> rw = dReportWriter(OutputFile=buffer, ReportFormFile=xmlfile, 
>Cursor=ds)
>CK> rw.write()
>CK> pdf = buffer.getvalue()
>CK> return pdf

You can pipe the pdf through ghostscript and read the png back from
ghostscript's stdout. Like:

gs -q -sDEVICE=png16m -sOutputFile=- - 

Use that command in subprocess with the  stdin/stdout as pipes, send
your PDF data to the process and read the PNG output back.

However you must be aware that this can deadlock if the output is large
enough. So putting the input or the output in a real file is probably safer
anyway.

-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: state of XSLT2/XPath2 or XQuery in CPython

2007-12-26 Thread Christof Hoeke
Stefan Behnel wrote:
> Christof Hoeke wrote:
>> I was wondering if there is any way to use XSLT2 or maybe even XQuery
>> with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I
>> have not tried Saxon.NET with IronPython but suspect no problem?) but I
>> could not find any way to use XSLT2 or XPath Features with CPython. All
>> the usual suspects 4suite or libxslt (via lxml) seem to have no support
>> yet. Is there any hope I oversaw something?
> 
> I wouldn't know any implementation. Are you looking for a specific feature?
> Using Python functions in XPath/XSLT might get you pretty close to XPath2.

Almost full XSLT2 Support (minus XML Schema support, IMHO not too useful 
part of XSLT2) would be the best as writing templates in a general 
templating lang as XSLT is great if you use the same ones in cross-lang 
systems which are e.g. usable in Java or Python environment.

Especially XPath Support with temporary trees (and not just fragments) 
is very useful (I know EXSLT is an option, but still not quite as good 
as XSLT2). Or stuff like sequences in XPAth2 simplifies development 
quite a bit (I think the following is possible, have not used it in the 
last weeks though):
(a, b, c)[EMAIL PROTECTED]'123']

Or using sequences for ordering stuff like e.g.:

in XSLT1:



which in XSLT2 simply is:


I used the Python extension functions some years ago in Pyana and later 
in LXML which is great but these naturally very much depend on Python 
then...

I know XML and therefor also XSLT seem not the most favourite of tools 
in the Python community but for e.g. document based systems like CMS 
systems XML and XSLT is at least in my experience a great combination.

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


Re: [newbie] Read file, and append?

2007-12-26 Thread Gilles Ganault
On Tue, 25 Dec 2007 13:27:09 -0800, Dennis Lee Bieber
<[EMAIL PROTECTED]> wrote:
>Ignoring the question of the proper I/O mode, I believe the I/O
>system MAY require one to perform a seek() when switching from read to
>write and vice versa...

I thought about this, but I don't understand why I would need to do
this:

myfile=open('test.txt','r+')
content = myfile.read()
myfile.seek()
myfile.write('added this')
myfile.close

Is there really no way to read from a file and append data to it while
keeping the file open?

Also, I noticed a problem with the code given by Garry: When opening a
file in binary mode, the EOF character is 0A, while Windows apps
expect 0D0A. VisualBasic was not happy :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python DLL in Windows Folder

2007-12-26 Thread Lie
On Dec 27, 12:30 am, "Markus Gritsch" <[EMAIL PROTECTED]> wrote:
> On 26/12/2007, Lie Ryan <[EMAIL PROTECTED]> wrote:
> > > On Dec 25, 2007 4:43 PM, Markus Gritsch <[EMAIL PROTECTED]> wrote:
> > > On 24/12/2007, Lie <[EMAIL PROTECTED]> wrote:
>
> > > > (good programs are not DLL implementation specific
>
> > > Assume an application embedding Python being compiled with MSVC 8.0.
> > > It uses the runtime msvcr80.dll.  If you now pass objects created in
> > > your application to the Python interpreter which is compiled with MSVC
> > > 7.1 which uses msvcr71.dll, you are asking for serious trouble.  It is
> > > not a matter of being a "good program".
>
> > don't cut my word, good programs aren't DLL implementation specific and good
> > DLL have consistent interface (consistent interface implies consistent
> > behavior). Of course this is a bit "utopia", as most DLL would sadly have to
> > change its interfaces once or twice and it is sometimes impossible for
> > programs to be completely free from its DLLs implementation
>
> Instead of being upset about cutting your word (which was not my
> intention, sorry about that), it would be nice if you could make a
> statement concerning the problem I mentioned: Having an object being
> created by one MSVC runtime, msvcr80.dll and passing it to another
> one, msvcr71.dll.

I'm not upset, but if my wording seems to be like an upset person I'm
sorry, English is not my first language, and I'm very bad at choosing
words.

A simple solution (but possibly inefficient, if the object is complex
and need to be exchanged thousands of times) for the problem mentioned
is to convert the object to a common agreed format that both sides can
understand when transferring the data such as a simple string (not a
string object, just simple string with no strings attached: pun (not)
intended).

In your case, which is:
> Assume an application embedding Python being compiled with MSVC 8.0.
> It uses the runtime msvcr80.dll.  If you now pass objects created in
> your application to the Python interpreter which is compiled with MSVC
> 7.1 which uses msvcr71.dll, you are asking for serious trouble.  It is
> not a matter of being a "good program".

No, you're not asking for trouble, you're passing the object to the
Python DLL, not to the msvcr71 behind the Python so it shouldn't be a
problem in a good designed program and DLL. This isn't a case about
msvcr71 talking with msvcr8, nor it is msvcr71 with your program, nor
it is msvcr8 with Python DLL, this is a case of Your Program talking
to Python DLL.

One way to solve this is:
Assuming you don't have access to Python internals (although since
Python is open source, you do have access) you could build a wrapper
around Python Interpreter. The wrapper has two functions. One: accepts
a string input (string as simple string, not string object) that
describes the original object and returns a file that Python can pick
with pickle. Two: accepts a pickled object and returns a string that
describes the pickled object that Your Application could understand.

This functions could be built in into Your Application, but the
easiest way is to build the wrapper with Python, as you won't need to
know how to read and write pickled file.

For a simple case, where the object that needs to be passed is
predetermined your function could just pass any data that is required
to reconstruct the original object to the wrapper (for example, in a
vector class, just the values of x, y, z), a versatile way to pass
them is by command-line arguments, like "wrapper 1 2 3 > output". The
wrapper would add any other required infos (methods, operator
overloads, etc) before pickling the object and call the Python DLL to
unpickle the object. For the vice versa case, the wrapper unpickle the
file returned from Python DLL, and convert it to a format Your Program
could understand, then notifying your program.

Of course there may be other easier, more efficient ways to solve this
problem, but this is a proof-of-concept that it is possible to compile
your application in VS8 while still using the official VS
Python.

But I can't think of a need why Python DLL needs to be used like this
though

> > > > If that's the case, just use the MSVC 7.1's compiled code, there won't
> > > > be much difference.
>
> > > See above.
>
> > I think you don't get my point... if you don't modify the python interpreter
> > (from what I understand, you just recompile your Python DLL without
> > modification), there is no need to compile your own interpreter, it just
> > makes problem and the performance benefits is outweighed by the problems of
> > having to use 3rd party Python DLL (even if you don't modify the code and
> > just recompile it, it is not the official release, thus 3rd party).
>
> I do get your point, but your point is maintaining compatibility
> between two different *versions* of a DLL/Program.  I am talking about
> having a DLL/Program combination which uses different MSVC runtimes.

It doe

Re: how to generate html table from "table" data?

2007-12-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit :
 > Vasudev Ram wrote:
>>Why not try writing your own code for this first?
>>If nothing else, it'll help you learn more, and may also help you
>>understand better, the other options.
>> 
> 
> Thanks for your reply even it was not really helpful.

The answers boil down to:
- use the templating engine that comes with your web framework
or
- use whatever templating engine you like
or
- just do it by hand

The remaining work is obviously such a no-brainer that there's no need 
for a specific package, and so application specific that there's 
probably nothing like a one-size-fits-all answer. IOW : you're not 
likely to find more "helpful" answer - and your above comment won't 
help. FWIW, I just wrote a function generating an html table from a list 
of header and a list of rows. I wrote the most Q&D, straightforward, 
braindead way, it's 17 lines long, doesn't even need an import 
statement, and took me less than 2 minutes to write - that is, far less 
work than reading your post and answering it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Tkinter DLL conflicts on Windows

2007-12-26 Thread kyosohma
On Dec 26, 1:03 pm, "Russell Blau" <[EMAIL PROTECTED]> wrote:
> I have some Tkinter programs that I run on two different machines.  On
> Machine W, which runs Python 2.5.1 on Windows XP, these programs run fine.
> On Machine H, which runs Python 2.5.1 on Windows XP, however, the same
> programs crash regularly.  The crashes are not Python exceptions, but rather
> are reported by Windows as errors in pythonw.exe.  (Of course, the error
> messages themselves contain absolutely no useful information.)  This happens
> whether I run them from the command prompt or from IDLE (although IDLE
> itself never crashes).  Further, the crashes occur at unpredictable times;
> sometimes the program will crash almost immediately upon startup, while at
> other times it will run for a while and then crash.
>
> Also, I'm not sure whether this has anything to do with my problem, but
> Machine H also has Python 2.2 installed on it, while Machine W does not.
>
> I recall seeing a message at some point that suggested that conflicts in the
> MS VC runtime DLLs might cause this sort of problem, but I haven't been able
> to find that information through a search, so I'm not sure which particular
> DLLs to look for.  Any help in tracking down the source of this problem
> would be appreciated.
>
> Russ

Hi,

In the programs I write and package, I usually distribute msvcp71.dll
and MSVCR71.dll. I include them in the directory that the Python exe
I've created is running from. However, it sounds like you are running
pure code, not something packaged with py2exe.

You might run sfc and see if your dlls are ok. See 
http://support.microsoft.com/kb/310747

A friend of mine swears by this: http://wiki.djlizard.net/Dial-a-fix

Of course, it might be as simple as just uninstalling and reinstalling
Python.

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


Re: CPython and a C extension using Boehm GC

2007-12-26 Thread MrJean1
FWIIW, I built GC 6.7 on a RHEL 3 (Opteron) system using

  ./configure --prefix=... --enable-redirect-malloc --enable-
threads=posix --enable-thread-local-alloc
  make; make check; make install

Then, I tried running a few examples with 3 different, existing Python
binaries each pre-loaded with the libgc.so library

  env  LD_PRELOAD=.../libgc.so   

One is Python 2.2.3 included in RHEL 3, one is a Python 2.5.1 build
and is a Python 3.0a2 build, all 64-bit.  All seemed to work OK.

These are 3 existing Python binaries without any call to GC_INIT().
AFAICT, on Linux, GC_INIT is a no-op anyway.

/Jean Brouwers


On Dec 26, 7:14 am, MrJean1 <[EMAIL PROTECTED]> wrote:
> It depends on how the GC inside the extension is built.  If it is a
> drop-in replacement for malloc, then GC *must* be loaded and
> initialized upfront if possible.  There is no need to memcpy anything
> between Python and the extension.
>
> However, if GC does not replace malloc, etc., then GC-ed memory is
> only used within the extension.  GC_INIT can be called when the
> extension is loaded and memcpy-ing between Python and the extension is
> mandatory.
>
> There are other details to consider.  For example, on some platforms,
> GC *must* be initialized from the main executable.  That may preclude
> both scenarios, altogether.
>
> /Jean Brouwers
>
> On Dec 25, 7:35 pm, Andrew MacIntyre <[EMAIL PROTECTED]>
> wrote:
>
> > malkarouri wrote:
> > > Is it possible to write a Python extension that uses the Boehm garbage
> > > collector?
> > > I have a C library written that makes use ofboehm-gcfor memory
> > > management. To use that, I have to call GC_INIT() at the start of the
> > > program that uses the library. Now I want to encapsulate the library
> > > as a CPython extension. The question is really is that possible? And
> > > will there be conflicts between theboehm-gcand Python memory
> > > management? And when should I call GC_INIT?
>
> > It probably should be possible with some caveats:
> > - memory allocated by Python is never passed into the library such that
> >    it also ends up being subject toboehm-gc;
> > - memory allocated by the library is never used by Python objects.
>
> > So memcpy()ing between library allocated and Python allocated memory
> > would seem to be a way to achieve this.
>
> > I would call GC_INIT in the extension's import routine
> > (init()) for a C extension, and immediately after loading
> > the library if using ctypes.
>
> > --
> > -
> > Andrew I MacIntyre                     "These thoughts are mine alone..."
> > E-mail: [EMAIL PROTECTED]  (pref) | Snail: PO Box 370
> >         [EMAIL PROTECTED]             (alt) |        Belconnen ACT 2616
> > Web:    http://www.andymac.org/             |        Australia

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


Re: state of XSLT2/XPath2 or XQuery in CPython

2007-12-26 Thread Stefan Behnel
Christof Hoeke wrote:
> I was wondering if there is any way to use XSLT2 or maybe even XQuery
> with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I
> have not tried Saxon.NET with IronPython but suspect no problem?) but I
> could not find any way to use XSLT2 or XPath Features with CPython. All
> the usual suspects 4suite or libxslt (via lxml) seem to have no support
> yet. Is there any hope I oversaw something?

I wouldn't know any implementation. Are you looking for a specific feature?
Using Python functions in XPath/XSLT might get you pretty close to XPath2.

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


Re: missing pydoc gui

2007-12-26 Thread JimG
On Dec 26, 1:56 pm, Bernard Delmée <[EMAIL PROTECTED]>
wrote:
> (I know replying to self is a sure sign of aging :-)
> A quick update: after installing the 'tkinter' fedora
> package (still in live-cd mode), the following 3 lines
> script does what "pydoc -g " should:
>
>  import Tkinter
>  import pydoc
>  pydoc.gui()
>
> HTH,
>
> Bernard.

Brilliant!  That's an easy solution to my problem.  I'll try posting
to one of the Fedora forums to see if anyone there knows why.  I
appreciate your help with this.  I love Linux but every now and then
you run into one of its annoying little oddities
-- 
http://mail.python.org/mailman/listinfo/python-list


Python/Tkinter DLL conflicts on Windows

2007-12-26 Thread Russell Blau
I have some Tkinter programs that I run on two different machines.  On 
Machine W, which runs Python 2.5.1 on Windows XP, these programs run fine. 
On Machine H, which runs Python 2.5.1 on Windows XP, however, the same 
programs crash regularly.  The crashes are not Python exceptions, but rather 
are reported by Windows as errors in pythonw.exe.  (Of course, the error 
messages themselves contain absolutely no useful information.)  This happens 
whether I run them from the command prompt or from IDLE (although IDLE 
itself never crashes).  Further, the crashes occur at unpredictable times; 
sometimes the program will crash almost immediately upon startup, while at 
other times it will run for a while and then crash.

Also, I'm not sure whether this has anything to do with my problem, but 
Machine H also has Python 2.2 installed on it, while Machine W does not.

I recall seeing a message at some point that suggested that conflicts in the 
MS VC runtime DLLs might cause this sort of problem, but I haven't been able 
to find that information through a search, so I'm not sure which particular 
DLLs to look for.  Any help in tracking down the source of this problem 
would be appreciated.

Russ



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


Re: missing pydoc gui

2007-12-26 Thread Bernard Delmée
(I know replying to self is a sure sign of aging :-)
A quick update: after installing the 'tkinter' fedora
package (still in live-cd mode), the following 3 lines
script does what "pydoc -g " should:

 import Tkinter
 import pydoc
 pydoc.gui()

HTH,

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


Re: missing pydoc gui

2007-12-26 Thread Bernard Delmée
I see what you mean, having started my fedora8-live image under
virtualbox. -g support is apparently not there with this
distribution, oddly enough. Perhaps you should post your
question on a fedora support forum.

Under the live cd (hence probably with a smaller selection of
available packages than you have), if I try the following
at the interactive python prompt, I am getting "No module named
Tkinter"

 import pydoc
 pydoc.gui()


You probably discovered this already, but you can at least
launch "pydoc -p 1234" and view the python doc by pointing
your browser to localhost:1234. The small tkinter gui normally
invoked by "-g" would add a handy search box to this viewer...

The main python doc page points to the following search link:
http://starship.python.net/crew/theller/pyhelp.cgi
which looks similar enough to what "pydoc -g" would offer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to generate html table from "table" data?

2007-12-26 Thread petr . jakes . tpc
>
> Why not try writing your own code for this first?
> If nothing else, it'll help you learn more, and may also help you
> understand better, the other options.
>
> Vasudev Ram

Thanks for your reply even it was not really helpful.
Of course some attempts to generate html from tabular data are behind
me. I am trying to find help here, because I think I am not the first
one, who is trying to "generate" html tables.

The purpose of my effort is to automatically and repeatedly read ŚQL
table and save the output of the SQL SELECT to the file in the html
format. Such a "reports" can be read by user using web browser later
on.

I was just trying to find if somebody here can point me to the
existing tool, which is suitable for such a task.

Anyway thank you for trying me help.

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


Re: convert pdf to png

2007-12-26 Thread Carl K
Grant Edwards wrote:
> On 2007-12-25, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>> Carl K schrieb:
>>> Grant Edwards wrote:
 On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote:

>> If it is a multi page pdf Imagemagick will do:
>>
>> convert file.pdf page-%03d.png
> I need python code to do this.  It is going to be run on a
> someone else's shared host web server, security and
> performance is an issue.  So I would rather not run stuff via
> popen.
 Use subprocess.

 Trying to eliminate popen because of the overhead when running
 ghostscript to render PDF (I assume convert uses gs?) is about
 like trimming an elephants toenails to save weight.
>>> maybe, but I wouldn't be so sure.
>>>
>>> currently the pdf is created in a python StringIO buffer and returned to 
>>> the browser;  so it never becomes a file.  using convert means I have to 
>>> first save it as a file, convert from file to file, read the file, 
>>> delete the 2 files. so 6 file operations where before there were none.  
>>> That may be more of a load than the ghostscript part.
>> So what? I'm not sure about current HD speeds, but a couple of years ago 
>> these were about 30MByte/s - and should be faster today. Which equals 
>> 240MBit/s, much more than your user's internet connection. and this is 
>> raw IO speed, not counting disk caches.
> 
> Unless the file is really huge (or the server is overloaded),

The server is already overloaded,

> the bytes will probably never even hit a platter.  If you're
> using any even remotely modern OS, short-lived tempfiles used
> as you desdcribe are basically just memory-buffers with a
> filesystem API.

Good point.  Not that I am willing to risk it (just using the pdf is not such a 
bad option)  but I am wondering if it would make sense to create a ramdrive for 
something like this.  if memory is needed, swap would happen, which should be 
better than creating files.

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


Re: Writing Oracle Output to a File

2007-12-26 Thread t_rectenwald
On Dec 26, 12:10 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> On Dec 26, 12:06 pm, Paul Hankin <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Dec 26, 4:51 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 26, 10:36 am, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I attempting to execute an Oracle query, and write the results to a
> > > > file in CSV format.  To do so, I've done the following:
>
> > > > import cx_Oracle
> > > > db = cx_Oracle.connect('user/[EMAIL PROTECTED]')
> > > > cursor = db.cursor()
> > > > cursor.arraysize = 500
> > > > cursor.execute(sql)
> > > > result = cursor.fetchall()
>
> > > > The above works great.  I'm able to connect to the database and print
> > > > out the results as a list of tuples.  Here is where I get lost.  How
> > > > do I work with a "list of tuples?"  My understanding is that a "list"
> > > > is basically an array (I don't come from a Python background).  Tuples
> > > > are a "collection of objects."  So, if I do...
>
> > > > print result[0]
>
> > > > I get the first row of the query, which would make sense.  The problem
> > > > is that I cannot seem to write tuples to a file.  I then do this...
>
> > > > csvFile = open("output.csv", "w")
> > > > csvFile = write(result[0])
> > > > csvFile.close
>
> > > > This generates an exception:
>
> > > > TypeError: argument 1 must be string or read-only character buffer,
> > > > not tuple
>
> > > > So, I'm a bit confused as to the best way to do this.  I guess I could
> > > > try to convert the tuples into strings, but am not sure if that is the
> > > > proper way to go.  Any help would be appreciated.  I've also seen a
> > > > csv module out there, but am not sure if that is needed in this
> > > > situation.
>
> > > > Best Regards,
> > > > Tom
>
> > > Hello,
>
> > > I was able to figure this out by using join to convert the tuples into
> > > strings, and then have those write to the filehandle:
>
> > > csvFile = open("output.csv", "w")
> > > for row in cursor.fetchall():
> > >     csvFile.write(','.join(row) + "\n")
> > > csvFile.close
>
> > As usual, the python standard library has functions that do what you
> > want! Using the csv module will help you avoid trouble when your data
> > contains commas or control characters such as newlines.
>
> > import csv
> > help(csv)
>
> > Suggests this code:
> > import csv
> > csv_file = open('output.csv', 'w')
> > csv_writer = csv.writer(csvFile)
> > csv_writer.writerows(cursor.fetchall())
> > csv_file.close()
>
> > --
> > Paul Hankin- Hide quoted text -
>
> > - Show quoted text -
>
> Thanks for the tip.  I'll read up on the csv module and use that
> instead.  I'm already running into errors with null values, etc... and
> I believe some of the data in this DB will have commas, so this will
> be a much cleaner way of doing things.
>
> Regards,
> Tom- Hide quoted text -
>
> - Show quoted text -

I read up on the csv module.  BTW, thanks again!  That took care of
null values, I didn't even have to iterate anything in a loop, or
convert the tuples.  Great stuff.  I'm loving Python.

Regards,
Tom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting old "shelve" databases to gdbm

2007-12-26 Thread RayOsborn
On Dec 24, 10:01 pm, Istvan Albert <[EMAIL PROTECTED]> wrote:
> On Dec 24, 7:38 pm, [EMAIL PROTECTED] wrote:
>
> > Any tips welcome.
>
> pickling has a text protocol that should be compatible across python
> versions. Pickle  each of your database entries to a different file,
> then read them in the newer version of the script.
>
> i.

Thanks for the suggestion.  I had forgotten that pickle by default has
an ASCII format - I've now written a couple of scripts, first in
Python 2.2 and then in the current default version to do the
translation.  A bit tedious, but it works.


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


Re: list in a tuple

2007-12-26 Thread Arnaud Delobelle
On Dec 26, 1:08 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Mon, 24 Dec 2007 18:01:53 -0800, Raymond Hettinger wrote:
[...]
> > The first succeeds and the second fails.
>
> And this is a good idea?
>
> Shouldn't the tuple assignment raise the exception BEFORE calling
> __iadd__ on the item, instead of after?

If you look at the bytecode generated, this doesn't seem possible:

>>> def f():
... a = ([1],)
... a[0] += [2]
...
>>> import dis
>>> dis.dis(f)
  2   0 LOAD_CONST   1 (1)
  3 BUILD_LIST   1
  6 BUILD_TUPLE  1
  9 STORE_FAST   0 (a)

  3  12 LOAD_FAST0 (a)
 15 LOAD_CONST   2 (0)
 18 DUP_TOPX 2
 21 BINARY_SUBSCR
 22 LOAD_CONST   3 (2)
 25 BUILD_LIST   1
 28 INPLACE_ADD
 29 ROT_THREE
 30 STORE_SUBSCR
 31 LOAD_CONST   0 (None)
 34 RETURN_VALUE

BINARY_SUBSCR puts a[0] on the stack, it has no way to know that a[0]
will be changed in place.  To allow an exception to be thrown before
the in-place modification of a[0], there should be a new bytecode
instruction, say BINARY_SUBSCR_WITH_A_VIEW_TO_CHANGE_IN_PLACE, which
checks that the subscriptable object supports STORE_SUBSCR (;-).

[...]

> I was never a big fan of augmented assignments. I think it goes against
> the Python grain: it's an implied operation, using punctuation, for the
> sole (?) benefit of saving a keystroke or three.
>
> But I think this behaviour counts as a wart on the language, rather than
> a bug.

Yes.  I didn't realise this before you mentioned it, but the culprit
here seems to be the augmented assignment which acts differently on
mutable and immutable objects:

b = a  # say a is immutable
a += c # equivalent to a = a + c
b is a # -> False

b = a  # Now say a is mutable
a += c # equivalent to a.__iadd__(c)
b is a # -> True

OTOH augmented assignent are a slight optimisation:

a[i] += 1

will look for the value of a and i only once and duplicate them on the
stack, whereas

a[i] = a[i] + 1

will need to resolve a and i twice (which can be costly if a and i are
globals)

--
Arnaud

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


Re: Happy Christmas Pythoneers

2007-12-26 Thread Aahz
In article <[EMAIL PROTECTED]>,
Paddy  <[EMAIL PROTECTED]> wrote:
>
>After quite enjoying participating in the group in 2007, I'd like to
>wish you all a Merry Xmas.

Bah, humbug
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"Typing is cheap.  Thinking is expensive."  --Roy Smith
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python DLL in Windows Folder

2007-12-26 Thread Markus Gritsch
On 26/12/2007, Lie Ryan <[EMAIL PROTECTED]> wrote:
>
>
> On Dec 25, 2007 4:43 PM, Markus Gritsch <[EMAIL PROTECTED]> wrote:
> > On 24/12/2007, Lie <[EMAIL PROTECTED]> wrote:
> > >
> > > (good programs are not DLL implementation specific
> >
> > Assume an application embedding Python being compiled with MSVC 8.0.
> > It uses the runtime msvcr80.dll.  If you now pass objects created in
> > your application to the Python interpreter which is compiled with MSVC
> > 7.1 which uses msvcr71.dll, you are asking for serious trouble.  It is
> > not a matter of being a "good program".
>
> don't cut my word, good programs aren't DLL implementation specific and good
> DLL have consistent interface (consistent interface implies consistent
> behavior). Of course this is a bit "utopia", as most DLL would sadly have to
> change its interfaces once or twice and it is sometimes impossible for
> programs to be completely free from its DLLs implementation

Instead of being upset about cutting your word (which was not my
intention, sorry about that), it would be nice if you could make a
statement concerning the problem I mentioned: Having an object being
created by one MSVC runtime, msvcr80.dll and passing it to another
one, msvcr71.dll.

> > > If that's the case, just use the MSVC 7.1's compiled code, there won't
> > > be much difference.
> >
> > See above.
> >
>
> I think you don't get my point... if you don't modify the python interpreter
> (from what I understand, you just recompile your Python DLL without
> modification), there is no need to compile your own interpreter, it just
> makes problem and the performance benefits is outweighed by the problems of
> having to use 3rd party Python DLL (even if you don't modify the code and
> just recompile it, it is not the official release, thus 3rd party).

I do get your point, but your point is maintaining compatibility
between two different *versions* of a DLL/Program.  I am talking about
having a DLL/Program combination which uses different MSVC runtimes.

> > > If you insist to use your own version (or don't
> > > have a choice), you could instead pack your own DLL, use the local
> > > DLL, and ignore the system's DLL.
> >
> > Yes, that works fine when deploying the application.  However, during
> > development it is inconveninent to put our own Python DLL beside our
> > executable every time.  Our Python DLL (compiled with MSVC 8.0) is in
> > the PATH.  If the original Python DLL would be located in the Python
> > installation folder, there would be no problem.  But since it is
> > placed in the system32 folder which is searched before the PATH
> >
> (http://msdn2.microsoft.com/en-us/library/ms682586(VS.85).aspx),
> the
> > original Python DLL (compiled with MSVC 7.1) is used instead of your
> > own one.
>
> If that is the case, you could just simply substitute the system32's dll
> with your in the test machine. If you don't want to dirty the system
> (perhaps because you use the system for other things too), then you could
> benefit from dual booting or virtualization technology.
>
> Dual Booting is putting two (almost) completely seperate OSes in a single
> machine.
> Virtualization is a technology that allows an OS to be run inside another
> OS, an example would be VMWare. This result in degraded performance in the
> client OS, but it's easier to manage than Dual Booting.
>
> You don't need any special program to set up a dual boot system, although
> you might require special knowledge on how to do it. For virtualization
> technology, VMWare and Microsoft have a free version of their virtual
> machines. So basically, these two set ups costs nothing.

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


Re: Writing Oracle Output to a File

2007-12-26 Thread t_rectenwald
On Dec 26, 12:06 pm, Paul Hankin <[EMAIL PROTECTED]> wrote:
> On Dec 26, 4:51 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Dec 26, 10:36 am, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I attempting to execute an Oracle query, and write the results to a
> > > file in CSV format.  To do so, I've done the following:
>
> > > import cx_Oracle
> > > db = cx_Oracle.connect('user/[EMAIL PROTECTED]')
> > > cursor = db.cursor()
> > > cursor.arraysize = 500
> > > cursor.execute(sql)
> > > result = cursor.fetchall()
>
> > > The above works great.  I'm able to connect to the database and print
> > > out the results as a list of tuples.  Here is where I get lost.  How
> > > do I work with a "list of tuples?"  My understanding is that a "list"
> > > is basically an array (I don't come from a Python background).  Tuples
> > > are a "collection of objects."  So, if I do...
>
> > > print result[0]
>
> > > I get the first row of the query, which would make sense.  The problem
> > > is that I cannot seem to write tuples to a file.  I then do this...
>
> > > csvFile = open("output.csv", "w")
> > > csvFile = write(result[0])
> > > csvFile.close
>
> > > This generates an exception:
>
> > > TypeError: argument 1 must be string or read-only character buffer,
> > > not tuple
>
> > > So, I'm a bit confused as to the best way to do this.  I guess I could
> > > try to convert the tuples into strings, but am not sure if that is the
> > > proper way to go.  Any help would be appreciated.  I've also seen a
> > > csv module out there, but am not sure if that is needed in this
> > > situation.
>
> > > Best Regards,
> > > Tom
>
> > Hello,
>
> > I was able to figure this out by using join to convert the tuples into
> > strings, and then have those write to the filehandle:
>
> > csvFile = open("output.csv", "w")
> > for row in cursor.fetchall():
> >     csvFile.write(','.join(row) + "\n")
> > csvFile.close
>
> As usual, the python standard library has functions that do what you
> want! Using the csv module will help you avoid trouble when your data
> contains commas or control characters such as newlines.
>
> import csv
> help(csv)
>
> Suggests this code:
> import csv
> csv_file = open('output.csv', 'w')
> csv_writer = csv.writer(csvFile)
> csv_writer.writerows(cursor.fetchall())
> csv_file.close()
>
> --
> Paul Hankin- Hide quoted text -
>
> - Show quoted text -

Thanks for the tip.  I'll read up on the csv module and use that
instead.  I'm already running into errors with null values, etc... and
I believe some of the data in this DB will have commas, so this will
be a much cleaner way of doing things.

Regards,
Tom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing Oracle Output to a File

2007-12-26 Thread Paul Hankin
On Dec 26, 4:51 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> On Dec 26, 10:36 am, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I attempting to execute an Oracle query, and write the results to a
> > file in CSV format.  To do so, I've done the following:
>
> > import cx_Oracle
> > db = cx_Oracle.connect('user/[EMAIL PROTECTED]')
> > cursor = db.cursor()
> > cursor.arraysize = 500
> > cursor.execute(sql)
> > result = cursor.fetchall()
>
> > The above works great.  I'm able to connect to the database and print
> > out the results as a list of tuples.  Here is where I get lost.  How
> > do I work with a "list of tuples?"  My understanding is that a "list"
> > is basically an array (I don't come from a Python background).  Tuples
> > are a "collection of objects."  So, if I do...
>
> > print result[0]
>
> > I get the first row of the query, which would make sense.  The problem
> > is that I cannot seem to write tuples to a file.  I then do this...
>
> > csvFile = open("output.csv", "w")
> > csvFile = write(result[0])
> > csvFile.close
>
> > This generates an exception:
>
> > TypeError: argument 1 must be string or read-only character buffer,
> > not tuple
>
> > So, I'm a bit confused as to the best way to do this.  I guess I could
> > try to convert the tuples into strings, but am not sure if that is the
> > proper way to go.  Any help would be appreciated.  I've also seen a
> > csv module out there, but am not sure if that is needed in this
> > situation.
>
> > Best Regards,
> > Tom
>
> Hello,
>
> I was able to figure this out by using join to convert the tuples into
> strings, and then have those write to the filehandle:
>
> csvFile = open("output.csv", "w")
> for row in cursor.fetchall():
>     csvFile.write(','.join(row) + "\n")
> csvFile.close

As usual, the python standard library has functions that do what you
want! Using the csv module will help you avoid trouble when your data
contains commas or control characters such as newlines.

import csv
help(csv)

Suggests this code:
import csv
csv_file = open('output.csv', 'w')
csv_writer = csv.writer(csvFile)
csv_writer.writerows(cursor.fetchall())
csv_file.close()

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


Re: Writing Oracle Output to a File

2007-12-26 Thread t_rectenwald
On Dec 26, 10:36 am, t_rectenwald <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I attempting to execute an Oracle query, and write the results to a
> file in CSV format.  To do so, I've done the following:
>
> import cx_Oracle
> db = cx_Oracle.connect('user/[EMAIL PROTECTED]')
> cursor = db.cursor()
> cursor.arraysize = 500
> cursor.execute(sql)
> result = cursor.fetchall()
>
> The above works great.  I'm able to connect to the database and print
> out the results as a list of tuples.  Here is where I get lost.  How
> do I work with a "list of tuples?"  My understanding is that a "list"
> is basically an array (I don't come from a Python background).  Tuples
> are a "collection of objects."  So, if I do...
>
> print result[0]
>
> I get the first row of the query, which would make sense.  The problem
> is that I cannot seem to write tuples to a file.  I then do this...
>
> csvFile = open("output.csv", "w")
> csvFile = write(result[0])
> csvFile.close
>
> This generates an exception:
>
> TypeError: argument 1 must be string or read-only character buffer,
> not tuple
>
> So, I'm a bit confused as to the best way to do this.  I guess I could
> try to convert the tuples into strings, but am not sure if that is the
> proper way to go.  Any help would be appreciated.  I've also seen a
> csv module out there, but am not sure if that is needed in this
> situation.
>
> Best Regards,
> Tom

Hello,

I was able to figure this out by using join to convert the tuples into
strings, and then have those write to the filehandle:

csvFile = open("output.csv", "w")
for row in cursor.fetchall():
csvFile.write(','.join(row) + "\n")
csvFile.close

Regards,
Tom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python DLL in Windows Folder

2007-12-26 Thread Chris Mellon
On Dec 24, 2007 5:23 PM, Ross Ridge <[EMAIL PROTECTED]> wrote:
> Chris Mellon <[EMAIL PROTECTED]> wrote:
> >What the python installer is doing is the Right Thing for making the
> >standard python dll available to third party applications.
> >Applications that want a specific version of a specific DLL should use
> >the mechanisms available for doing so, instead of relying on there
> >being a specific version of the python dll in the windows folder. This
> >is just general best practice on Windows.
>
> No, it's not best practice for an application install any of its files
> in the Windows system directory.  The system directory is ment only
> for drivers and system files.  Installing application DLLs in the
> system directory is something that should only be done for backwards
> compatiblity.


Python (when installed with "for everyone") is not (just) an
application, it's a runtime. I know that Microsoft has totally dropped
the ball on handling shared libraries and has recently thrown up its
arms and just said that all apps should ship with everything they need
("Don't use shared libraries any more, versioning is hard") but that's
not applicable to Python *the runtime*. system32 is precisely the
correct spot for it, when installed by an administrator, as a system
runtime.

Note that "for me only" Python, doesn't install to there.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Game Development

2007-12-26 Thread James Matthews
SO use pygame! but please don't spam this list!





-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python DLL in Windows Folder

2007-12-26 Thread James Matthews
You have read access just not write! Because you need the DLLS in there!

On Dec 25, 2007 7:53 PM, Thorsten Kampe <[EMAIL PROTECTED]> wrote:

> * Stef Mientki (Tue, 25 Dec 2007 11:39:47 +0100)
> > Another reason "not to put the DLL in win/wys32":
> > on a lot of computers writing to win/sys32 or even the whole C-drive
> > is prohibited !
>
> No, definitely not. It's just not allowed for everyone.
>
> Thorsten
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: very newbie question about exception handling

2007-12-26 Thread James Matthews
In short input runs an eval on the text before it passes it! So input like
ord('a') will work fine because it will run that code!

On Dec 26, 2007 5:26 AM, <[EMAIL PROTECTED]> wrote:

> Thanks guys! It worked.
>
> Merry Christmas!
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python for web...

2007-12-26 Thread James Matthews
Ha read an RFC for web dev! hehehhe Thats a new one!

On Dec 26, 2007 9:43 AM, Bruno Desthuilliers <
[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] a écrit :
> > Hi everyone,
> >
> > I have to develop a web based enterprise application
>
> "enterprise" ???
>
> > for my final year
> > project. Since i am interested in open source, i searched the net.
> > Almost 90% of them were PHP and MySQL. Cant we use python for that ?
>
> Well, I don't know if *you* can, but as far as I'm concerned, that what
> I do whenever possible !-)
>
> > I
> > tried several sites, but there is not enough tutorial for beginners
> > [mod_python, PSP etc]. I couldnt find any detailed book, not even a
> > single book :( All the python books are covering only CGI part)
>
>
> Knowing CGI is certainly not the worst starting point wrt/ web
> development - I whish more PHP 'programmers' had the minimal
> understanding of the HTTP protocol required to write a CGI script (and
> any serious web app FWIW).
>
> > Any suggestions?
>
> Django or Pylons are probably what you're looking for. The first one is
> the more mature, stable, and well documented, and the second one the
> most promising IMHO. If you're new to both web development and Python,
> I'd actually recommand Django.
>
> > Any recommended book?
>
> The HTTP 1.1 RFC !-)
>
>
> > Execuse my English.
>
> Seems fine to me - at least understandable, and that's the important
> point, isn't it ?-)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

interactive mode in python with ctypes???

2007-12-26 Thread digitnctu
Dear all:

 I am coming with problem, to apply ctypes under interactive mode
in python.

 libdll.dll is a third-party library. The below code segment will
run well under the batch mode(ie. python test.py 11060)
 but when I type sequencially it doesn't work as usual.  Can any
give me a hand??

# file test.py begin
  from ctypes import *
  lib = CDLL("libdll.dll")
  def evCb(ev, clData, caData):
  print "event: ", ev,"=>" , string_at(caData)

  def run(port):
  libinf = lib.libCreate(0)
  lib.libConnect(libinf,port,0,0)
  evfptr = CFUNCTYPE(None,c_char_p, c_void_p,c_void_p)
  lib.libCltAddEventCallback(libinf,"AllEvents",evfptr(evCb),0)
  result = c_char_p()
  libbuf = raw_input("lib>")
  while libbuf != "quit":
  lib.libCallCommand(libinf,libbuf,0,pointer(result))
  print "result: ",result.value
  if libbuf == "Exit":
  break
  libbuf = raw_input("lib>")
  lib.libDestroy(libinf)
if __name__ == "__main__":
  import sys,string
  run(string.atoi(sys.argv[1]))
  # file test.py end

 I type in interactive mode of python as below:

 from ctypes import *
 lib = CDLL("libdll.dll")
 def evCb(ev,clData,caData):
 print "event: ", ev,"=>" , string_at(caData)
 libinf = lib.libCreate(0)
 lib.libConnect(libinf, 11060, 0,0)
evfptr = CFUNCTYPE(None,c_char_p, c_void_p,c_void_p)
lib.libCltAddEventCallback(libinf,"AllEvents",evfptr(evCb),0)
result = c_char_p()
lib.libCallCommand(libinf,"somecmd",0,pointer(result))
lib.libDestroy(libinf)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing pydoc gui

2007-12-26 Thread JimG
On Dec 26, 10:43 am, JimG <[EMAIL PROTECTED]> wrote:
> On Dec 26, 9:46 am, Bernard Delmée <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > FWIW I am using 2.4.4 under debian etch and 2.5.1 under windows XP,
> > and pydoc seems to support the -[pgkw] flags under both versions.
> > When trying -g under debian, I am getting a stack-trace and a message
> > inviting me to install the python-tk package.
>
> > Does "pydoc -g" provide any feedback on your installation?
>
> > One nice alternative for python standard doc is the .CHM file
> > provided at python.org. You can use the "xchm" viewer under linux.
>
> > On 26/12/2007 14:56, JimG wrote:
>
> > > Thanks for the suggestion, however, that does not seem to be the
> > > reason since I already have both tk and tkinter.  I tried adding tk-
> > > devel but that made no difference.
>
> That's the weird part.  The man page for pydoc doesn't mention -g as a
> supported option and the output of pydoc -g just prints out the usage/
> options information -- -k, -p, -w are the options.  As if the version
> of pydoc I have is built without gui support.

Uh, not the man page... the output of "pydoc pydoc."  Here's a snip:


Or, at the shell command line outside of Python:

Run "pydoc " to show documentation on something.   may
be
the name of a function, module, package, or a dotted reference to
a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source
file.

Run "pydoc -k " to search for a keyword in the synopsis
lines
of all available modules.

Run "pydoc -p " to start an HTTP server on a given port on
the
local machine to generate documentation web pages.

Run "pydoc -w " to write out the HTML documentation for a
module
to a file named ".html".

Module docs for core modules are assumed to be in

http://www.python.org/doc/current/lib/

This can be overridden by setting the PYTHONDOCS environment
variable
to a different URL or to a local directory containing the Library
Reference Manual pages.  .

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


Re: how to generate html table from "table" data?

2007-12-26 Thread vasudevram
> [EMAIL PROTECTED] a écrit :
>
> > Hi group,
> > I would like to convert the output of the SQL query, or more generally
> > I would like to convert any "table" data to the html table.
>
> > I would like to set some rules to format cells, columns or rows (font,
> > colour etc.) of the html table, according to the values in the
> > specific cells.
>
Why not try writing your own code for this first?
If nothing else, it'll help you learn more, and may also help you
understand better, the other options.

Vasudev Ram
---
Dancing Bison Enterprises
Software consulting and training
Biz site: http://www.dancingbison.com
Blog (on software innovation): http://jugad.livejournal.com
Quick and easy PDF creation toolkit: http://www.dancingbison.com/products.html

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


Re: missing pydoc gui

2007-12-26 Thread JimG
On Dec 26, 9:46 am, Bernard Delmée <[EMAIL PROTECTED]>
wrote:
> FWIW I am using 2.4.4 under debian etch and 2.5.1 under windows XP,
> and pydoc seems to support the -[pgkw] flags under both versions.
> When trying -g under debian, I am getting a stack-trace and a message
> inviting me to install the python-tk package.
>
> Does "pydoc -g" provide any feedback on your installation?
>
> One nice alternative for python standard doc is the .CHM file
> provided at python.org. You can use the "xchm" viewer under linux.
>
> On 26/12/2007 14:56, JimG wrote:
>
>
>
> > Thanks for the suggestion, however, that does not seem to be the
> > reason since I already have both tk and tkinter.  I tried adding tk-
> > devel but that made no difference.

That's the weird part.  The man page for pydoc doesn't mention -g as a
supported option and the output of pydoc -g just prints out the usage/
options information -- -k, -p, -w are the options.  As if the version
of pydoc I have is built without gui support.
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing Oracle Output to a File

2007-12-26 Thread t_rectenwald
Hello,

I attempting to execute an Oracle query, and write the results to a
file in CSV format.  To do so, I've done the following:

import cx_Oracle
db = cx_Oracle.connect('user/[EMAIL PROTECTED]')
cursor = db.cursor()
cursor.arraysize = 500
cursor.execute(sql)
result = cursor.fetchall()

The above works great.  I'm able to connect to the database and print
out the results as a list of tuples.  Here is where I get lost.  How
do I work with a "list of tuples?"  My understanding is that a "list"
is basically an array (I don't come from a Python background).  Tuples
are a "collection of objects."  So, if I do...

print result[0]

I get the first row of the query, which would make sense.  The problem
is that I cannot seem to write tuples to a file.  I then do this...

csvFile = open("output.csv", "w")
csvFile = write(result[0])
csvFile.close

This generates an exception:

TypeError: argument 1 must be string or read-only character buffer,
not tuple

So, I'm a bit confused as to the best way to do this.  I guess I could
try to convert the tuples into strings, but am not sure if that is the
proper way to go.  Any help would be appreciated.  I've also seen a
csv module out there, but am not sure if that is needed in this
situation.

Best Regards,
Tom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CPython and a C extension using Boehm GC

2007-12-26 Thread MrJean1
It depends on how the GC inside the extension is built.  If it is a
drop-in replacement for malloc, then GC *must* be loaded and
initialized upfront if possible.  There is no need to memcpy anything
between Python and the extension.

However, if GC does not replace malloc, etc., then GC-ed memory is
only used within the extension.  GC_INIT can be called when the
extension is loaded and memcpy-ing between Python and the extension is
mandatory.

There are other details to consider.  For example, on some platforms,
GC *must* be initialized from the main executable.  That may preclude
both scenarios, altogether.

/Jean Brouwers



On Dec 25, 7:35 pm, Andrew MacIntyre <[EMAIL PROTECTED]>
wrote:
> malkarouri wrote:
> > Is it possible to write a Python extension that uses the Boehm garbage
> > collector?
> > I have a C library written that makes use of boehm-gc for memory
> > management. To use that, I have to call GC_INIT() at the start of the
> > program that uses the library. Now I want to encapsulate the library
> > as a CPython extension. The question is really is that possible? And
> > will there be conflicts between the boehm-gc and Python memory
> > management? And when should I call GC_INIT?
>
> It probably should be possible with some caveats:
> - memory allocated by Python is never passed into the library such that
>    it also ends up being subject to boehm-gc;
> - memory allocated by the library is never used by Python objects.
>
> So memcpy()ing between library allocated and Python allocated memory
> would seem to be a way to achieve this.
>
> I would call GC_INIT in the extension's import routine
> (init()) for a C extension, and immediately after loading
> the library if using ctypes.
>
> --
> -
> Andrew I MacIntyre                     "These thoughts are mine alone..."
> E-mail: [EMAIL PROTECTED]  (pref) | Snail: PO Box 370
>         [EMAIL PROTECTED]             (alt) |        Belconnen ACT 2616
> Web:    http://www.andymac.org/              |        Australia

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


Re: Pexpect and a Linux Terminal

2007-12-26 Thread [EMAIL PROTECTED]
On 25 déc, 15:49, [EMAIL PROTECTED] wrote:
> On Dec 25, 8:42 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 25 déc, 10:14, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > On 25 déc, 09:41, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > Yes it's work ! :-D
>
> > > > I use  prompt = '.*#' to detect the prompt expect. Thank you for you'r
> > > > help !
>
> > > > Vive Python et TK :-D
>
> > > I have another probleme, not directly from Pexpect() function. There
> > > is my code :
>
> > > from Tkinter import *
> > > from sys import *
> > > import tkMessageBox
> > > from tkColorChooser import askcolor
> > > from tkFileDialog   import askopenfilename
> > > import tkFileDialog as Selector
> > > from os.path import exists, join
> > > from os import pathsep
> > > import pexpect
> > > import os, sys
> > > def test():
> > >  cmd1="su -"
> > >  pwd="mypass"
> > >  prompt ='.*#'
> > >  iso=Selector.askopenfilename(initialdir="/home/user",filetypes =
> > > [("iso", "*.iso")])
> > >  lbl2=Label(fen1)
> > >  cmd2="mount -o loop "+iso+" /mnt/disk"
> > >  child = pexpect.spawn(cmd1)
> > >  child.expect('Mot de passe :')
> > >  child.sendline(pwd)
> > >  child.expect(prompt)
> > >  child.send(cmd2)
> > >  lbl2.configure(text=cmd2)
> > >  lbl2.pack()
> > > fen1=Tk()
> > > entr1=Entry(fen1)
> > > lbl1=Label(fen1)
> > > entr1.pack()
> > > lbl1.pack()
> > > bou1= Button(fen1,text='Parcourir',command=test)
> > > bou1.pack()
> > > fen1.mainloop()
>
> > > All that's ok when if cmd2 command like : mkdir /root/toto but when i
> > > want to replace it for : mount loop -o /home/user/myiso.iso /mnt/disk
> > > nothing happened :-( I tryed the command during many times and i don't
> > > know why it doesn't work :s
>
> > > if you can help me another time i will be apprecied :-P
>
> > > Thank you :)
>
> > When want to test the mkdir command, it work but ONLY if my TTY as
> > root is closed, very weired no ?
> > the mount command still not work :s
> > >  child = pexpect.spawn(cmd1)
> > >  child.expect('Mot de passe :')
> > >  child.sendline(pwd)
> > >  child.expect(prompt)
> > >  child.send(cmd2)
>
> Try sendline(cmd2). Most cases you may never need to use send() with
> pexpect.
> Since you used send here, the command is not yet entered to the shell;
> it's as though you typed the command and forgot to press enter.
>
> Again try adding a wait using child.expect(prompt). This will ensure
> 'cmd2' completed and then you may want to clean up using a call to
> child.close()
>
> If things still don't work, try some simple commands like you are
> doing with mkdir. Of course you want to first ensure you can manually
> do all the steps that you are trying to automate with pexpect.
>
> Karthik

Thank you for your help ! it work very fine !

Have a nice day
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing pydoc gui

2007-12-26 Thread Bernard Delmée
FWIW I am using 2.4.4 under debian etch and 2.5.1 under windows XP,
and pydoc seems to support the -[pgkw] flags under both versions.
When trying -g under debian, I am getting a stack-trace and a message
inviting me to install the python-tk package.

Does "pydoc -g" provide any feedback on your installation?

One nice alternative for python standard doc is the .CHM file
provided at python.org. You can use the "xchm" viewer under linux.

On 26/12/2007 14:56, JimG wrote:
> 
> Thanks for the suggestion, however, that does not seem to be the
> reason since I already have both tk and tkinter.  I tried adding tk-
> devel but that made no difference.
-- 
http://mail.python.org/mailman/listinfo/python-list


state of XSLT2/XPath2 or XQuery in CPython

2007-12-26 Thread Christof Hoeke
hi,
I was wondering if there is any way to use XSLT2 or maybe even XQuery 
with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I 
have not tried Saxon.NET with IronPython but suspect no problem?) but I 
could not find any way to use XSLT2 or XPath Features with CPython. All 
the usual suspects 4suite or libxslt (via lxml) seem to have no support 
yet. Is there any hope I oversaw something?

Would be especially interesting for a WSGI application, so a more or 
less complicated hack via CPython->Jython->Saxon and back would probably 
not be very useful (if that is possible at all).

thanks!
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Geodetic software development

2007-12-26 Thread Fred
Dear software developer,

GeoDLL supports the development of geodetic software on various
platforms by providing geodetic functions. GeoDLL contains precise
functions of the themes 2D and 3D coordinate transformation, geodetic
datum shift and reference system conversion, meridian strip changing,
user defined coordinate and reference systems, distance calculation,
Digital Elevation Model and map function.

GeoDLL enables the program developer to perform professional grade
coordinate transformations:

The current and many historical Coordinate and Reference Systems of
all States of the European Union (EU) including the eastern extension
from April 2004 and other European Systems.
The US- and Canadian State Plane Coordinate Systems (SPCS) on NAD27
and NAD83 and other Coordinate and Reference Systems of the North
American Continent.
The Coordinate and Reference Systems of the Australian Continent.
A lot of Coordinate and Reference Systems of other Continents.
All world-wide used Coordinate and Reference Systems.
The German Coordinate and Reference Systems of the old and new Federal
States, the 40 Prussian Soldner Land Registers, the German Lagestatus
and exact Reference Systems of the Federal States of Germany.
User-defined coordinates systems, local reference systems and earth
ellipsoids can be defined on base of the earth half axis and seven
transformation parameters (Helmert) or three transformation parameters
(Molodenski).

GeoDLL comes with extensive documentation and works as DLL file with
many commonly used programming languages or it can be used as C++ or
CA-VO source code. The functions of GeoDLL are multithreading ready.
The DLL is written with the programming language C++. Thus a very fast
performance, a compact code and a high running stability are reached.

Clother information you can find on the site 
http://www.killetsoft.de/p_gdla_e.htm.

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


Re: missing pydoc gui

2007-12-26 Thread JimG
On Dec 26, 8:27 am, Bernard Delmée <[EMAIL PROTECTED]>
wrote:
> Hi Jim, I guess you're missing tk and its tkinter
> python wrapper. Sorry I don't know what the corresponding
> packages would be called under fedora...

Hi Bernard,

Thanks for the suggestion, however, that does not seem to be the
reason since I already have both tk and tkinter.  I tried adding tk-
devel but that made no difference.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: convert pdf to png

2007-12-26 Thread Boris Borcic
Carl K wrote:
> Rob Wolfe wrote:
>> Carl K <[EMAIL PROTECTED]> writes:
>>
>>> I need to take the take the pdf output from reportlab and create a
>>> preview image for a web page.  so png or something.  I am sure
>>> ghostscript will be involved. I am guessing PIL or ImageMagic ?
>>>
>>> all sugestions welcome.
>>
>> Did you try to use `reportPM` from rl_addons [1]_? This is an 
>> extension of the reportlab package.
>>
>> There is also PIL needed and on my linux box
>> I needed some additional fonts [2]_.
>>
>> And then I could create PNG directly from reportlab, e.g:
>>
>> 
>> from reportlab.graphics.shapes import Drawing, String
>> from reportlab.graphics import renderPM
>>
>> d = Drawing(400, 200)
>> d.add(String(150, 100, 'Hello World', fontSize=18))
>> renderPM.drawToFile(d, 'test.png', 'PNG')
>> 
>>
>> .. [1] http://www.reportlab.co.uk/svn/public/reportlab/trunk/rl_addons/
>> .. [2] http://www.reportlab.com/ftp/fonts/pfbfer.zip
> 
> This sounds like what I was looking for.  some how this got missed when 
> I poked around reportlab land.
> 
> Thanks much.
> 
> Carl K

Beware... AFAIK this is only a backend for reportlab graphics drawings, IOW it 
will render drawings and charts from the reportlab.graphics package but will 
not 
render reportlab pdf canvas.

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


Re: missing pydoc gui

2007-12-26 Thread Bernard Delmée
Hi Jim, I guess you're missing tk and its tkinter
python wrapper. Sorry I don't know what the corresponding
packages would be called under fedora...
-- 
http://mail.python.org/mailman/listinfo/python-list


Game Development

2007-12-26 Thread [EMAIL PROTECTED]
We at AJ Aquare are engaged in design and development of PC-based,
online and mobile games. Our Game designers are passionate towards
creating games that people long to have. Our designs can drive
millions of players to your site.

Sources: http://www.ajsquare.com/games/game_design.php?game=design
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OMG please help

2007-12-26 Thread Paul Hankin
On Dec 26, 1:09 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Mon, 24 Dec 2007 17:14:58 +0100, Martin P. Hellwig wrote:
> > As Dennis already pointed out I like to use dictionaries in these cases,
> > so I would use sand = dict() instead of sands = list() and would do
> > sand[i] = pygame.image.load(name)
>
> > Then you can retrieve the content by doing sand[your_number].
>
> If the keys are just the integers 0...n inclusive, then why bother with
> the extra overhead of a dict when you get all the functionality you need
> from a list?

The keys aren't integers 0...n here, they're 1, 2, 3, 4, L, R, T, D,
TL, TR, BL, BR in the code, so a dict is preferable to a list.

Incidentally Katie: is 'D' a typo? It should be 'B' for consistency.

Also, functions can be passed arguments, and doing so is preferable to
passing information via global variables.

So
def LoadMaterial(loader):
   ...
sand = LoadMaterial('Sand')

Is a lot better than

def LoadMaterial():
   ... code using 'loader'
loader = 'Sand'
sand = LoadMaterial()


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


Re: convert pdf to png

2007-12-26 Thread Diez B. Roggisch
Carl K schrieb:
> Diez B. Roggisch wrote:
>> Carl K schrieb:
>>> Grant Edwards wrote:
 On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote:

>> If it is a multi page pdf Imagemagick will do:
>>
>> convert file.pdf page-%03d.png
> I need python code to do this.  It is going to be run on a
> someone else's shared host web server, security and
> performance is an issue.  So I would rather not run stuff via
> popen.

 Use subprocess.

 Trying to eliminate popen because of the overhead when running
 ghostscript to render PDF (I assume convert uses gs?) is about
 like trimming an elephants toenails to save weight.

>>>
>>> maybe, but I wouldn't be so sure.
>>>
>>> currently the pdf is created in a python StringIO buffer and returned 
>>> to the browser;  so it never becomes a file.  using convert means I 
>>> have to first save it as a file, convert from file to file, read the 
>>> file, delete the 2 files. so 6 file operations where before there 
>>> were none.  That may be more of a load than the ghostscript part.
>>
>> So what? I'm not sure about current HD speeds, but a couple of years 
>> ago these were about 30MByte/s - and should be faster today. Which 
>> equals 240MBit/s, much more than your user's internet connection. and 
>> this is raw IO speed, not counting disk caches.
> 
> server is doing a ton of SQL queries (yes, moving to a 2nd box would be 
> nice. might happen mid 2008) so adding HD is an issue.  not sure how 
> much, but enough to try to avoid it.

Keeping stuff in memory provoking paging isn't?

>>
>> In other words: given the overall latency of a network connection, 
>> your  file operations shouldn't shave off more than a split-second. 
> 
> those split seconds can add up.  The server is aleady overloaded, so 
> adding more is a big no no.
> 
>  > So if you
>> _can_ go the subprocess-road, do it. It's the easiest way. And withou 
>> further knowledge of the GS-library (that you lack, as do I) - how do 
>> you know that it works "in memory", and doesn't actually expect a 
>> file-name or pointer?
> 
> I am willing to take that chance.  much better than the 6 hits I know 
> would happen using
> 
> I have a feeling if I have to create a file, we will go with plan B: 
> send the client a pdf and let the user deal with it.  Not as nice and 
> slick, but won't bog the server.

I have the feeling you just go by your feelings. Which is always a bad 
idea regarding performance bottlenecks.

http://en.wikipedia.org/wiki/Optimization_(computer_science)

So instead of jumping through hoops getting something done the hard way 
without knowing how the easy solution affects performance, implement the 
feature the easiest way. And SEE if it causes trouble.

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


Re: smtplib problem, Unable to relay for

2007-12-26 Thread Benedict Verheyen
Benedict Verheyen schreef:
> 

Thanks for the responses.

I solved it by adjusting the relayers list (i'm a domain admin) in 
others words i granted my pc the rights to relay.
I did this by starting the Exchange System Manager and then going to 
Servers->->protocols->SMTP

Then right click on "Default SMTP Virtual Server" and properties,
go to the Access pane and near the bottom you have a button "Relay"
in a section called "Relay restrictions".
That's where i temporarily added my ip address.

After sending the greetings mail, i removed my ip address again from 
that granted list.

Regards and many thanks,
Benedict



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


help hisham to set up an online business

2007-12-26 Thread sazali
Hello world.
 I had some problems with my business.
My name is Noor Hisham Bin Ahmad.
I,m from Malaysia.
I need some funds to support my blog because I want set up an online
business.

this is my account number.
Bank Simpanan Nasional
0210029816898886

via western union
-- 
http://mail.python.org/mailman/listinfo/python-list


M'I.5 Perse cution Mol estation du ring T ravel

2007-12-26 Thread mfimei

MI5 Persecution: Molestation during. Travel

MI5s persecution of me varies. in intensity. Since 1990 it has been steady
for perhaps 80% of the time; there was. a notable quiet period in 1993, and
another. quiet period in Jan-Feb 1995, as well as a hiatus in the first two
months of 1999.. It puzzles me that they cease and restart, seemingly
without. any logic or reason. But one aspect of MI5s activities against me
which is relatively predictable. is this weeks articles topic, which is
Molestation during Travel. Almost. every time I cross the Atlantic, go to
the Continent or even try to enjoy a holiday in this country, you can. bet
that MI5 will be there doing their utmost to wreck it. all.

This aspect of the. harassment is particularly relevant as I will be
travelling to Europe again in. a months time, with naturally the Minidisc
recorder in tow; so it will be interesting. to see if I can record the
abuse. which will almost certainly take place, either on the Tube going to
the airport, at the. airport, on the flight, in the terminal building - MI5
have previously instituted instances of abuse at. each of these locations,
so well see how much taxpayers money they waste this. time, and whether it
will. prove possible to capture their abuse on minidisc.

Read about the MI5. Persecution on the Web

June 1992 in Polands mountain resort of. Zakopane

The persecution started in. June 1990, and for the first two years I stayed
in the UK apart from a couple of brief day. trips to Calais. By the summer
of 1992 Id. had enough of being cooped up in England with abusive fellow
employees egged on by an abusive secret police service, and decided. to
spend 10 days in. southern Poland, on what was intended to be a holiday at
the mountain resort town. of Zakopane.

Unfortunately the psychopaths of the Security Service were not willing. to
allow me to. enjoy a holiday in peace and quiet. The journey to Zakopane
was by coach from the meeting point at Londons Victoria. coach station
(National Express) followed by ferry followed by another coach. across
Europe. As we left Victoria a. youth and his girlfriend started a loud
tirade of abuse directed at "this bloke", where. the "bloke" was never
named, but. it was very clear that the "bloke" was myself. The youth said
"they" had "found. somebody from his school, and he was always really
stressed at school, a. real psycho". Again, the label "they" was not
elaborated on, but it was clear. that "they" = the persecutors from
MI5. The. boy also said, "he was in a bed and breakfast for only one night
and they. got him". By a not unexpected coincidence I had been in a B&B in
Oxford a. week previously, which had been booked from work; other things
lead me to. the conclusion that the company's offices were bugged for most
of the 2 1/2. years that I was there, so "they" would have known a room in
the B&B had been booked. After a few minutes of this I went. back to where
they were. sitting and asked where they were travelling. The boy named a
village. in France, and the girl's giggling suddenly ceased; presumably it
permeated to her brain. cell what the purpose of the boy's abuse was.

It is now very clear to me that MI5 were trying to have. me incarcerated,
assaulted or killed on. this trip across Europe. The degree of verbal
violence inescapably leads to this conclusion. When we arrived. at our
destination, it became clear that many people, both in our tour group. and
its guide, and among the ordinary residents. of the town, knew there was a
movement under way to "get" me.. MI5 employed many people and significant
resources for an action which they knew would only. take a maximum of ten
days. A commercial operation would never have. felt able to waste such
resources on such an unproductive and. temporary action; only a
state-sponsored, taxpayer-funded entity like the Security. Service would be
able to be. so wasteful.

To give some examples of what happened in those ten days; I was walking. in
some. woods outside the town, when a Polish woman, looking at me, said the
English "shit" in a strongly Polish-accented voice. For. the first three
years 1990-92 MI5. had been trying to force this word on me. Another
example; I was walking near. my "hotel" when a mother said laughing to her
child, "a wiesz ze to prawdziwy wariat" which means "you know. hes a real
madman". And the "TV reacting" happened. there too; on Polish TV, a bemused
looking journalist said to another,. "to jest sprawa Anglikow", which means
"its the concern of. the English", in other words, none of our business,
despite. what the English are trying to force down our throats.

Just before we left for home, I went with some others from our group to. a
nearby bar. There a man shouted at me the same sexual obscenity which. MI5
have constantly thrown at me. these last three years. I think MI5 try to
justify their various terms of abuse by repeating them at me. until I say
them, either. while conscious or while talking in my sleep; a

M'I-5 Pers ecution , BB C Newscasters Li e & Deny Theyr e Wa tching Me

2007-12-26 Thread mifemeve

MI5 Persecution: BBC Newscasters Lie & Deny. They're Watching Me

Central to the persecution campaign waged against me. for some nine years
now by the Security Service is their use of the. media, and in particular
the broadcast media, to make clear. to me that I am under surveillance and
being watched within my own home, even by BBC newscasters while. they read
the news. This is. really an act of arrogance; MI5 and their tools in the
television and radio are so sure that they. can never be caught, that they
have many times made explicity clear on. broadcast programmes that they are
as capable of. seeing me as I am of seeing the broadcast pictures. Even
when they have known I am taping the programmes they. still carry on this
practice; for examples of TVand. radio presenters caught "in action", see
the Evidence area of my. website.

If you wish to reply to this. article..
then please include your name and fax number!. I provide the means for
recipients to send me their thoughts on the topics. discussed, but ask that
you provide me with your fax number. or email address if you require a
response. Also would you please send not more than one or. two pages, if by
fax.. Thank-you!


It. started with a Newscaster, and it continues with Newscasters today

The very first incident in the story. started with a reaction by an ITN
newscaster, Sue Carpenter,. in June of 1990, almost nine years ago now. She
reacted to what she. saw in my living room at home as she read the news. My
mother had brought an apple for me into the. room, whereupon the newsreader
smirked and giggled, apparently finding this. funny. I couldn't believe
what I was seeing. I carried on watching news and. other television
programmes to see if presenters would. show signs of "interactive
watching";. to my surprise, this happened again and again. Unfortunately, I
did not have my wits sufficiently. about me to videotape these programmes,
and it is now almost impossible to obtain recordings dating back. to 1990.

However, I have been busy recording. everything Ive watched the last couple
of years, and the. taping has yielded some nuggets, which you will find if
you point your Web browser. at the "evidence" area of my website, whose URL
address is given above. Strangely it is not particularly the BBC. who are
"after. me" at the moment (with the exception of occasional fire from
Nicholas Witchell), but. that supposed paragon of virtue and decency Jon
Snow of Channel Four. TV News (he actually works for ITN), who once claimed
hed turned down MI5s offer of. a tax-free salary. I will cover Snows recent
actions in a future. article.

BBCs. Hidden Shame

The first ever. Usenet post (internet newsgroup article) on the subject of
the MI5 bugging / BBC watching occurred, as stated in a. previous article,
in early May. 1995. It is reproduced here;

Date:. Thu May  4 18:27:24 1995
Newsgroups:. alt.conspiracy
Subject: BBC's. Hidden Shame

Remember the two-way televisions in George Orwell's 1984?. The ones which
watched. you back? Which you could never get rid of, only the sound could
be turned. down?

Well. the country which brought Orwell into the world has made his
nightmare follow into the world after him. Since 1990 the. British have
been. waging war against one of their own citizens using surveillance to
invade privacy. and a campaign of abuse in the transmitted media in their
efforts to humiliate. their "victim".

I suppose "BBCs Hidden Shame" is more of a. wish than a fact. It may be
hidden, but. the BBC and other media and security organisations seem to
have no shame whatever in their anti-social, not to say. criminal,
actions. Nor do the general public, who. seem quite happy to parrot the
vilest obscenities without much hesitation. or apparently thought.

Martyn. Lewis, Nicholas Witchell and the rest

Most of the harassment occurred in. 1990-92, when I wasnt making any
recordings, and the BBC wont release copies. of current affairs programmes
from that period so although I can remember there were. many incidents
in that time, even many specifics, I cant dig up the actual programmes. to
flesh out the. bones.

This year, there has been at least. one incident with Nicholas Witchell as
newsreader, which. I have successfully recorded and digitized,
i.e. converted into a computer Quicktime movie file. This has not. yet
found its. way onto my website (Im a busy man, dontcha know) but you can be
sure I will. let the readership of these articles know when that clip makes
it onto the web. The Witchell clip was recorded on Saturday 10. April 1999
at. 7pm, and shows Witchell trying to restrain his features from collapsing
into a smirk. First his upper. lip quivers for several minutes, then with
the non-excuse of a non-joke his. entire face twists into a grin. It looks
as if he finds me so funny, that he allows. himself to submerge any
pretence. at professionalism in a sea of MI5-inspired sarcasm and
harassment.

The two. BBC newscasters whose reactions to me 

M.I'5`Pers ecution - Four Years of MI 5 Persecut ion Pos ts on Inter net Newsgrou ps

2007-12-26 Thread eivmvmvm

Four Years of. "MI5 Persecution" Posts on Internet Newsgroups

For approximately the first three. years of the MI5 persecution, from June
1990 until late 1992, I kept as quiet as possible, in. the hope that by not
reacting, MI5s interest in me would. decrease and they would simply go away
of their own accord. This is the sort of behaviour some. people employ
against bullies; if the bullies arent getting a reaction, then. they might
simply. go away and victimize someone else.

Unfortunately, this tactic didnt work. The quieter I. became, the more
shrill and hysterical the noise. from the Security Service operatives. For
about two years I didnt watch TV. news at all. Yet this only heightened
their obsessed fixation; they continued to. follow me wherever I went, they
continued to induce harassment at work. by managers and fellow workers, and
they continued to encourage me to commit suicide. They seemed to. regard my
refusal to react as a crime which they would have to "put right" by. ever
more. extreme forms of abuse.

Finally, in 1995, I changed tactics. radically. Since late 1994 I had had
accounts with. internet providers in Ontario, Canada. I discovered the
cornucopia of internet newsgroups,. on every topic from consumer
electronics, to politics and legal topics, and I discovered. online
services such as Compuserve and. AOL. In May 1995, I made the first posting
to the conspiracy newsgroup, on. the subject of "BBCs Hidden Shame".

BBC's Hidden. Shame

The internet newsgroup discussion, which has now reached. its fourth
anniversary, started with an article in alt.conspiracy,. which I reproduce
here.

Date: Thu May.  4 18:27:24 1995
Newsgroups:. alt.conspiracy
Subject:. BBC's Hidden Shame

Remember the. two-way televisions in George Orwell's 1984? The ones which 
watched you
back? Which you could never get rid of, only the sound could be. turned down?

Well the country which brought Orwell into the world has made his. nightmare 
follow into
the world after him.. Since 1990 the British have been waging war against one 
of their
own citizens using surveillance to invade privacy and a campaign of abuse in. 
the
transmitted media in. their efforts to humiliate their "victim".

And the most remarkable thing about it is that what. they do is not even 
illegal - the
UK has no laws to protect the privacy of its citizens, nor does. it proscribe 
harassment
or abuse. except in the case of racial abuse.

A lot of people in England know this to be going on, yet so far they have. 
maintained
perfect "omerta"; not a sound, not a squeak has. escaped into the English 
press, and for
all the covert harassment absolutely. nothing has come out into the public 
domain.

Have the British gone mad? I think we. should be told

At this point, I did not name. MI5 as my persecutors. I was still unsure
that they were the ones responsible for the. "psychological terrorism". In
followup posts however I did name them; and the persecutors have. never
denied the claim; so I think my guess is valid.. (The Security Service
Tribunal in 1997 have said "no determination in your favour was. made", but
it is a well. established fact that MI5 lies routinely to the Tribunal
which has never found in favour of a plaintiff, so no conclusions. can be
drawn from. this.)

This first post was made to alt.conspiracy, but further posts were. made to
the. UK-local newsgroups, in particular uk.misc but also uk.legal and
uk.politics (which is now called. uk.politics.misc). Some time ago I tried
to take the battle to. the Compuserve forums, UKPOLITICS (which is now
called UKCURRENT -. current affairs), but my articles were censored by the
forum operators. Such censorship is impossible on the internet. newsgroups.

Police Refuse to. Act

I have complained several times to the Metropolitan. Police, who have each
time. refused to help.

From: Green. <[EMAIL PROTECTED]>
Newsgroups:. uk.misc,uk.politics,alt.politics.british,soc.culture.british
Subject: Re: MI5 Persecution:. Why Aren't the British Police Doing Their
Job?
Reply-To:. [EMAIL PROTECTED]
Date: Sun Apr . 7 21:13:30 1996

In. article <[EMAIL PROTECTED]>
 .  [EMAIL PROTECTED] "Mike Corley" writes:

>Last Easter (1995) I went. into the local police station in London and spoke to
>an officer about the harassment against me. But I. couldn't provide tangible
>evidence; what people said, in many cases years ago,. is beyond proof, and
>without something to support my statements I cannot expect a. police officer to
>take. the complaint seriously.

This in itself dos not suggest that the. police have it in for you. The old bill
operates on extremely tight spending limits forced on them. by that pillock 
Michael
Howard, and without evidence,. they often have higher priorities than chasing 
something
that cannot go. to court.

I doubt that the police are actually being leant on, but they probably realise 
that. if
they looked into this, they would be leant on. hard. The met always stays away 
from
anything t

M`I'5.Persecuti on - MI 5 Waste Taxpay er Mil lions on Point less Hate-C ampaign

2007-12-26 Thread vfvfvefim

MI5 Persecution. Update: Friday 30 April, 1999

If You Intend To Reply, Please. Read This
Please keep your. response to one page!. Faxes over a page or two will
be. deleted without being read.

Somewhere between. 0 and 100%

The last few days there have been no clear. recordable instances of
abuse. However, while. travelling on the Underground, while walking around
near my home and going. to friends homes, I am constantly troubled by
thoughts that those people over there might be about to get at me;. that
the couple sitting in the opposite seats laughing are in fact. laughing at
me; et cetera, et. cetera.

A comment by a scientist to the. BSE inquiry sticks in my mind. He
described the. possible scale of the epidemic as "between 0% and 100%". It
might not be. happening, it might not happen at all, to any discernable
degree or it might. be total. Without clear recording, which seems to
have. become impossible the last couple of weeks, there is no way of
knowing whether the harassment really. is continuing, whether we have
entered a temporary hiatus,. or whether perhaps it has perhaps stopped for
now.

But. for the time being I think there arent any reasons to dicontinue these
faxes. I only. re-started them six weeks ago in response to a resumption of
MI5 harassment; and I think I will need to be more convinced. of absence of
persecution before. I discontinue my complaints.

The Newscasters are still. watching

In the last. few weeks there have been at least a couple of fairly overt
instances of "interactive watching" by newscasters. I reported. this in a
previous "MI5 Persecution. Update".

These instances are really very rare compared to 1990-91, when there. were
many dozens of such occurrences. Undoubtedly. the reduction is due to my
practice of videotaping everything I see. Recently I. had the opportunity
of showing this years "happenings" (Jon Snow/Nicholas Witchell). to my
psychiatrist, and he agreed. that in both cases the newscasters were
expressing merriment without visible cause, and that objectively it. might
be possible for my claims to. be true - although of course other people
reported similar thoughts to him, and this thinking. is usually a symptom
of. illness.

Read. About the MI5 Persecution on the World Wide Web

The March 1998 issue (number 42) of .net Magazine reviews. the website
describing it as an "excellent site". Since August 11, 1996. over 50,000
people have browsed this. website.

You are. encouraged to read the web pages which include

a FAQ (frequently asked questions) section outlining the. nature of the
persecutors, their methods of harassment. through the media, people at work
and among the general. public

an. evidence section, which carries audio and video clips of media and
workplace harassment,. rated according to how directly I think they refer to me

objective descriptions of the state. security agencies involved

scanned texts of the complaints I have made to media and state. security
agencies. involved

posts which have been. made to netnews over the last four years on this topic

Keith Hill MP (Labour - Streatham), my elected representative,. as ever
refuses to. help.

MI5 Waste Taxpayer. Millions on Pointless Hate-Campaign

Recently I was talking to an independent observer about the. nature and
purpose of the perceived campaign of. persecution against me. The person I
spoke to, a highly. intelligent man, said he was struck by the utter
pointlessness of the perceived campaign against. me. He also said that, if
my theories were in fact true, many. people would have to be involved, in
the. surveillance itself, and in the technical side of the delivery of
information from my home to TV studios. for example, if the "interactive
watching" were. happening as described. He voiced these thoughts without
any prompting from me; but both. I and other observers had arrived at
pretty much. the same conclusions, some years ago.

I saw a team of. four men at Toronto Airport in 1993

To carry out the surveillance alone, full-time, would employ four or. five
men, or. their equivalent in terms of man-hours. Each man would "work" an
eight-hour shift,. so you would need at least three men doing the
surveillance, plus. a connecting link / manager. An indicator that this
estimate is correct. arrived in 1993, when I was accosted by one of a group
of four men at Toronto Airport; he said, laughing, "if he tries to. run
away well find him". Plainly these. were the men who had been involved in
the intrusive surveillance of me for the preceding. three years.

On other occasions, I have seen the. same man on two or three occasions. On
one such. occasion, at Ottawas Civic Hospital in November 1996; he gave his
name to the doctor as "Alan Holdsworth" or. some such; my hearing is not
very good sometimes and. I am not sure of the surname, although I am sure
"Alan" was his first name. I saw exactly the. same man again in Ottawa, at
the airport,. in July 1998. Obviously, other people must be "

Re: Python for web...

2007-12-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit :
> Hi everyone,
> 
> I have to develop a web based enterprise application

"enterprise" ???

> for my final year
> project. Since i am interested in open source, i searched the net.
> Almost 90% of them were PHP and MySQL. Cant we use python for that ?

Well, I don't know if *you* can, but as far as I'm concerned, that what 
I do whenever possible !-)

> I
> tried several sites, but there is not enough tutorial for beginners
> [mod_python, PSP etc]. I couldnt find any detailed book, not even a
> single book :( All the python books are covering only CGI part)


Knowing CGI is certainly not the worst starting point wrt/ web 
development - I whish more PHP 'programmers' had the minimal 
understanding of the HTTP protocol required to write a CGI script (and 
any serious web app FWIW).

> Any suggestions? 

Django or Pylons are probably what you're looking for. The first one is 
the more mature, stable, and well documented, and the second one the 
most promising IMHO. If you're new to both web development and Python, 
I'd actually recommand Django.

> Any recommended book?

The HTTP 1.1 RFC !-)


> Execuse my English.

Seems fine to me - at least understandable, and that's the important 
point, isn't it ?-)

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


M I.5'Per secution Comparin g the MI 5 Pe rsecution wit h Ge rman Fin al So lution

2007-12-26 Thread ieivevem

MI5. Persecution Update: Friday 16 April, 1999

If You Intend To. Reply, Please Read This
Please. keep your response to one page!. Faxes over a page or two will
be deleted. without being read.

BBC newscaster Nicholas. Witchell cant stop himself laughing

During 1990-91 there were. very many instances of "interactive
television" where newscasters and other. TV presenters saw on a screen
before. them what was happening in my home, and reacted, frequently by
laughing at. me. During this period I unfortunately did not record these
programmes. For the last year or two, I. have been recording everything I
watch,. and there has been a drastic decrease in such incidents.

However, on occasion, television presenters do. still engage in
"interactive watching" and. react to what they see. This has been evident
with Jon Snow of Channel Four News recently - a particularly. interesting
case, since it has been established that he cannot. be corrupted by money
(it is well-documented that MI5 offered him a. tax-free salary and he
turned. them down). I wonder what device MI5 are using to encourage him to
do. the "interactive watching"?

On Saturday 10 April 1999. at 7pm, Nicholas Witchell on BBC2 News reacted
when he saw that. I was watching the programme, and I have his reactions
stored safely on. videotape. I have watched this tape several times and I
am entirely confident that my evaluation of his. reactions is correct. For
several minutes his upper lip quivered in mirth as. he attempted to keep a
straight face. Then finally his self-control evaporated through. the excuse
of a weak joke and. his face collapsed into a grin.

The strange thing is that I dont know why he was. laughing at me, what I
had done recently to "deserve" to be laughed at.. The MI5 persecutors
usually. manage to invent some justification as to why people should laugh
at and/or abuse me ("hes an X", "it was so funny" etc), so. Mr Witchell
could have been laughing for any number of reasons. Perhaps he found. the
views I have been expressing. in these articles amusing? I suppose if youre
paid enough money and ordered to. laugh then even the most innocuous thing
becomes. funny.

Jon Snow. of Channel Four News cant stop himself smirking, either.

On 12 February 1999 I was watching Channel Four. News presented by Jon
Snow.. As usual, I was recording the programme, so that if anything out of
the ordinary happened, Id be able to. go back and watch it again.

Now, Jon Snow, by his own claim, is. uncorruptible. He says he turned down
an offer of a substantial tax-free salary from MI5 -. they wanted to make
him their mouthpiece, and. he told them where to get off.

So you will be most. surprised to learn that Jon Snow "interactively
watched" me that evening, and. on many other evenings. Approximately
fifteen minutes into. the programme, he announced that the US President
would be making a live appearance at. about 7.30pm; I looked at the clock
on the mantelpiece;. and Snow saw me looking at the clock, and visibly
tried to suppress a. smirk.

Uncorruptible, are you, Mister Snow? If not money, then why. are you
watching me, Mister. Snow? Are they forcing you to watch me? Cant you turn
the monitor off,. Mister Snow?

Keith Hill MP (Labour - Streatham),. my elected representative, as ever
refuses. to help.

Comparing the MI5 Persecution with German. "Final Solution"

It might seem. offensive to compare the mass murder of millions of
civilians in wartime with the peacetime persecution of. merely one
person. Yet the comparison has. been coursing through my mind for several
years now, because the brutality of. German intent to "sub-humans" is very
much comparable to the brutality of British intent to. someone they
vituperate and term "not up to British standards". The methods may. differ,
but the persecutors mindset is. the same.

The. Germans first targeted the mentally disabled, too

During WW2 millions of ethnic Russians, Poles, Jews, mentally. ill, gypsies
and other minorities were. rounded up and murdered in purpose-built camps
by the German regime, in the name of "racial. superiority". Fifty years on,
the British Secret Police, MI5, instituted a campaign of. mass
hysteria; but in their cowardice,. limited their activities to one single
victim.

It is instructive to note that. the early German "cleansing" effort was
directed primarily not at Jews, but at the mentally ill. The. Nazis set up
the T4 project in the thirties to "cleanse" away 70,000 mentally. disabled
people, including schizophrenics and epileptics. After WW2. the Jews with
their media influence used the reaction from. the holocaust to roll back
anti-semitism in the Western countries; however, the. mentally ill are
today still. a persecuted group in the modern Western world as they were
under the Nazis (the current Jewish home secretary in the UK. intends to
bring in laws for incarceration without. any criminal charge for some
mentally ill people - he protects his own minority,. but does nothing

Re: how to generate html table from "table" data?

2007-12-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit :
> Hi group,
> I would like to convert the output of the SQL query, or more generally
> I would like to convert any "table" data to the html table.

There's MoreThanOneWayToDoIt... from simple string formatting to a 
full-blown template engine.

> I would like to set some rules to format cells, columns or rows (font,
> colour etc.) of the html table, according to the values in the
> specific cells.


Markup should only convey semantic informations - presentation is best 
done using css. IOW : presentation-related stuff in the html should be 
restricted to css class declarations.


> Googling for a while I have found only this tool:
> http://pasko.net/PyHtmlTable/
> 
> Your tips to some other tools or/and your suggestion how to solve
> above mentioned will be very helpful.

As I said, wrt/ html generation, there are quite a lot of possible 
solutions - FWIW, generating an html table from a set of tabular data is 
nothing difficult. So without more information on the context, it's hard 
to give any valuable advice. Are you doing a web application ? If yes, 
you should already use a template engine, so just use it. Else, why is 
your application generating html at all ?
-- 
http://mail.python.org/mailman/listinfo/python-list