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

FileNotFoundError: ~/shallow-backup/dotfiles/.gitignore #257

Closed
pawamoy opened this issue Mar 25, 2020 · 5 comments · Fixed by #259
Closed

FileNotFoundError: ~/shallow-backup/dotfiles/.gitignore #257

pawamoy opened this issue Mar 25, 2020 · 5 comments · Fixed by #259
Labels
bug Something isn't working

Comments

@pawamoy
Copy link

pawamoy commented Mar 25, 2020

I just installed shallow-backup with pipx, and I get this error:

% shallow-backup             
Creating config file at: /home/pawamoy/.config/shallow-backup.conf


              dP                dP dP                        dP                         dP
              88                88 88                        88                         88
     ,d8888'  88d888b. .d8888b. 88 88 .d8888b. dP  dP  dP    88d888b. .d8888b. .d8888b. 88  .dP  dP    dP 88d888b.
     Y8ooooo, 88'  `88 88'  `88 88 88 88'  `88 88  88  88    88'  `88 88'  `88 88'  `"" 88888"   88    88 88'  `88
           88 88    88 88.  .88 88 88 88.  .88 88.88b.88'    88.  .88 88.  .88 88.  ... 88  `8b. 88.  .88 88.  .88
     `88888P' dP    dP `88888P8 dP dP `88888P' 8888P Y8P     88Y8888' `88888P8 `88888P' dP   `YP `88888P' 88Y888P'
                                                                                                          88
                                                                                                          dP	
	v4.0.2 by Aaron Lichtman (@alichtman)

Current shallow-backup path: ~/shallow-backup
[?] Would you like to update this?:  No
 >  No
    Yes

Created directory: /home/pawamoy/shallow-backup
Initializing new git repo...
Updating .gitignore file at /home/pawamoy/shallow-backup/.gitignore with config from root-gitignore
WARNING: If you back up to a public remote, make sure no sensitive files are included by modifying the .gitignore.
[?] Would you like to set a remote URL for this git repo?:  No
    Yes
 >  No

Updating .gitignore file at /home/pawamoy/shallow-backup/dotfiles/.gitignore with config from dotfiles-gitignore
Traceback (most recent call last):
  File "/home/pawamoy/.local/bin/shallow-backup", line 8, in <module>
    sys.exit(cli())
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/shallow_backup/__main__.py", line 109, in cli
    create_gitignore(dotfiles_path, "dotfiles-gitignore")
  File "/home/pawamoy/.local/pipx/venvs/shallow-backup/lib/python3.8/site-packages/shallow_backup/git_wrapper.py", line 56, in create_gitignore
    with open(os.path.join(dir_path, ".gitignore"), "w+") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/pawamoy/shallow-backup/dotfiles/.gitignore'

Is it because I don't have a .gitignore file in ~?

@alichtman
Copy link
Owner

alichtman commented Mar 26, 2020

Can you post the output of $ cat ~/.config/shallow-backup.conf? And also $ ls ~/shallow-backup/ and $ ls ~/shallow-backup/dotfiles?

This error is likely related to the new config keys I added in v4.0, but I haven't run into this issue on my own system.

@alichtman alichtman added the bug Something isn't working label Mar 26, 2020
@alichtman
Copy link
Owner

alichtman commented Mar 26, 2020

It may be related to this line:

f"{get_config_path}",

In looking at this now, I have no idea how this line doesn't error... I'm pretty sure that it works (because it would have failed on my system if it didn't?) but that doesn't look right to me.

I'll do some further debugging once I get some more info from you.

@pawamoy
Copy link
Author

pawamoy commented Mar 26, 2020

% cat ~/.config/shallow-backup.conf
{
    "backup_path": "~/shallow-backup",
    "dotfiles": [
        ".bashrc",
        ".bash_profile",
        ".gitconfig",
        ".profile",
        ".pypirc",
        "<function get_config_path at 0x7fba3da269d0>",
        ".tmux.conf",
        ".vimrc",
        ".zlogin",
        ".zprofile",
        ".zshrc"
    ],
    "dotfolders": [
        ".ssh",
        ".vim"
    ],
    "root-gitignore": [
        "dotfiles/.ssh",
        "dotfiles/.pypirc",
        ".DS_Store"
    ],
    "dotfiles-gitignore": [
        ".ssh",
        ".pypirc",
        ".DS_Store"
    ],
    "config_mapping": {
        "/.config/sublime-text-2": "sublime2",
        "/.config/sublime-text-3": "sublime3",
        "/.config/Code/User/settings.json": "vscode/settings",
        "/.config/Code/User/Snippets": "vscode/Snippets",
        "/.config/Code/User/keybindings.json": "vscode/keybindings",
        "/home/pawamoy/.atom": "atom"
    }
}

Look at that serialized Python function hahahaha 😄! Go back to your Python interpreter you little function 😸

~/shallow-backup is empty (except for .git and .gitignore).

@alichtman
Copy link
Owner

alichtman commented Mar 29, 2020

@pawamoy Try installing the version from master. It'll say v4.0.3, but it's not the same as v4.0.3 on pypi. And make sure to do it with a clean ~/shallow-backup directory.

~/shallow-backup is empty (except for .git and .gitignore).

EDIT: Also, this error would indicate that the dotfiles subdirectory was not created properly. Testing a fix rn, will update soon.

EDIT 2: Fixed in v4.0.4

@pawamoy
Copy link
Author

pawamoy commented Mar 29, 2020

Working, thanks a lot 🙂 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants