469,358 Members | 1,659 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

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 1210
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

Post your reply

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

Similar topics

1 post views Thread by Justin Straube | last post: by
reply views Thread by half.italian | last post: by
3 posts views Thread by rahulnag22 | last post: by
2 posts views Thread by Sean DiZazzo | last post: by
reply views Thread by Gabriel Genellina | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.