View Single Post
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2021-05-29, 16:28

Quote:
Originally Posted by Brad View Post
...
Welcome to Python. "Whitespace is important", as some Pythonistas would say. I'm sure it feels weird at first, but most folks I've known come to love Python's formatting rules pretty quickly, at least if they're writing a lot of Python on a daily basis. If you're interested in doing a lot more Python coding, I'd be happy to talk at length about PEP 8, flake8, and black for more opinionated general code formatting.
So relevant here.

I mean, I remember watching these episodes and then hearing about it from my boss who liked it one way over the other. (I completely forgot what it was since I'm not a developer and didn't care and now he's quit our company and is no longer our boss. )

Quote:
It may not be obvious at a glance, but I think this script is using the third-party daemonize library. If you didn't install that yourself, I wouldn't be surprised if it was already installed by some other Raspberry Pi software. I think I tried using daemonize many years ago, and I vaguely remember it being pretty fiddly, and I think I gave up on it. In general, using this (or the better-supported python-daemon library) likely requires a bit deeper Python knowledge than you have right now. You probably want to be familiar with context managers, threads, signal handling, and various file handle objects to make this work well; you might be better off just letting the caller deal with the process/stdin/stdout/signals management.

I like chucker's systemd service suggestion and would recommend that over manual daemon setup.
I'm certainly looking to get better with Python but not really trying to make it a day Job thing for me. I like a good general knowledge enough to be able to modify someone else's code for my personal uses. This means I don't have to learn everything and can typically get the results I'm after. I'm going to skip the demonizing thing and go with chucker's plan since it seems to fit the best for what I'm doing. I just thought it would be a "plug and play" kinda thing and it was far from it.

In fact, this is how most of my "coding" gets done that isn't bash scripting. I actually am pretty good with bash so I have that going for me.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote