Re: Reading files in from the proper directory

2012-02-09 Thread Peter Otten
smac2...@comcast.net wrote: > On Feb 7, 3:16 pm, Peter Otten <__pete...@web.de> wrote: >> smac2...@comcast.net wrote: >> > xls_files = glob.glob(in_dir + "*.xls") >> >> Try changing that to >> >> pattern = os.path.join(in_dir, "*.xls") >> xls_files = glob.glob(pattern) >> >> os.path.join() inser

Re: Reading files in from the proper directory

2012-02-09 Thread SMac2347
On Feb 7, 3:16 pm, Peter Otten <__pete...@web.de> wrote: > smac2...@comcast.net wrote: > > xls_files   = glob.glob(in_dir + "*.xls") > > Try changing that to > > pattern = os.path.join(in_dir, "*.xls") > xls_files = glob.glob(pattern) > > os.path.join() inserts a (back)slash between directory and f

Re: Reading files in from the proper directory

2012-02-09 Thread SMac2347
On Feb 7, 3:16 pm, Peter Otten <__pete...@web.de> wrote: > smac2...@comcast.net wrote: > > xls_files   = glob.glob(in_dir + "*.xls") > > Try changing that to > > pattern = os.path.join(in_dir, "*.xls") > xls_files = glob.glob(pattern) > > os.path.join() inserts a (back)slash between directory and f

Re: Reading files in from the proper directory

2012-02-07 Thread Peter Otten
smac2...@comcast.net wrote: > xls_files = glob.glob(in_dir + "*.xls") Try changing that to pattern = os.path.join(in_dir, "*.xls") xls_files = glob.glob(pattern) os.path.join() inserts a (back)slash between directory and filename if necessary. > merge_xls(in_dir="C:\Documents and Settings\

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
In <9bfb3e39-2bc6-4399-90cc-1c53aa062...@h6g2000yqk.googlegroups.com> smac2...@comcast.net writes: > xls_files = glob.glob(in_dir + "*.xls") You may want to put a directory separator character in between the directory name and the filename glob pattern. -- John Gordon A

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
In smac2...@comcast.net writes: > Am I correct in thinking that I need to change the current working > directory to this folder in order for Python to read in these files, > then generate my output? You don't have to do it that way, no. In general, when opening a file, you can do it two ways:

Re: Reading files in from the proper directory

2012-02-07 Thread SMac2347
On Feb 7, 1:40 pm, Dave Angel wrote: > On 02/07/2012 01:14 PM, smac2...@comcast.net wrote:> Hello. I am admittedly a > Python novice, and ran into some trouble > > trying to write a program that will pull multiple excel files all into > > one file, with each file on a different sheet. > > > I am

Re: Reading files in from the proper directory

2012-02-07 Thread SMac2347
Thanks for the responses. Below is the code I have thus far. while the program runs glitch-free, it only results in the printing of the message: "NOTE *** No xls files in C:/Documents and Settings/smacdon/." as specified by my code. Any idea as to why it might be unable to find the .xls documents

Re: Reading files in from the proper directory

2012-02-07 Thread Peter Otten
smac2...@comcast.net wrote: > Hello. I am admittedly a Python novice, and ran into some trouble > trying to write a program that will pull multiple excel files all into > one file, with each file on a different sheet. > > I am confident most of the code is correct, as the program runs > without a

Re: Reading files in from the proper directory

2012-02-07 Thread Dave Angel
On 02/07/2012 01:14 PM, smac2...@comcast.net wrote: Hello. I am admittedly a Python novice, and ran into some trouble trying to write a program that will pull multiple excel files all into one file, with each file on a different sheet. I am confident most of the code is correct, as the program r