473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Compile Cheetah Template on Windows

Newbie here....

I have been able to successful pull info from a MySQL DB, get the
results and output them in an HTML format using Cheetah to the screen
using IDLE. I am doing this on a Windows Laptop, running WinXP,
Python 2.5 and the latest version of Cheetah.

I have two questions:
1. How and where do you compile Cheetah templates in Windows? The
command in the docs is cheetah compile a, however, I believe that this
is for Linux. This does nothing in a DOS Prompt. Please provide the
info for this command in Windows.

2. How do I output the HTML to a file? I tried the following:

FILE = open(filename, "wt")
FILE.writelines(output)
FILE.close()

I get an error though that states that writelines() requires an
interable argument

Thnx for any assistance!

B

Nov 24 '07 #1
1 3057
brianrpsgt1 <br*******@cox.netwrote:
>
I have been able to successful pull info from a MySQL DB, get the
results and output them in an HTML format using Cheetah to the screen
using IDLE. I am doing this on a Windows Laptop, running WinXP,
Python 2.5 and the latest version of Cheetah.

I have two questions:
1. How and where do you compile Cheetah templates in Windows? The
command in the docs is cheetah compile a, however, I believe that this
is for Linux. This does nothing in a DOS Prompt. Please provide the
info for this command in Windows.
The Cheetah installation should have created scripts called "cheetah" and
"cheetah-compile" in your Python25\Scripts directory. The issue you have
is that they aren't on your path.

One answer is to copy Python25\Scripts\cheetah to \Windows\cheetah.py and
Python25\Scripts\cheetah-compile to \Windows\cheetah-compile.py. Then you
can type "cheetah.py compile xxx" or "cheetah-compile.py xxx".

However, you don't have to compile them in advance. You can do "from
Cheetah.Template import Template" and compile them on the fly, with
tmpl = Template( file='page.tmpl' )
>2. How do I output the HTML to a file? I tried the following:

FILE = open(filename, "wt")
FILE.writelines(output)
FILE.close()

I get an error though that states that writelines() requires an
interable argument
Just use FILE.write( output ).
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike Grigorov | last post by:
I am using cheetah with jython 2.1 and I have problem generating templates that contain cyrillic text. Some texts are printed OK and others are not. I searched Jython and cheetah projects mailing...
0
by: Thomas | last post by:
Hi, i have a webserver with (approx.) the code below, but whatever i do the html code sent to the browser stays the same. The strangest is, if i insert a local variable in the class which is...
13
by: Charlotte | last post by:
I am developing a web application and am looking for the best framework to do this in. I know this is an old question, and I have read the list archives and a couple of comparison pages on the web....
3
by: wolfgang.lipp | last post by:
hi, yesterday i started with web.py / flup / cheetah, and managed to get a first webpage to diaplay on my windows box running apache. unfortunately, the following code import web urls = (
0
by: ajay.padala | last post by:
Hi I would like to be able to get the inputs that are needed into a template file programmatically. For example if we had a template: ===================== $name has $num marbles in his...
1
by: chun ping wang | last post by:
I am having trouble using cheetah and getting it to work the way i want (mvc) I have the following file. index.py : # imports BibleController and setting. BibleController.py that includes...
4
by: Paolo Pantaleo | last post by:
I have a cheetah template something like this: x is: $x y is: $y z is: $z If for example $y is not defined I get an exception and the parsing of the template stops. Is there any way to...
2
by: Sai Krishna M | last post by:
Hi, I have been working for some time developing web pages using python, modpython, cheetah. I find that this method has come inherent difficulties in it like if we want to generate a single...
0
by: manuel.reil | last post by:
Hello, currently i am developing a very small cms using python and cheetah. very early i have noticed that i was lacking the method to extract/recover the contents (html,text) from the html that...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.