On 05/02/2019 00:10, vinoth A N wrote:
Hello Friends,

Hello there! This is actually a mailing list/newsgroup for discussing ideas for extending and developing the Python language, not for dealing with people's programming problems. I've made some comments here, but in the future could you use python-l...@python.org (the mailing list) or comp.lang.python (the newsgroup), please.

I am in process of writing python automation code through which I can read
the MDB file which contains several tables which need to convert them in
multiple CSV file or xlsx file.

## package required
import pandas as pd
import numpy as np
import os
import glob
from functools import reduce


# to know how many csv file and name csv file in current floder
os.chdir('C:\\Users\\anvinoth\\Desktop\\BODOPD\\DXA_C2') # code to change
working directory
extension = 'mdb'
result = [i for i in glob.glob('*.{}'.format(extension))]

Not a bug, but you are making unnecessary work for yourself here. 'extension' is only ever the string "mdb", so why go to all the trouble of formatting it into a string when you could just write:

  result = [i for i in glob.glob('*.mdb')]

print(result)

['FB4-DXA-C2-BSL.mdb']



import pandas_access as mdb

Is this a different file? If so, have you os.chdir()ed back to the working directory? If not, it's considered good practice to put all your 'import' statements at the top of the file.

# Listing the tables.
for tbl in mdb.list_tables('FB4-DXA-C2-BSL.mdb'):
     print(tbl)


# Read a small table.
df =mdb.read_table('FB4-DXA-C2-BSL.mdb', "Patient")

i am getting this error

WinError 2] The system cannot find the file specified

I'm sure Python printed out a whole lot more information than that, including the line of code that caused the problem. It would help if you gave us the entire traceback (from the line beginning "Traceback"). Please copy and paste the text; don't try to transcribe it or take a screen shot!

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to