473,587 Members | 2,495 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?



Dec 21 '06 #1
4 1509

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


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:

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

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!

Dec 22 '06 #5

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

Similar topics

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.
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
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...
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...
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...
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!!...
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. #...
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.
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...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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...
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,...
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...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.