zirk.us is one of the many independent Mastodon servers you can use to participate in the fediverse.
Literature, philosophy, film, music, culture, politics, history, architecture: join the circus of the arts and humanities! For readers, writers, academics or anyone wanting to follow the conversation.

Administered by:

Server stats:

753
active users

#Shebang

0 posts0 participants0 posts today

You probably know you can package #python files into a zip file and python will execute it like a script. But did you know that you can put a #shebang line in it?

If `foo.zip` contains `__main__.py` you can do

`echo '#!/usr/bin/python | cat - foo.zip > foo`

and

`chmod u+x foo`

then you can run `foo` like an ordinary program and it will run the contents of `__main__.py`

although I have no idea if you *should* do this.