6

Python has grown on me as an alternative to bash

Including compared to c# the ease of making shell calls

Os.system()

Comments
  • 0
    It’s alright.
    I don’t like its syntax (or significant whitespace) yet it is definitely a useful tool.
  • 2
    For quick shell scripting like things I've recently came across "just" (https://github.com/casey/just )

    It's a surprisingly well designed little tool and you can even easily switch out the "interpreter" and just write powershell, python, whatever as if it was shell script
  • 0
    @Root I dunno it's not like it's rpg
    Kind of forces good spacing
    Don't really mind
    I just bash scripting lol
  • 1
    @Root I like everything c like
    Bash you're one space off between a bracket and it's fucked
  • 1
    @12bitfloat Sounds interesting. I’ll have to look it up!
  • 0
    @Root just the quick and dirty with the robustness that I like
    And it supports gdal :)
  • 5
    Don't use os.system

    Use subprocess.run("your shell command", shell=true, check=true)

    os.system is deprecated and less useful. With check=true your scripts will automatically pass correct.. status error code back to shell if one of them failed
  • 1
    Though when possible I prefer
    https://taskfile.dev/
    Kind of more language agnostic and standardized solution.
    Cross breed between makefiles, yaml and local executable CI workflows
  • 0
    @darkwind notes
    Let you capture the io streams too ?
  • 0
    @darkwind not that I really need that right now my use is so simple presently

    I'm just processing the output of ls since I can't seem to find a way to compose subprocess calls in.xargs
  • 0
    @AvatarOfKaine subprocess can catch stdout/stderr to Python objects
  • 0
    Also. "Import argparse" is a friend for input to scripts. Very CI friendly, self documented as a code input
  • 0
    @darkwind ever have one of those days when you really really are starting to realize how badly you want to bone someone ?

    Sigh
    I've just been reminded of a younger me I'm a different situation by some viewing choices
  • 0
    @darkwind also looking at the docs now
  • 0
    Oooo daddy does like
  • 0
    @darkwind now what needs to happen is daddy needs to continue to likey because making everything as it's been is dumb

    And these fucks owe much more than a lay or two that lasts an hour or less
  • 3
    python is great for making those stupid little scripts, I've been using it a lot for csv files
  • 0
    wasn't it designed exactly for that? to be a simple scripting language
  • 0
    @Root will you help me in my quest to get people interested in project buildbox evil sorta woman ?
Add Comment