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

Exception while taking screenshot on Ubuntu #10

Open
kashishm opened this issue Jan 11, 2017 · 1 comment
Open

Exception while taking screenshot on Ubuntu #10

kashishm opened this issue Jan 11, 2017 · 1 comment

Comments

@kashishm
Copy link

kashishm commented Jan 11, 2017

I am getting the following exception while taking a screenshot on Ubuntu.

XGB: conn.go:47: Could not get authority info: open /var/go/.Xauthority: no such file or directory
XGB: conn.go:48: Trying connection without authority info...
XGB: conn.go:47: Could not get authority info: open /var/go/.Xauthority: no such file or directory
XGB: conn.go:48: Trying connection without authority info...
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x556a40, 0xc420014130)
	/usr/local/Cellar/go/1.7.4/libexec/src/runtime/panic.go:500 +0x1a1
image.(*RGBA).Opaque(0xc42065c000, 0x62e340)
	/usr/local/Cellar/go/1.7.4/libexec/src/image/image.go:141 +0xc3
image/png.opaque(0x62e340, 0xc42065c000, 0x62c240)
	/usr/local/Cellar/go/1.7.4/libexec/src/image/png/writer.go:60 +0x162
image/png.(*Encoder).Encode(0xc4200e6010, 0x62c5c0, 0xc420054000, 0x62e340, 0xc42065c000, 0x0, 0x0)
	/usr/local/Cellar/go/1.7.4/libexec/src/image/png/writer.go:508 +0x505
image/png.Encode(0x62c5c0, 0xc420054000, 0x62e340, 0xc42065c000, 0x0, 0x0)
	/usr/local/Cellar/go/1.7.4/libexec/src/image/png/writer.go:476 +0x6a
main.main()
	/Users/kashishm/Documents/go/src/github.com/sample/example/main.go:42 +0x155

code(from example folder)

func main() {
	img, err := screenshot.CaptureScreen()
	if err != nil {
		panic(err)
	}
	f, err := os.Create("./ss.png")
	if err != nil {
		panic(err)
	}
	err = png.Encode(f, img)
	if err != nil {
		panic(err)
	}
	f.Close()
}
@vova616
Copy link
Owner

vova616 commented Jan 11, 2017

Looks like its searching for /var/go/.Xauthority and its not founded, and the path looks like not $HOME/.Xauthority, can you check if $HOME/.Xauthority exists? if it does you can try to remove $XAUTHORITY.
or maybe create new .Xauthority file?
Found this one for creating Xauthority
http://superuser.com/a/941244

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