Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: print causes the io error 9: Bad file descriptor when exporting static html #1269

Open
sasasqt opened this issue Nov 10, 2023 · 2 comments

Comments

@sasasqt
Copy link

sasasqt commented Nov 10, 2023

Describe the bug

these commands

/home/user/.local/bin/archivebox list --html > /home/user/archivebox/index.html
/home/user/.local/bin/archivebox list --html

throw an error

print(output)

OSError: [Errno 9] Bad file descriptor

https://github.com/ArchiveBox/ArchiveBox/blob/f5739506f637734fa194b9bf7c54f01b1333b5a2/archivebox/main.py#L883C4-L883C4


I changed print(output) to

        with open('/home/user/archivebox/index.html','w') as file:
            file.write(output)

and the problem was resolved. i guess import sys; sys.stdout = open('stdout.txt', 'w') would also work.


i suspected that the stdout pipe got filled up causing the error and i can not reliably reproduce this error


std flush before print also seems to mitigate this problem


Env:
my archivebox is on a low budget vps, and the archive folder is actually remote mounted google drive folder.

Steps to reproduce

Screenshots or log output

ArchiveBox version

replace this line with the *full*, unshortened output of running `archivebox version`
@sasasqt
Copy link
Author

sasasqt commented Nov 10, 2023

btw how to specify the latest snapshot first in --sort when outputing static html? --sort=timestamp does the opposite

@pirate
Copy link
Member

pirate commented Nov 14, 2023

I need the output of archivebox version to help, please edit your post and add it.

btw how to specify the latest snapshot first in --sort when outputing static html? --sort=timestamp does the opposite

use --sort=-timestamp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants