question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initializing from file failed

See original GitHub issue

Kindly, share your insights regarding the following error

  File "source\matrix_gen.py", line 68, in <module>
    main()
  File "source\matrix_gen.py", line 22, in main
    data = pd.read_csv(sys.argv[1], parse_dates=True, dayfirst=True)# argv[1]: stock_symbol.txt
  File "C:\Users\aims\Anaconda3\envs\py35\lib\site-packages\pandas\io\parsers.py", line 678, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "C:\Users\aims\Anaconda3\envs\py35\lib\site-packages\pandas\io\parsers.py", line 440, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "C:\Users\aims\Anaconda3\envs\py35\lib\site-packages\pandas\io\parsers.py", line 787, in __init__
    self._make_engine(self.engine)
  File "C:\Users\aims\Anaconda3\envs\py35\lib\site-packages\pandas\io\parsers.py", line 1014, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "C:\Users\aims\Anaconda3\envs\py35\lib\site-packages\pandas\io\parsers.py", line 1708, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas\_libs\parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas\_libs\parsers.pyx", line 697, in pandas._libs.parsers.TextReader._setup_parser_source
OSError: Initializing from file failed

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
breckuhcommented, Sep 11, 2018

I ran into a similar issue with a Jupyter notebook downloaded from the internet with an accompanying CSV. Turned out the CSV had no read permissions–sigh–and Pandas didn’t give a hint as to that underlying cause. Not sure if this was the same thing happening to you @JafferWilson--I forget how permissions work on Windows–but figured I post this in case anyone else hits a similar issue.

0reactions
mackmengcommented, Mar 7, 2019

txtPath = ‘E:/Defensive/textlog’ txtLists = os.listdir(txtPath) # txtLists = os.path.isdir(txtPath) for txt in txtLists: file_name = txtPath + “/” + txt reader = pd.read_table(file_name, sep=“,”, names=[i for i in range(4)], iterator=True)

error:OSError: Initializing from file failed
why?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: Initializing from file failed on csv in Pandas
By this error Python indicates the file is not readable- either, file permission, file error, incorrect path. etc. My code giving this error...
Read more >
OSError: Initializing from file failed on csv in Pandas - YouTube
Pandas : OSError: Initializing from file failed on csv in Pandas [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
I am getting an OS error and not sure why. - Kaggle
I am trying to read a CSV file using pandas read_csv function but I keep getting an OSerror. Here is the code. ......
Read more >
Python – OSError: Initializing from file failed on csv in Pandas
So far pandas read through all my CSV files without any problem, however now there seems to be a problem.. When doing: df...
Read more >
OSError: Initializing from file failed" when reading lots of docs ...
[Solved]-"OSError: Initializing from file failed" when reading lots of docs-Pandas,Python. Search. score:1. Accepted answer. Usually when I use glob I have ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found