Can you post the entire contents of you /etc/rc.local file?
I’ve just done a little digging to check and if you don’t specify either the ip address or port it will default to 0.0.0.0:8080 which is perfect for what you want, and hence why it runs perfectly from the command line for you. This would then be a solution for you but it is very bad practice because when you come back to it in a month or two’s time it will not be obvious what port ospi.py is running on or why it is there. And of course it would be far better to find out what is going on for you anyway! 🙂