Python Forum
Help setting up Pycharm & Remote Pi - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help setting up Pycharm & Remote Pi (/thread-34932.html)



Help setting up Pycharm & Remote Pi - PickyBiker - Sep-16-2021

First, I am new to both PyCharm and the tornado web server.
I am trying to setup a configuration to run the tornado web server with PyCharm and a remote raspberry Pi. The Pi home directory is connected using SFTP as drive Z. So in Pycharm, the path to my wind sketch is "Z:\home\pi\wind\wind.py" This configuration seems to work but there is a huge problem that I haven't been able to resolve.

So far I have only been able to get it to work by using SSH into the pi and in that sketch directory (wind) executing: "python wind.py&"
That gets the server running successfully on the pi. But if I change the sketch so Hello World becomes Goodbye World and run it PyCharm tells me it is already running and asks if I want to close it and restart. I say yes, but subsequent connections still show "Hello World".
In order to fix that, I kill wind, and then type python wind.py& again. Having to do that every time I update the code is not feasible.
What do I need to do to make it easier to stop wind on the pi and restart it automatically with the changed sketch.

The tornado server is setup with the example Hello World sketch which I named wind.py
import tornado.ioloop
import tornado.web


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, World")


def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),
    ])


if __name__ == "__main__":
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()
Current configuration:
  • Windows 10
    SFTF 2.0.7877
    PyCharm Community 2021.2.2



RE: Help setting up Pycharm & Remote Pi - PickyBiker - Sep-16-2021

So I figured out that even though the source script is on the Raspberry Pi, when I run the script from PyCharm the script is running on the PC.

So I guess the question becomes how can I configure things to edit the script that is located on the pi and run the script on the pi, all from PyCharm on the PC?


RE: Help setting up Pycharm & Remote Pi - deanhystad - Sep-16-2021

Take a look at this or related articles:

https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html


RE: Help setting up Pycharm & Remote Pi - PickyBiker - Sep-17-2021

(Sep-16-2021, 08:32 PM)deanhystad Wrote: Take a look at this or related articles:

https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html

I tried to follow the instructions, "From the main menu, choose Run| Edit Configuration.... The Run/debug configurations dialog opens. You have to click Add configuration on the toolbar, and from the list of available configurations, select Python Debug Server."

The problem is in the community version 2021.2.2 there is no option there for "Python Debug Server"
Is it possible this is only available in the paid versions?