Skip to content

Not a directory: '/dump/.gitkeep/schema.json' #295

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

Open
paddy-hack opened this issue Jan 31, 2025 · 2 comments
Open

Not a directory: '/dump/.gitkeep/schema.json' #295

paddy-hack opened this issue Jan 31, 2025 · 2 comments

Comments

@paddy-hack
Copy link

While trying to restore with --srcTable "*" I ran into

INFO:root:Starting restore for .gitkeep to .gitkeep..
Exception in thread Thread-4 (do_restore):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/bin/dynamodump", line 866, in do_restore
    open(dump_data_path + os.sep + source_table + os.sep + SCHEMA_FILE)
NotADirectoryError: [Errno 20] Not a directory: '/dump/.gitkeep/schema.json'

It would be nice if only directories were considered when looping over the matching content in the dump path.

IIUC, a simple

if os.is_dir(dir_name):
    continue

after line 379 in dynamodump.py should do the trick.

In my case I want to add an empty "scratch" directory to git, hence the .gitkeep file, but I can image that people want to put a README.md or similar in the dump path for documentation purposes.

@bchew
Copy link
Owner

bchew commented Mar 4, 2025

Feel free to open a PR for this change 🙂

paddy-hack added a commit to paddy-hack/dynamodump that referenced this issue Mar 18, 2025
paddy-hack added a commit to paddy-hack/dynamodump that referenced this issue Mar 18, 2025
@paddy-hack
Copy link
Author

Turns out I did not understand correctly 😿

Anyway, after testing a bit at the Python REPL, I cooked up something that should work. My Python skills are next to non-existent so I didn't even try to add a test to the code.

Please have a look at #304 🙇

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