Live data from Hacker News

Antigravity.py (2020)

github.com

11–20 of 48 posts

Re: Antigravity.py (2020)

#11
post #3

TIL python has a webbrowser module

I just learned this myself the other day...

I was looking at the "Automate the Boring Stuff with Python" book by Al Sweigart (which admittedly i have not read cover to cover, but rather use it as a reference) for some help with a little polite scraping, and lo and behold the webbrowser module...See chapter 12: https://automatetheboringstuff.com/2e/chapter12/

I have not played much with it yet, but man, python continues to impress me!

Re: Antigravity.py (2020)

#14
post #3

TIL python has a webbrowser module

And it's even using the user preferred browser! Tried it on my MacBook M1 and it opens Brave which is my main browser. Wonder if it's using the same mechanism as the macOS open(1) command does for opening URLs. Or maybe even calling the /usr/bin/open binary.

From the python source code: https://github.com/python/cpython/blob/11749e2dc20ad6a76e9a3...

It seems to be shelling out to osascript, either telling it to OpenURL or open.

Re: Antigravity.py (2020)

#15
post #10

This looked innocuous at first glance, but this "antigravity" Easter egg has been found to have security implications. See "Hacking with Environment Variables", which specifically exploits the antigravity module for arbitrary code execution - https://www.elttam.com/blog/env/#content Previous HN comments: https://news.ycombinator.com/item?id=23828045

[deleted]

Re: Antigravity.py (2020)

#18
post #16

Earlier quoted context omitted.

But not a texteditor. You can use this library for that: https://pypi.org/project/texteditor/ (Disclaimer: I’m the author)

There's not really a reason for a built in text editor

Is not a built in text editor, is a command to open programmatically your default text editor to edit a file (new or existing).

There are several cases when you would want to do that, for example, think on the git CLI, that opens one so you can write a commit message, etc.

And is not only about using the EDITOR variable, most non-programmers doesn’t have one defined or it points to vim or something equally terrible for non technical users.

Post reply on HN