#๐Ÿ”’ Sanity check upon command line argument parsing

44 messages ยท Page 1 of 1 (latest)

vagrant cobalt
cyan ventureBOT
cyan ventureBOT
#

@vagrant cobalt

Python help channel opened

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.

vagrant cobalt
#

In a nutshell, I'm building a framework that's designed for use in a frozen envrionment, but not neccessarily

gentle wharf
#

When posting code, it's often helpful if people adhere to the following.

#

!code

cyan ventureBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

vagrant cobalt
#

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

vagrant cobalt
#

Wasn't my call

gentle wharf
vagrant cobalt
#

XD So, use one pastebin instead of another

#

Got it

gentle wharf
#

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.

vagrant cobalt
#

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

gentle wharf
#

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.

vagrant cobalt
#

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?

gentle wharf
#

I was thinking sys.stderr.

vagrant cobalt
#

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

gentle wharf
#

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...

vagrant cobalt
#

Ewwwww

#

Bad

#

No

gentle wharf
#

You spoke of double clicking.

#

Which suggests GUI.

vagrant cobalt
#

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

cyan ventureBOT
#
Python help channel closed for inactivity

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.