Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Error with gist create #94

Closed
lambdamusic opened this issue Nov 30, 2020 · 4 comments
Closed

Error with gist create #94

lambdamusic opened this issue Nov 30, 2020 · 4 comments

Comments

@lambdamusic
Copy link

lambdamusic commented Nov 30, 2020

Love this package! But when I try to run it with the default editor option I get an error:

$ gist create "test"
Traceback (most recent call last):
  File "/usr/local/bin/gist", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/gist/client.py", line 572, in main
    raise GistError("'{}' is empty".format(file.name))
gist.client.GistError: 'None' is empty

Behaviour: the editor I set in my config file (Visual Code) gets opened, but the application crashes. I am on OSx 10.15.7.

My ~/.gist file looks like this

[gist]
token: <omitted>
editor: /usr/local/bin/code
@jdowner
Copy link
Owner

jdowner commented Nov 30, 2020

Sorry about that! Can you tell me what version you have installed?

@jdowner
Copy link
Owner

jdowner commented Nov 30, 2020

I don't have access to OSX but I think I have a fix for you. The problem here is that gist has to wait for the editor to finish writing the file before it sends anything to github. By default, the /usr/bin/code command opens a separate process. However, there is a command line option you can pass to VC telling it to wait for the process to terminate. Just append --wait to the command in the configuration file,

editor: /usr/bin/code --wait

This should open a tab in VC and wait for you to close the tab before trying to send the contents to github.

This works on ubuntu but would you mind trying it out to make sure it works for you before I close this issue?

@lambdamusic
Copy link
Author

Thanks! It does work indeed (and sorry for the late reply)

A couple of comments FYI

  • the vscode file buffer needs to be saved&closed for the script to continue (as expected)
  • the file is uploaded with name null

@jdowner
Copy link
Owner

jdowner commented Dec 4, 2020

Thanks @lambdamusic ! The issue with the filename is something that I also noticed recently (#90) and hopefully has been addressed in master. However, I have not pushed that fix to pypi with a new version yet. There are a few other changes that I would like to push with a new version.

@jdowner jdowner closed this as completed Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants