473,700 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1513

import win32ui
from pywin.mfc import docview

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

Crashes PythonWin

Dec 21 '06 #2
In <11************ **********@79g2 000cws.googlegr oups.com>, MiguelS wrote:
import win32ui
from pywin.mfc import docview

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

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

NameError: name 'object_templat e' 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.DocTemp late()
t.OpenDocumentF ile("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.DocTemp late()
t.OpenDocument File("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( ).RemoveDocTemp late(template)
except NameError:
# haven't run this before - that's ok
pass

doesn't work anymore because RemoveDocTempla te 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
2188
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 interested, here is how to do it: Create an empty file in your <pythondir>\Lib\site-packages\Pythonwin\pywin directory. Give it a name with .cfg as extension.
1
1849
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 file viewer dialog(ViewDialog) when button is pressed. I added edit control(called IDC_EDIT1) and its control variable(my_edit). How do I display the text file contents in this? In ViewDialog::ViewDialog, I get the contents of the text file
13
3605
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 grid control. I tried many grid controls (DBGrid, DataGrid, MSFlexGrid), the ADO Data Control and everything I can think of, with no success. Here are the contraints I faced: (1) Populating any of the grid controls manually is too slow for my...
5
7849
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 COM control (like Microsoft WebBrowser). For each description there is one HTML file and along description text, it contains links to related information. Clicking related information would for example open new form in application and display some...
2
4347
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 displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
2
2039
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 EDITCONTROL..I tried using CArchive.Am able to open my file by using Open() function but cant display its contents.plzzz guide me with the correct format.PLEASE HELP ME WITH THE CORRECT CODE.Sorry if my question is soo silly. Thank you all in advance!!...
0
13468
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 to search hi and lo for the example of how to exclude Tkinter. Coming soon: scipy includes and numpy include that gets rid of complaints of missing modules that are fantom errors. # Py2Exe version 6.3 setup file for wxPython GUI programs. #...
38
5068
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
2272
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 (most recent call last): File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 341, in OnFileRun scriptutils.RunScript(None, None, showDlg) File...
0
8731
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9218
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9081
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8929
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5904
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2031
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.