Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:getting': 0.07; 'path)': 0.09; 'src': 0.09; 'properly': 0.15; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'idle,': 0.16; 'quits': 0.16; 'runs.': 0.16; 'subject:windows': 0.16; 'wrote:': 0.16; 'first,': 0.20; 'fix': 0.21; 'accommodate': 0.22; 'trying': 0.22; 'absolute': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'error': 0.27; 'dialog': 0.29; 'thinks': 0.29; 'code': 0.30; 'call.': 0.30; "i'd": 0.31; 'users.': 0.31; 'run': 0.33; 'problem': 0.33; 'message.': 0.33; 'directory,': 0.33; 'open': 0.33; 'changing': 0.34; 'file': 0.34; 'on,': 0.35; 'saved': 0.35; 'comment': 0.35; 'problem.': 0.35; 'but': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; "won't": 0.38; 'skip:o 20': 0.38; 'rather': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'ever': 0.60; 'show': 0.62; 'python-list': 0.66; 'here': 0.66; 'box,': 0.67; 'click': 0.76; 'received:23': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1436539573564:1802408733 X-MC-Ingress-Time: 1436539573564 Date: Fri, 10 Jul 2015 09:46:07 -0500 From: Tim Chase To: Mark Storkamp via Python-list Subject: Re: Trouble getting to windows My Documents directory In-Reply-To: References: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1436561462 news.xs4all.nl 2893 [2001:888:2000:d::a6]:59292 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93654 On 2015-07-10 09:27, Mark Storkamp via Python-list wrote: > sourcedir = os.environ['HOME']+"/Documents/" First, I'd do a couple things here to accommodate various systems to make it cross-platform: sourcedir = os.path.join( os.path.expanduser('~'), "Documents" ) > os.chdir(sourcedir) > src = askopenfilename() Then, rather than changing to that directory, use src = askopenfilename(initialdir=sourcedir) > When this is run from IDLE, it works fine. But when I double click > on the saved file to run it, it quits without ever showing the open > file dialog box, and doesn't show any error message. If the above doesn't solve the problem, you might try writing the sourcedir to a file so you can see what it thinks you're trying to open. > The problem is with the os.environ['HOME'] call. If I comment it > out (and fix up the surrounding code with an absolute path) then it > runs. But then it won't work properly for other users. I suspect that inspecting that sourcedir will show what's going on, and that the above tweaks will ameliorate the problem. -tkc