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

Segfaulting with askopenfilename Dialogue

208 100+
Expand|Select|Wrap|Line Numbers
  1. file = askopenfilename(title='Open File',
  2.                     filetypes=[
  3.                                     ('GPS Files','*.gps')
  4.                                      ])
  5.  
  6.         if(file != ""):
This is what I have so far, the "if(file != ""): makes sure teh user doesn't press cancel. My problem is when the user selects one file and then presses cancel. I cannot find what file equals at that case. Can anyone help me?
ps. When the user clicks on a file name, then presses cancel, and i print out file it says ( ) .....Any help?
Mar 14 '07 #1
3 1320
bartonc
6,596 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. file = askopenfilename(title='Open File',
  2.                     filetypes=[
  3.                                     ('GPS Files','*.gps')
  4.                                      ])
  5.  
  6.         if(file != ""):
This is what I have so far, the "if(file != ""): makes sure teh user doesn't press cancel. My problem is when the user selects one file and then presses cancel. I cannot find what file equals at that case. Can anyone help me?
ps. When the user clicks on a file name, then presses cancel, and i print out file it says ( ) .....Any help?
Looks like bad indentation:
Expand|Select|Wrap|Line Numbers
  1. file = askopenfilename(title='Open File',
  2.                     filetypes=[
  3.                                     ('GPS Files','*.gps')
  4.                                      ])
  5.  
  6. if(file != ""):
Mar 14 '07 #2
Silent1Mezzo
208 100+
Looks like bad indentation:
Expand|Select|Wrap|Line Numbers
  1. file = askopenfilename(title='Open File',
  2.                     filetypes=[
  3.                                     ('GPS Files','*.gps')
  4.                                      ])
  5.  
  6. if(file != ""):
Ya I actually noticed that :P in my file the indentation is right. Just didn't paste correctly
Mar 14 '07 #3
bartonc
6,596 Expert 4TB
Ya I actually noticed that :P in my file the indentation is right. Just didn't paste correctly
I'll have to check and see if filetypes is really supposed to be a list of tuples. Maybe on or the other?
Mar 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tim Williams | last post by:
I just installed Python 2.3 on my Redhat system. When I tried to run one of my programs that use tkFileDialog.askopenfilename(), I got an error because it returns a tuple instead of a null string...
1
by: Justin Straube | last post by:
Hopefully someone can catch what im missing here. Ive googled this and I think Ive got the filetypes arg written properly, but I get a traceback when calling this function. Heres the code...
12
by: Ger | last post by:
My dialogue form (sometimes partly, sometimes as a whole) remains visible during a fairly long processing job. The dialogue asks the user to enter some data for the job to follow, and after OK,...
0
by: Stephen Kay | last post by:
I'm having a problem where I changed hosts, went from php 4.1.2 to php 4.4.4, and now preg_replace_callback() is segfaulting when I pass it html that is longer than 2732 bytes. This code has worked...
0
by: half.italian | last post by:
Hi all. I'm trying to get Tkinter.askopenfilename() to list a directory tree on a remote computer. I've got some ideas, but nothing is slapping me in the face. Can someone point me in the...
3
by: rahulnag22 | last post by:
Hi, When I call tkFileDialog.askopenfilename() , the dialog box opens with the current directory as the default directory. Is it possible to open the dialog box with a directory other than the...
2
by: Sean DiZazzo | last post by:
Is there any way to open a Tkinter.askopenfilename() without opening a root window alongside the file chooser? I simply want a script to open a dialog and return the chosen file's path to...
2
by: Traclo | last post by:
Hello all! I have a problem concerning tkFileDialog. When I use the the askopenfilename command to open a text file it opens a tkinter window (apart from the file browsing window) which refuses to...
0
by: Gabriel Genellina | last post by:
En Thu, 07 Aug 2008 19:08:56 -0300, Lisa Frauens <frauens@hotmail.com> escribi�: Yes, you should save the last used directory somewhere. Try using ConfigParser. last_used_directory = ......
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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.