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

Displaying contents of a file using PyWin

How do I display the contents of a file in a window using PyWin?

Thanks,

MS

Dec 21 '06 #1
4 1502

import win32ui
from pywin.mfc import docview

t = object_template()
d = t.OpenDocumentFile("d:/temp/music.log", True)

Crashes PythonWin

Dec 21 '06 #2
In <11**********************@79g2000cws.googlegroups. com>, MiguelS wrote:
import win32ui
from pywin.mfc import docview

t = object_template()
d = t.OpenDocumentFile("d:/temp/music.log", True)

Crashes PythonWin
What do you mean by `crashes`? Any chance you get a name error like::

NameError: name 'object_template' is not defined

?

Ciao,
Marc 'BlackJack' Rintsch
Dec 21 '06 #3
Sorry, the code I posted was wrong. I tried
import win32ui
from pywin.mfc import docview

t = docview.DocTemplate()
t.OpenDocumentFile("d:/temp/music.log", True)

This caused windows to close PythonWin.

Dec 21 '06 #4
[Forwarded from python-list@...]

At Thursday 21/12/2006 13:51, MiguelS wrote:
>import win32ui
from pywin.mfc import docview

t = docview.DocTemplate()
t.OpenDocumentFile("d:/temp/music.log", True)

This caused windows to close PythonWin.
This appears to be a problem with pywin32.
Using release 209 for Python 2.4 I get an Access Violation.

Also I've noticed that this idiom:

try:
win32ui.GetApp().RemoveDocTemplate(template)
except NameError:
# haven't run this before - that's ok
pass

doesn't work anymore because RemoveDocTemplate raises a different
exception now.
--
Gabriel Genellina
Softlab SRL


__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Dec 22 '06 #5

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

Similar topics

1
by: Henrik Weber | last post by:
Hi. I have tried to add pychecker as an extension to pythonwin. Now I can have pychecker check the source file that is currently open in the editor with a single keypress. If someone is...
1
by: semi | last post by:
Hello, I am using VS C++ to make a gui that displays a text file contents from main dialog. So I created main dialog and another dialog for text file viewer. From the main dialog, I call text...
13
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any...
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
2
by: shakthi | last post by:
Hi all, Got good response and solution for my previous posts.Thanks a lot to sudhir and sivadass.Now i have one more doubt.I WANT TO DISPLAY THE CONTENTS OF A FILE THAT IS PLACED IN AN...
0
bartonc
by: bartonc | last post by:
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
1
by: jld730 | last post by:
Hello All, I have a fairly simple script that runs fine, does what it is supposed to do, but generally on the second run (after running fine again) it throws the following error: *** Traceback...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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...

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.