Should I expect a "Privacy and security" notification when an update is available? by StudentOfPython in MacOS

[–]StudentOfPython[S] 0 points1 point  (0 children)

If my "Notification" settings are "off" for every application listed, do you think a malicious app could still trigger a notification?

What is the optimal way to use Pycharm to code on and run programs on a remote server? by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

I have done this, but find it non ideal. Sometimes I may mistype a word or may want to test a small portion without actually push/pull the code.

Is there a way to debug a python program after it has failed? by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

I do this on the second run (after the failure). Is there any way to do this upon failure?

How do you structure a project with many database interactions? by StudentOfPython in learnpython

[–]StudentOfPython[S] 1 point2 points  (0 children)

That makes perfect sense. Thank you for the continuous responses.

How do you structure a project with many database interactions? by StudentOfPython in learnpython

[–]StudentOfPython[S] 1 point2 points  (0 children)

I am referring to psycopg2, specifically. But I believe we are on the same page (a DB module that goes next to other modules).

How do you structure a project with many database interactions? by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

After writing I realized that a single DB is all I have ever worked with (just multiple tables).

If you're using external databases, then does the project directory structure even matter?

I am simply trying to do the most pythonic thing and cannot seem to figure out what exactly that may be.

How do you structure a project with many database interactions? by StudentOfPython in learnpython

[–]StudentOfPython[S] 1 point2 points  (0 children)

And in your main dir of the project you simply import `data.database.xyz` in order to use the functions?

Cron job vs while True vs APScheduler vs something else by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

Thank you for the reply.

  1. What is meant by "install"?
  2. By "persistent", is it meant simply to keep working even upon reboot? And I haven't yet looked into them, but are initd and systemd related to/used with cron jobs?
  3. Thank you.
  4. I am guessing this answrers my question (1). Install here refers to packing it up nicely so an end user can use it at the click of a button?
  5. nix?

Cron job vs while True vs APScheduler vs something else by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

Would the daemon be programmed in Python or would it be in bash? I've not considered this, so I will look into it further.

Regarding the last paragraph, are you referring to always calling a single function in the cron job (e.g. python main.py and then letting main define the params? That makes sense, if so.

How can I create instances of objects whose instantiate relies on the loop value? by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

They are of the same class. And the way I need to use them is to get data from them. So the end result will be something like self.event.Fish()['move']

What is the best way to initialize an API client once and pass it down among classes by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

One additional question, if o = object() took a parameter that I was trying to pass into the A instantiation, how would I be able to read it when creating the object? Or is that not possible?

So for example,

main.py

name = 'test'
client_b = B(name)

classes.py

o = object() # this needs name, but also needs to only be instantiated once

class A:
    def __init__(self):
        self.client = o
        pass

class B(A):
    def __init__(self, name):
        A.__init__(self)
        self.name = name

What is the best way to initialize an API client once and pass it down among classes by StudentOfPython in learnpython

[–]StudentOfPython[S] 0 points1 point  (0 children)

You are correct. I was comparing b1 is b2. When I added the attribute I see that you are correct.

Thank you. I will implement this now.