Problem with script package finding xls file


I have recently started using the scripts package and have encountered an odd problem. When I start atom from the console and run the following code I get a message saying:

IOError: [Errno 2] No such file or directory: '2013_ERCOT_Hourly_Load_Data.xls'

The xls file is in the same directory as the python code. Spyder and a Python Notebook have no problem finding the file, so I doubt is an issue with my global path settings. What should I do? If I enter the full path to the file in the Configure Script Current Working Directory script can’t find Python.

Here is the code:

import xlrd
import os
import csv
from zipfile import ZipFile
import datetime

datafile = "2013_ERCOT_Hourly_Load_Data.xls"
outfile = "2013_Max_Loads.csv"

def parse_file(datafile):

    workbook = xlrd.open_workbook(datafile)
    sheet = workbook.sheet_by_index(0)
    data = None
    outputlist = []

    for col in range(1, sheet.ncols):

        cv = sheet.col_values(col, start_rowx=1, end_rowx=None)

        header = sheet.cell_value(0,col)

        maxval = max(cv)

        maxpos = cv.index(maxval) + 1

        maxtime = sheet.cell_value(maxpos, 0)

        realtime = xlrd.xldate_as_tuple(maxtime, 0)

        year = realtime[0]

        month = realtime[1]

        day = realtime[2]

        hour = realtime[3]

        data = [
            'Region:', header,
            'Year:', year,
            'Month:', month,
            'Day:', day,
            'Hour:', hour,


        print outputlist

    return outputlist



Already tried prepending ./ to the file paths?


If you mean in my .bash_profile it’s there. Since Spyder and Python Notebook don’t have the problem I don’t the issue is on that level. If I leave things alone – enter nothing in the Configure Script Current Working Directory – atom finds Python but not the xls. If I enter the location of the directory the code and xls are in, it can’t find Python.

I am totally confused.


Could be to do with the fact that Atom uses Node and Chomium to work with local files, not native C++ libraries etc.
So have you tried what @frabert asked, by which he meant adding it to the file path in your Python variable,
e.g. datafile = "./2013_ERCOT_Hourly_Load_Data.xls"?


I hadn’t understood @frabert’s question. I just made the change in the variable with no luck. I will keep the “./” in mind for the future, but it is not the solution to the current problem.