IDLE & Gadfly frustration
gbell at uclink.berkeley.edu
gbell at uclink.berkeley.edu
Thu Feb 1 10:00:38 EST 2001
Thank you -- the raw string & os.mkdir features should help me out.
But to reiterate my first question, does anyone know why running a
script via the ctrl-f5 function in IDLE (as opposed to the command
line) should affect the default directory where gadfly places data
files? This is true when I set the "mydirectory" value (see original
question) to an empty string. It seems that IDLE alters the default
path. Am I right, and can I prevent this?
In article <95b902$613$1 at nnrp1.deja.com>,
Greg Jorgensen <gregj at pobox.com> wrote:
> The directory you give to gadfly must exist. You can create a new
> directory like this:
>
> import os
> os.mkdir(r"c:\mydirectory")
>
> The r"..." string literal is a raw string; this prevents Python from
> interpreting the backslashes as escapes. You can also do this:
>
> os.mkdir("c:\\mydirectory")
>
> To create a new database from gadfly, after you have created the
folder:
>
> from gadfly import gadfly
> cx = gadfly()
> cx.startup("databasename", r"c:\mydirectory")
>
> etc.
>
> Hope this helps.
>
> --
> Greg Jorgensen
> Portland, Oregon, USA
> gregj at pobox.com
>
> In article <95b5gk$2gi$1 at nnrp1.deja.com>,
> gbell at uclink.berkeley.edu wrote:
> > Two newbie questions:
> >
> > 1) I'm trying to write a script which creates, then makes use of, a
> > Gadfly database to be stored in my Python20 directory. When I run
the
> > script from the (MS-DOS) command line, all is well. When I run the
> > script using IDLE, the Gadfly data files are created in my
TOOLS/IDLE
> > directory. IDLE seems to have its own ideas about my preferred
> default
> > directory. Is there any way to change this?
> >
> > 2) A related frustration: could someone tell me the proper syntax
for
> > specifying directory paths in Python (or perhaps I'm asking for the
> > proper Gadfly syntax)? The Gadfly documentation says:
> > connection.startup("mydatabase", "mydirectory")
> > So far, I've only had luck setting the second variable to ""
(perhaps
> > because of the problem mentioned in #1). Should "mydirectory"
begin
> > with c:? Use double backward slashes? forward slashes?
> >
> > Many, many thanks.
> >
> > Gregory Bell
> > gbell at uclink.berkeley.edu
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list