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

Opening a file with system default application

I'm writing a GUI application in Jython which takes a database text
file and performs some operations on the data, finally spitting out a
group of CSV files.

I generate a log file and several CSV files and I thought it would be
helpful if I could add a button the user could click on to
automatically launch the log file or the CSV output files using the
default text editor / spreadsheet editor on their system.

Does Python (or Java, since I'm using jython) have a clean cut way to
do this?

Jun 23 '06 #1
6 6139
don't know Jython, but in Python, I think you want:

import os

os.system('mytextfile.txt')

Whatever file you reference should open in the application associated
with it. At least that's the way it works on Win XP

rd

Jun 23 '06 #2
BartlebyScrivener wrote:
don't know Jython, but in Python, I think you want:

import os

os.system('mytextfile.txt')

Whatever file you reference should open in the application associated
with it. At least that's the way it works on Win XP

rd


I didn't think about that. It would probably break like mad under *nix
that fine. This will solve my issue.

Thanks =-)

Even still, does anyone know if there is a more platform indepedent way
to do this?

Jun 23 '06 #3
>> It would probably break like mad under *nix

I bet it would work the same way on linux or os x; it's the equivalent
of double-clicking on the file.

rd

Jun 23 '06 #4
In <11**********************@i40g2000cwc.googlegroups .com>,
BartlebyScrivener wrote:
It would probably break like mad under *nix


I bet it would work the same way on linux or os x; it's the equivalent
of double-clicking on the file.


No it doesn't work. Double clicking is not an OS thing but a a GUI thing.

Ciao,
Marc 'BlackJack' Rintsch
Jun 23 '06 #5
In article <pa****************************@gmx.net>,
Marc 'BlackJack' Rintsch <bj****@gmx.net> wrote:
In <11**********************@i40g2000cwc.googlegroups .com>,
BartlebyScrivener wrote:
It would probably break like mad under *nix


I bet it would work the same way on linux or os x; it's the equivalent
of double-clicking on the file.


No it doesn't work. Double clicking is not an OS thing but a a GUI thing.

Jun 23 '06 #6
>>> That also pops up a command shell window, which may not be
desirable. On Windows, there is os.startfile("someknown.type")


Ack. You're right. I get them mixed up. And os.startfile is Windows
only.

Sorry.

rd

Jun 23 '06 #7

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

Similar topics

5
by: Vinay | last post by:
Hi I have a corrupt word file. I am able to open it with the code given below tr Dim pInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo( pInfo.UseShellExecute...
44
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
5
by: Brad | last post by:
In several aspx applications I export crytal reports to pdf, xls and doc files and then the aspx page writes the selected export file to the client browser. This all works with one small quirk: ...
16
by: iwdu15 | last post by:
how can i open a file i saved and place the info into different text boxes?
4
by: Pieter | last post by:
Hi, From my VB.NET 2005 application I need to be able to open Files an Directory's with their default application: - A word-doc must open in word - A excell-document in Excel etc - in case...
2
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take...
4
by: Guern1 | last post by:
Hi Need a bit of help here please to point me in the right direction. I have a java class file here which i wish from a menu item to open a web page which contains a help page. ] } else...
7
by: Abhi | last post by:
Hi, I want to open a File with unknown Extension using C#. What i want is i do System.Diagnostics.Process.Start("FileName"); Now if File is associated with any program then the File with open...
0
by: bbrewder | last post by:
I am struggling with some MSAccess automation issues. Basically, we have a .Net application that uses MSAccess for reporting (legacy code). We are able to launch MSAccess fine and even work with...
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:
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
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...

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.