Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93654
| 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 | <python.list@tim.thechases.com> |
| 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 <python.list@tim.thechases.com> |
| To | Mark Storkamp via Python-list <python-list@python.org> |
| Subject | Re: Trouble getting to windows My Documents directory |
| In-Reply-To | <mstorkamp-154B4A.09272010072015@88-209-239-213.giganet.hu> |
| References | <mstorkamp-154B4A.09272010072015@88-209-239-213.giganet.hu> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.405.1436561462.3674.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trouble getting to windows My Documents directory Mark Storkamp <mstorkamp@yahoo.com> - 2015-07-10 09:27 -0500
Re: Trouble getting to windows My Documents directory Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-10 15:47 +0100
Re: Trouble getting to windows My Documents directory Laura Creighton <lac@openend.se> - 2015-07-10 17:11 +0200
Re: Trouble getting to windows My Documents directory MRAB <python@mrabarnett.plus.com> - 2015-07-10 16:12 +0100
Re: Trouble getting to windows My Documents directory Mark Storkamp <mstorkamp@yahoo.com> - 2015-07-10 10:25 -0500
Re: Trouble getting to windows My Documents directory Rustom Mody <rustompmody@gmail.com> - 2015-07-10 10:48 -0700
Re: Trouble getting to windows My Documents directory Rustom Mody <rustompmody@gmail.com> - 2015-07-10 10:56 -0700
Re: Trouble getting to windows My Documents directory Tim Chase <python.list@tim.thechases.com> - 2015-07-10 09:46 -0500
Re: Trouble getting to windows My Documents directory random832@fastmail.us - 2015-07-10 20:24 -0400
Re: Trouble getting to windows My Documents directory Chris Warrick <kwpolska@gmail.com> - 2015-07-11 09:28 +0200
Re: Trouble getting to windows My Documents directory Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-11 11:47 -0400
Re: Trouble getting to windows My Documents directory random832@fastmail.us - 2015-08-01 02:50 -0400
csiph-web