#๐ Sanity check upon command line argument parsing
44 messages ยท Page 1 of 1 (latest)
Click here to see this code in our pastebin.
@vagrant cobalt
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
In a nutshell, I'm building a framework that's designed for use in a frozen envrionment, but not neccessarily
If in a frozen envrionment, it needs to be able to start up, and, because there's know way of knowing if the given command line args are valid, default to a sane location to output the logcs
Discord demanded I do a file
Wasn't my call
See the bottom part of the informatic.
On mobile, I have to download the file, find it, then open it. If it's a website link, it's easy enough to view in a web browser.
Fair enough
Anyway
This system is designed to operated both within a frozen environment and standalone - which, as I understand it - means that when launched in frozen mode there must be a log location
But, for various sanity reasons, the user may supply their own
Which means that prior to logging, I need to parse command line arguments as they may provide an alternative logcation for logging
Which brings me to my code
A fragment of my arg parser. Specifically (it's unfinished, don't get me wrong)
As best I can tell, I need to intercept the provision of an altenative log location, validate, and if that log location is valid, start logging there so people can get crash reports. If that location is invalid, I need to report it and start logging to a sane central location
I could be totally, completely off the mark on this
But I was hoping the smart, sane people of the python Discord could take a look and tell me whether I'm on the right track
I'm outside of my wheelhouse with this, but if it were me, I'd write to stderr that there was a problem, then crash disgracefully.
I'd love to do that also
But where exactly am I supposed to write that report to?
The user supplied log directory? Or, the default directory?
I was thinking sys.stderr.
When you double-click on an application (as this system is meant to be used), there is no sys.stderr
Not one my intended user is capable of accessing anyway
Not without storing it in a sane and constant location
In a frozen environment, isn't logging to file a nonstarting proposition in the first place? You could have some dialogue boxes pop up,I suppose...
Yes, definitely
I'll take a formal crash log in the application support directory over a cryptic message from the OS any day
Better to write a crash log to the OS's specific application support directory, something which someone can refer back to or give to ChatGPT, than issue an unlogged "all your base are now belong to us" and make it the user's fault
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.