ANN: Intro to Python course, Aug 16-18, San Francisco

2006-07-05 Thread w chun
What:   (Intense) Intro to Python
When:  August 16-18, 2006
Where: San Francisco (SFO/San Bruno), CA, USA
Web:http://cyberwebconsulting.com (click "Python Training" link)

Need to get up-to-speed with Python as quickly as possible?  Come join
us in beautiful Northern California for another one of our rigorous
Python training events! This is an intense introduction to Python
programming geared towards those who have some proficiency in another
high-level language. Topics include:

* Syntax, Data Types, Operators, and Methods
* Python's Objects and Memory Model
* Errors and Exception Handling
* Flow Control (Loops and Conditionals)
* Writing Optimized Python
* Files and Input/Output
* Functions and Functional Programming Aspects
* Modules and Packages
* OOP: Classes, Methods, Instances, Class Customization, Inheritance
* Execution Environment
* Operating System Interface
* Advanced Topics and Python Updates

This course will take place in San Bruno right near the San Francisco
International Airport at the:

Staybridge Suites
San Francisco Airport
1350 Huntington Ave
San Bruno, CA  94066 USA
+1-650-588-0770

LOCALS: easy freeway (101/280/380) and public transit (BART and
CalTrain) access: San Bruno stations

VISITORS: free shuttle to/from the airport, free high-speed internet
cxn, free breakfast and evening reception daily

The cost is $1095 per attendee.  Discounts are available for multiple
registrations as well as teachers/students and those with financial
hardship.  For more information and registration, go to the website
above.

Registration is also now open for our next Advanced Python course,
taking place at the same location in November 2006. See website for
more details.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyuno and PDF output

2006-06-30 Thread w chun
On 6/23/06, w chun <[EMAIL PROTECTED]> wrote:
>
> 2. use the short form to instantiate a PropertyValue
>
> REPLACE:
> PDF = PropertyValue("FilterName", 0, "writer_pdf_Export", 0)
> WITH:
> PDF = PropertyValue("FilterName", "writer_pdf_Export")

after trying this again, i discovered that this fails too.  the only
thing that worked for me was doing it the "manual" way:

pdf = PropertyValue()
pdf.Name = 'FilterName'
pdf.Value = 'writer_pdf_Export'

furthermore, if you need to specify multiple properties, then
virtually duplicating these three lines up and down your code starts
to get old:

hdn = PropertyValue()
hdn.Name = 'Hidden'
hdn.Value = True

pdf = PropertyValue()
pdf.Name = 'FilterName'
pdf.Value = 'writer_pdf_Export'

ow = PropertyValue()
ow.Name = 'Overwrite'
ow.Value = True

you can slightly improve on this with something like:

props = [PropertyValue() for i in range(nprops)]
props[0].Name = 'FilterName'
props[0].Value = 'writer_pdf_Export'
props[1].Name = 'Overwrite'
props[1].Value = True
props[2].Name = 'Hidden'
props[2].Value = True

instead, i put this all into a function, and it helped clean things up a bit:

def makePropVal(x, y=True):
pv = PropertyValue()
pv.Name = x
pv.Value = y
return pv

hdn = makePropVal('Hidden')
pdf = makePropVal('FilterName', FTYPES[ftype])
ow = makePropVal('Overwrite')


> 3. use storeToURL() as opposed to storeAsURL()
>
> REPLACE:
> doc2.storeAsURL("file:///C:/alleclipse/OpenOffice/test2.pdf", (PDF,))
>
> WITH:
> doc2.storeToURL(unohelper.absolutize(
> 
> unohelper.systemPathToFileUrl('C:/alleclipse/OpenOffice/test2.pdf'),
> unohelper.systemPathToFileUrl('test2.pdf')), (PDF,))

correction (should be dir path as 1st arg):

unohelper.systemPathToFileUrl('C:/alleclipse/OpenOffice'),
 unohelper.systemPathToFileUrl('test2.pdf')), (PDF,))

-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyuno and PDF output

2006-06-23 Thread w chun
> Subject: pyuno and PDF output
> From: "Sells, Fred" 
> Date: Thu May 4 19:20:57 CEST 2006
>
> I can use java to output a PDF file using uno, but when I try to do it in
> python, I get an IO Exception with no added information.   The relevant code
> snippet follows:
>
> from com.sun.star.beans import PropertyValue
> PDF= PropertyValue( "FilterName" , 0 , "writer_pdf_Export", 0 )
> doc2.storeAsURL("file:///C:/alleclipse/OpenOffice/test2.pdf", (PDF,) )
>
> if I don't specify any properties, it writes an "odt" file just fine, but
> when I specify (PDF,) it breaks.
>
> Traceback (most recent call last):
>   File "oomerge.py", line 137, in ?
> test1()
>   File "oomerge.py", line 74, in test1
> doc2.storeAsURL("file:///C:/alleclipse/OpenOffice/test2.pdf", (PDF,) )
> __main__.com.sun.star.task.ErrorCodeIOException


fred,

(man, i hate seeing that error too... it gets old *fast*.)
a couple of suggestions here:

1. use unohelper with filenames (see #3 below)
import unohelper

2. use the short form to instantiate a PropertyValue

REPLACE:
PDF = PropertyValue("FilterName", 0, "writer_pdf_Export", 0)

WITH:
PDF = PropertyValue("FilterName", "writer_pdf_Export")

3. use storeToURL() as opposed to storeAsURL()

REPLACE:
doc2.storeAsURL("file:///C:/alleclipse/OpenOffice/test2.pdf", (PDF,))

WITH:
doc2.storeToURL(unohelper.absolutize(
unohelper.systemPathToFileUrl('C:/alleclipse/OpenOffice/test2.pdf'),
unohelper.systemPathToFileUrl('test2.pdf')), (PDF,))

let us know how/if/whether this works.

HTH,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyuno and oootools with OpenOffice 2.0

2006-06-23 Thread w chun
> Subject: pyuno and oootools with OpenOffice 2.0
> From: "Sells, Fred" 
> Date: Thu May 4 17:37:35 CEST 2006
>
> I'm using windows xp and OpenOffice 2.0 and doing my first project with
> pyuno.
>
> I've got the basics to work,.  An example I googled at
> http://blogs.nuxeo.com/sections/aggregators/openoffice_org/blogaggregator_view?b_start:int=0
> imported an ootools module.  When I try to import it, it does not exist,
>
> Does anyone know where this exists, or why I cannot import it.


the oootools.py module is referenced in this blog entry:

http://blogs.nuxeo.com/sections/blogs/laurent_godard/2006_04_13_testing-pyuno-programs-with-doctests

the direct link to download this file is:

http://blogs.nuxeo.com/sections/blogs/laurent_godard/2006_04_13_testing-pyuno-programs-with-doctests/downloadFile/attachedFile_1_f0/oootools.py

HTH,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OpenOffice UNO export PDF help needed

2006-06-23 Thread w chun
> > Subject: OpenOffice UNO export PDF help needed
> > From: "Sells, Fred" 
> > Date: Sun Apr 30 04:17:43 CEST 2006
> >
> > I've geen googling for 3 days now, and cannot find out how to do this.
> >
> > I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents.  I'm
> > using windows, but will have to make it work under Linux for production.
> > I've been able to set the parameters and call the exportToPdf method, but
> > the exported file is not PDF but an .odt document,
> > :
> > below is a java code snippet, submitted with apologies,  I'm using that
> > rather than python because I found better examples and my java IDE helps me
> > out.  I originally started out to do python, and will eventually shift back
> > to it once I get this working
>
>
> Subject: OpenOffice UNO export PDF help needed
> From: "Michele Petrazzo" 
> Date: Mon May 1 11:37:07 CEST 2006
>
> Have you tried the ooextract.py found on:
> http://udk.openoffice.org/python/python-bridge.html
>
> Here work well and generate a pdf file.
>
> See also this for more info about generate pdf:
> http://mithrandr.moria.org/blog/447.html


fred,

have you had any luck with either your Java or Python code?
did you take a look at the code that Michele had suggested?

please post your progress or any errors you encounter as
others on the list are interested too.

what version of OOo are you using?

thanks,
-wesley

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Error with OpenOffice

2006-06-23 Thread w chun
> Subject: Error with OpenOffice
> From: "Mario Lacunza" 
> Date: Thu Apr 20 06:30:19 CEST 2006
>
> I try to make the exercises found in Ooo website but I receipt this
> error:
>
> mario at laptop:~$ python
> Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
> [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import uno
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/lib/python2.4/site-packages/uno.py", line 37, in ?
> import pyuno
> SystemError: dynamic module not initialized properly
>
> Any idea??
>
> Mi configuracion/My config:
>
> Ubuntu Breezy 5.10
> Linux Kernel 2.6.12-10-386
> Python 2.4.2
> wxPython 2.6.1.1Pre
> OpenOffice 2.0.1


hola mario,

of the software you listed above, did you manually compile any?
i am using the exact same release as you:

Ubuntu Breezy 5.10
Linux Kernel 2.6.12-10-386
Python 2.4.2

the only difference is that i'm using OpenOffice2 version 1.9.129.
i have not loaded wxPython yet, but all of the software listed was
installed as Ubuntu packages (not hand-built).

i am able to do this:

$ python
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
>>> import sys
>>>
>>> sys.modules['uno']

>>>
>>> sys.modules['pyuno']


-wesley

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Advanced Python training, May 17-19, San Francisco

2006-05-03 Thread w chun
FINAL REMINDER... we still have some seats left!

What:   Advanced Python Programming
When:   May 17-19, 2006
Where:  San Francisco (SFO/San Bruno), CA, USA

http://cyberwebconsulting.com (click on "Python Training")

This course, meant to follow our in-depth introduction class,
adds new tools to the Python programmer's toolkit. We explore
advanced topics such as: sockets, Internet clients, GUIs with
Tkinter, Web/CGI, databases/SQL, XML, Extending Python with C,
threads, etc. We provide lectures, code samples, and some exer-
cises to get attendees comfortable developing applications
with Python in these disciplines. We are proud to be the only
ones offering Python training in such advanced topics.

Come join us in beautiful Northern California for another
rigorous Python training event taught by software engineer,
"Core Python Programming" author, and technical instructor,
Wesley Chun.  This is an introduction to Python in various
areas of advanced topics geared towards those who have some
programming experience in Python (any implemention, plat-
form, or architecture).

This course will take place in San Bruno right near the
San Francisco International Airport at the:

Staybridge Suites
San Francisco Airport
1350 Huntington Ave
San Bruno, CA  94066 USA
+1-650-588-0770

LOCALS: it'll be at a hotel with easy 101/280/380, BART and
CalTrain access (San Bruno stations)

VISITORS: free shuttle directly from the San Francisco
airport, lots of free food and wireless

The cost is $1295 per attendee.  Discounts are available
for multiple registrations as well as teachers/students
and those with financial hardship.  For more information
and registration, go to the website above.
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem w/Tkinter on 2.5 (Panther)

2006-03-28 Thread w chun
i've built a Python 2.5a0 interpreter on my iBook using gcc 3.3-1666
using the tarball from last nite...

$ uname -a
Darwin myMac.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30
20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC  Power
Macintosh powerpc
$
$ python
Python 2.5a0 (trunk, Mar 28 2006, 02:53:21)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D

it has a particular symptom with Tkinter where if i run the
interactive interpreter, "import Tkinter", etc., things work great...
i can bring up and create Tk objects which work as expected using
XDarwin 1.3.0/XFree86 4.4.0, BUT when i try to run anything as a
script, even the 1-liner: "import _tkinter", it bombs out with a Bus
Error.  here is the output in GDB:

$ gdb /usr/local/bin/python2.5
GNU gdb 5.3-20030128 (Apple version gdb-330.1) (Fri Jul 16 21:42:28 GMT 2004)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries .. done
(gdb) set args tk-test.py
(gdb) run
Starting program: /usr/local/bin/python2.5 tk-test.py
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x901c5118 in __CFStringCreateImmutableFunnel3 ()
(gdb)

has anyone else seen this error before?  the script (obviously) works
using earlier versions of Python.  i have Tcl/Tk 8.4 on my system and
have T{CL,K}_LIBRARY pointed at the right place(s) when i built my 2.5
interpreter.

thanks,
-wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: 2006 Python training courses, San Francisco

2006-03-07 Thread w chun
WE are giving 4 more Python training sessions (held near the San
Francisco airport) for the remainder of this year.

For the first time, there will be an "advanced" Python course
available to the public.  In fact, we've added the March intro course
date for those prepping to take the advanced class in May.  You may
register for any of the 4 courses/dates below.

(Intensive) Introduction to Python
March 29-31, 2006
August 16-18, 2006

Advanced Python Programming
May 17-19, 2006
November 8-10, 2006

LOCALS: it'll be at a hotel with BART and CalTrain access (San Bruno stations)

VISITORS: free shuttle directly from the San Francisco airport, lots
of free food and wireless

DISCOUNTS available. for more info and details, go to
http://cyberwebconsulting.com and click "Python training."

cheers,
-wesley

ps. a great big public THANKS to Rob Stephenson for putting together
the short PodCast clip of one of our training sessions for your
viewing pleasure on a video iPod or iTunes on your Mac!

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2006,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Python training, 2006 Feb 1-3, San Francisco

2006-01-11 Thread w chun
as promised, this is the FINAL reminder i'll send out about our
upcoming Python course at the beginning of February.  (Feb 1-3, 9a-5p
PT)

 it'll be at a hotel with BART and CalTrain access (San Bruno
stations) for those already in the Bay Area, and for those coming in
from out-of-town, there's a free shuttle directly from the San
Francisco airport, which is only about 2-3 miles away.

discounts available for multiple registrants as well as students,
teachers, and those with financial hardship.  also, there is a
follow-on "advanced" course coming up in May.  more details at
http://cyberwebconsulting.com

hope to see you soon!
-wesley


On 12/7/05, w chun <[EMAIL PROTECTED]> wrote:
> What:   Python Programming I: Introduction to Python
> When:   February 1-3, 2006
> Where:  San Francisco, CA, USA
> Web:http://cyberwebconsulting.com
>
> Need to get up-to-speed with Python as quickly as possible?  Come join
> us in beautiful Northern California for another rigorous Python
> training event taught by software engineer, "Core Python Programming"
> author, and technical instructor Wesley Chun.
>
> This is an intense introduction to Python programming geared towards
> those who have some proficiency in another high-level language.
> Topics include:
>
> * Syntax, Data Types, Operators, and Methods
> * Python's Objects and Memory Model
> * Errors and Exception Handling
> * Flow Control (Loops and Conditionals)
> * Writing Optimized Python
> * Files and Input/Output
> * Functions and Functional Programming Aspects
> * Modules and Packages
> * OOP: Classes, Methods, and Class Instances
> * OOP: Class Customization, Inheritance
> * Execution Environment
> * Operating System Interface
> * Advanced Topics and Python Updates
>
> This course will take place near the San Francisco International Airport at 
> the:
>
> Staybridge Suites
> San Francisco Airport
> 1350 Huntington Ave
> San Bruno, CA  94066 USA
> +1-650-588-0770
>
> VISITORS: free transportation to/from the San Francisco International airport
> LOCALS and VISITORS:  easy access to public transit (BART [across the
> street!], CalTrain, SamTrans) can help you get all over the San
> Francisco Bay Area
>
> Discounts are available for multiple registrations as well as
> teachers/students.  For more information and registration, go to
> http://cyberwebconsulting.com and click on the "Python Training" link.
>  Unlike previous courses, we are limiting enrollment to a maximum of
> 15 attendees.  If you have any questions, feel free to contact us at
> cyberweb-at-rocketmail.com.
>
> For those who are interested in more "advanced" Python topics, we will
> be offering a follow-on course late Spring 2006 (most likely May).
> Also, if there is sufficient interest, we may hold another one of
> these "Intro to Python" courses down in Silicon Valley in April;
> contact me directly if you're interested in this location.
>
> Note: i will only send out ONE MORE REMINDER in January... yeah, i
> don't like spam either. :-)
>
> cheers,
> -- wesley
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> "Core Python Programming", Prentice Hall, (c)2006,2001
> http://corepython.com
>
> wesley.j.chun :: wescpy-at-gmail.com
> cyberweb.consulting : silicon valley, ca
> http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Python training, 2006 Feb 1-3, San Francisco

2005-12-07 Thread w chun
What:   Python Programming I: Introduction to Python
When:   February 1-3, 2006
Where:  San Francisco, CA, USA
Web:http://cyberwebconsulting.com

Need to get up-to-speed with Python as quickly as possible?  Come join
us in beautiful Northern California for another rigorous Python
training event taught by software engineer, "Core Python Programming"
author, and technical instructor Wesley Chun.

This is an intense introduction to Python programming geared towards
those who have some proficiency in another high-level language. Topics
include:

* Syntax, Data Types, Operators, and Methods
* Python's Objects and Memory Model
* Errors and Exception Handling
* Flow Control (Loops and Conditionals)
* Writing Optimized Python
* Files and Input/Output
* Functions and Functional Programming Aspects
* Modules and Packages
* OOP: Classes, Methods, and Class Instances
* OOP: Class Customization, Inheritance
* Execution Environment
* Operating System Interface
* Advanced Topics and Python Updates

This course will take place near the San Francisco International Airport at the:

Staybridge Suites
San Francisco Airport
1350 Huntington Ave
San Bruno, CA  94066 USA
+1-650-588-0770

VISITORS: free transportation to/from the San Francisco International airport
LOCALS and VISITORS:  easy access to public transit (BART [across the
street!], CalTrain, SamTrans) can help you get all over the San
Francisco Bay Area

Discounts are available for multiple registrations as well as
teachers/students.  For more information and registration, go to
http://cyberwebconsulting.com and click on the "Python Training" link.
Unlike previous courses, we are limiting enrollment to a maximum of 15
attendees.  If you have any questions, feel free to contact us at
cyberweb-at-rocketmail.com.

For those who are interested in more "advanced" Python topics,
we'reoffering a follow-on course late Spring 2006 (most likely May). 
Also, if there is sufficient interest, we may hold another one of
these "Intro to Python" courses down in Silicon Valley in April;
contact me directly if you're interested in this location.

Note: i will only send out ONE MORE REMINDER in January... yeah, i
don't like spam either. :-)

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2006,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-- 
http://mail.python.org/mailman/listinfo/python-list