[Tutor] how to open a file using os.system

Torsten Marek shlomme at gmx.net
Wed Jan 9 11:38:02 CET 2008

On Mi, 2008-01-09 at 15:54 +0530, brindly sujith wrote:
> hi
> i am developing a GUI application using TKINTER
> i want to open a file from the askopenfile(which is a tkFileDialog)
> using OS.SYSTEM.
> i have already created the file open dilog using
> tkFileDialog.askopenfile (parent=root,mode='rb',title='choose a file')
> Now i want to open a file from this dialog using OS.SYSTEM


why would you want to open it using os.system, and how? os.system is for executing
commands in a subshell. If you want to open a file for reading, just do

f = open(filename, "r")

and then read from using using .read(), .readline() or by looping over it.


Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.python.org/pipermail/tutor/attachments/20080109/2a29f093/attachment-0001.pgp 

More information about the Tutor mailing list