473,383 Members | 1,929 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,383 software developers and data experts.

How can I use python to execute files through other programs?

My objective is a Python program which ultimately creates a PDF.

Presently, my program takes in a .csv file and creates a .tex file. Using cygwin, I can take a .tex file and convert it to .pdf in this manner:

$ latex example.tex && dvipdf example.dvi example.pdf

[LaTEX is an open-source computer typesetting language. The first part of the command generates a .dvi from the .tex. "dvipdf" converts the .dvi to a .pdf]

So is there a good, simple way of doing this? Thanks.
~Jesse, Houston TX
Mar 27 '07 #1
6 4748
bartonc
6,596 Expert 4TB
My objective is a Python program which ultimately creates a PDF.

Presently, my program takes in a .csv file and creates a .tex file. Using cygwin, I can take a .tex file and convert it to .pdf in this manner:

$ latex example.tex && dvipdf example.dvi example.pdf

[LaTEX is an open-source computer typesetting language. The first part of the command generates a .dvi from the .tex. "dvipdf" converts the .dvi to a .pdf]

So is there a good, simple way of doing this? Thanks.
~Jesse, Houston TX
Hello and welcome to the Python Forum on TheScripts.com.

LaTex is also available for python. Some documentation is here.

There is also a cool-looking project called PyTex.

Hope that gets you pointed in the right direction.
Mar 27 '07 #2
Hello and welcome to the Python Forum on TheScripts.com.

LaTex is also available for python. Some documentation is here.

There is also a cool-looking project called PyTex.

Hope that gets you pointed in the right direction.
Thank you for your promptness, but, as far as I can tell, these are both dead ends. Here's what I found...

The first link is for assistance in documenting python files, for which process (I'm told) many users often employ LaTEX. Presented here, related to LaTEX, is only a very basic overview of how LaTEX works. A comprehensive understanding of LaTex can be gained from Kopka/Daly's "Guide to LaTEX".

The second link directs to two projects in the early stages of development: QaTEX and PyTEX. The PyTEX download claims to work for style files but contains only something called 'catalog' which appears to note how to "stay archival and manage change" and which also mentions a few of the ambitions for later versions. I don't even know what to say about QaTEX. If this version does anything, I haven't discovered how. It's newborn though, and surely doesn't do all they'd like it to (Noting that it doesn't work with windows yet and in the qatex.py file there's this handy comment: "# this does not work - need to change def'n of link fn") attempting to use latex to open the provided sample file gave me an error I'd never seen:

$ qatex nestA.tex
bash: qatex: command not found
$ latex nestA.tex
.
.
.
!Q=qalib.qatex.import,qalib
!A=
^cursor here, waiting for input.
Mar 27 '07 #3
I'll try to be more specific... I'm very new to technical forums, so asking the right question is decidedly tricky.

Do you know of commands or code segments available in python to call up other programs?

I've successfully used python to create the proper LaTEX file. Now I want it to call LaTEX on it's own to generate the .dvi file, then take that file and convert it to PDF. Surely there's a way.

Thank you all again for any help you can provide.
~Jesse
Mar 27 '07 #4
bartonc
6,596 Expert 4TB
I'll try to be more specific... I'm very new to technical forums, so asking the right question is decidedly tricky.

Do you know of commands or code segments available in python to call up other programs?

I've successfully used python to create the proper LaTEX file. Now I want it to call LaTEX on it's own to generate the .dvi file, then take that file and convert it to PDF. Surely there's a way.

Thank you all again for any help you can provide.
~Jesse
On Windows you can
Expand|Select|Wrap|Line Numbers
  1. import os
  2. os.startfile('thefilename.ext')
If there is a program associated with .ext, Python will start that program with that file.

Generally, though, you want to automate the process. In order to do that the program must be COM aware and you'll need to learn about win32.comclient.
Mar 27 '07 #5
I think I may have found what I needed within the os.system.
Mar 27 '07 #6
ghostdog74
511 Expert 256MB
I think I may have found what I needed within the os.system.
for creating pdf files, you can try reportlab.
Mar 28 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Maboroshi | last post by:
Hi I am fairly new to programming but not as such that I am a total beginner From what I understand C and C++ are faster languages than Python. Is this because of Pythons ability to operate on...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
35
by: Michael Kearns | last post by:
I've been using python to write a simple 'launcher' for one of our Java applications for quite a while now. I recently updated it to use python 2.4, and all seemed well. Today, one of my...
2
by: timdoyle05 | last post by:
Hi, I have a question relating to how Unix commands can be issued from Python programs. Im am currently writing a large test script in python and I need this script to call three other separate...
2
by: Kenneth McDonald | last post by:
I'm not trying to persuade my company to offer Python as a scripting language for their product, but I am trying to give them examples of things that Python can do easily that cannot be done easily...
118
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
7
by: Brian Erhard | last post by:
I am still fairly new to python and wanted to attempt a home made password protection program. There are files that I carry on a USB flash drive that I would like to password protect. ...
5
by: ivarnelispam | last post by:
Hello all, I'm starting work on what is going to become a fairly substantial Python project, and I'm trying to find the best way to organize everything. The project will consist of: - A few...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.