'Python script runs manually but gives 'Resource deadlock avoided' error in crontab

When I run my python script manually from the terminal it runs fine. Within the crontab this is the error it gives.

Traceback (most recent call last):
  File "/Users/uswamazhar/test.py", line 19, in <module>
    d5x_df1 = pd.read_excel(latest_file[-1])

  File "/Users/uswamazhar/opt/anaconda3/lib/python3.8/site-packages/pandas/util/_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)

  File "/Users/uswamazhar/opt/anaconda3/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 457, in read_excel
    io = ExcelFile(io, storage_options=storage_options, engine=engine)

  File "/Users/uswamazhar/opt/anaconda3/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 1376, in __init__
    ext = inspect_excel_format(

  File "/Users/uswamazhar/opt/anaconda3/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 1255, in inspect_excel_format

    buf = stream.read(PEEK_SIZE)
OSError: [Errno 11] Resource deadlock avoided

This is my crontab:

15 * * * * echo "test" >> test_status.txt
15 * * * * cd
15 * * * * /Users/uswamazhar/opt/anaconda3/bin/python ~/test.py 1>test.out 2>test.err

I tried running it through a nano shellscript too, still get the same error.



Solution 1:[1]

I'm facing exact same issue since upgrading Box (2.24.211+). Current workaround I've found is to mark the files/folders to be read as "Make Available Offline" in Box. It does defeat the purpose of using cloud storage though, if you have huge amount of data.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ankur Agrawal