Thursday, March 27, 2014

Re: populating my postgres with openpyxl

I keep getting this error, saying that there is 0207.xlsx is not there,
but it is in the directory.

File "hsdata.py", line 34, in <module>
wb = load_workbook(filename = fname, use_iterators=True)
File
"/home/william/.virtualenvs/hsdata/local/lib/python2.7/site-packages/openpyxl/reader/excel.py",
line 125, in load_workbook
raise InvalidFileException(unicode(e))
openpyxl.shared.exc.InvalidFileException: [Errno 2] No such file or
directory: '0207.xlsx'


It looks like os.walk() needs you to add the starting point (BASEDIR) to
the resulting file name.

Something like

... load_workbook(filename = os.path.join(BASEDIR, fname),...)

hth

- Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/53349DA3.4050309%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment