• DavinE

    @JonB
    Thank you πŸ‘

    posted in Pythonista read more
  • DavinE

    @ccc
    Okay, I thought there was a nicer solution like placeholders or something.

    but thank you for your fixed answer πŸ‘

    posted in Pythonista read more
  • DavinE

    Hello,

    I Have a question about Python String formating.
    This is my String:

    csvFile__ProjectID = 83498246
    rexelCSV = '%sr.csv' % (csvFile__ProjectID) 
    

    Is it possible to do like this:

    file Exempel:
    83498246r1.csv
    83498246r10.csv
    83498246r17.csv

    csvFile__ProjectID = 83498246
    rexelCSV = '%sr?.csv' % (csvFile__ProjectID) 
    

    The ? is for any Key

    I hope you understand what I want πŸ˜‚

    posted in Pythonista read more
  • DavinE

    @cvp

    Yes, I'm just not so fast with the implement xD

    it works perfectly thank you for your quick help!

    posted in Pythonista read more
  • DavinE

    Hello,

    Is it possible to use an external button to tell the TableView to jump to row x ?

    posted in Pythonista read more
  • DavinE

    @JonB

    Do you happen to know what permissions a user needs to work with Synology-api ?
    if I put the user I created for my app in the admin group it works, otherwise not but would not like to share the admin for it.

    EDIT:
    I have adjusted the query.
    filestation.FileStation

    posted in Pythonista read more
  • DavinE

    @JonB said:

    So, are you trying to keep your NAS from sleeping while using the app?

    Yes, that was exactly my thought.

    Or just want to prevent an error when it does sleep, by extending the timeout? (You could set a two minute timeout if you want to avoid an error)

    I never got any errors, it's just stupid when you don't do anything for a longer time or some things need a longer time and then it's in sleep mode.

    posted in Pythonista read more
  • DavinE

    @JonB said:

    Have you checked out Synology python API?

    https://github.com/N4S4/synology-api

    No i donβ€˜t checked Synology-API, but now i did....

    Unfortunately, this is not what I'm looking for, since every time I query it, the sleep mode is interrupted.

    I'm not sure if you can check hybernation status, but this might kick start things (say, try to run a file station download).

    I guess that's true...
    I could now go here and after opening the app simply create a loop where every x minutes a query would be created so that the DS would not go into sleep mode for now or ?

    Also, if I understand your issue is long timeout on MySQL connect -- _mysql.connect() let's you specify a connect_timeout value, which you could set to something short to see if server is responding.

    This was a good idea, but unfortunately the DS is first brought out of sleep mode and this takes longer than my set time of 1 second so that it unfortunately does not work.

    You can also execute ssh commands via paramiko -- I'm not sure if there is a shell command that let's you turn off hibernation. Frankly, on my DSM, it doesn't take that long to come out of hibernation, but I might be using things differently.

    SSH I would have to look first again with my Key's etc....
    And yes, as I said with me it takes up to 1 minute until he creates the query when the DS goes out.

    posted in Pythonista read more
  • DavinE

    I found this Script:

    import sys
    import socket
    
    def servertest(argv):
        host = 'xx'
        port = 'Xxx'
    
        args = socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM)
        for family, socktype, proto, canonname, sockaddr in args:
            s = socket.socket(family, socktype, proto)
            try:
                s.connect(sockaddr)
            except socket.error:
                return False
            else:
                s.close()
                return True
    
    
    if __name__ == "__main__":
        if servertest(sys.argv):
            print("Server is UP")
        else:
            print("Server is DOWN") 
    

    But since my NAS is never off but only in sleep mode I always get the message: Server is UP can I get around this ?

    posted in Pythonista read more
  • DavinE

    @cvp Ah okay, now I know why it didn't work.
    Thank you πŸ‘

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!