How to start an app in a remote desktop
I have a GUI app that I can run from a terminal window on a Raspberry Pi desktop and it displays the GUI output on the screen attached to the HDMI port. In the terminal window I run a command like python myapp.py
If at the same time I am logged in to another computer with an ssh terminal back to the RPi, if I run python myapp.py
it fails because it can't connect to the display.
I imagine that it must be possible to do this, and perhaps the python myapp.py
needs to be wrapped in a script that supplies appropriate environment variables.
What's the best way to solve this?
linux shell raspberry-pi console
add a comment |
I have a GUI app that I can run from a terminal window on a Raspberry Pi desktop and it displays the GUI output on the screen attached to the HDMI port. In the terminal window I run a command like python myapp.py
If at the same time I am logged in to another computer with an ssh terminal back to the RPi, if I run python myapp.py
it fails because it can't connect to the display.
I imagine that it must be possible to do this, and perhaps the python myapp.py
needs to be wrapped in a script that supplies appropriate environment variables.
What's the best way to solve this?
linux shell raspberry-pi console
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (-X
option in thessh
command).
– xenoid
Dec 25 '18 at 10:26
1
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08
add a comment |
I have a GUI app that I can run from a terminal window on a Raspberry Pi desktop and it displays the GUI output on the screen attached to the HDMI port. In the terminal window I run a command like python myapp.py
If at the same time I am logged in to another computer with an ssh terminal back to the RPi, if I run python myapp.py
it fails because it can't connect to the display.
I imagine that it must be possible to do this, and perhaps the python myapp.py
needs to be wrapped in a script that supplies appropriate environment variables.
What's the best way to solve this?
linux shell raspberry-pi console
I have a GUI app that I can run from a terminal window on a Raspberry Pi desktop and it displays the GUI output on the screen attached to the HDMI port. In the terminal window I run a command like python myapp.py
If at the same time I am logged in to another computer with an ssh terminal back to the RPi, if I run python myapp.py
it fails because it can't connect to the display.
I imagine that it must be possible to do this, and perhaps the python myapp.py
needs to be wrapped in a script that supplies appropriate environment variables.
What's the best way to solve this?
linux shell raspberry-pi console
linux shell raspberry-pi console
edited Dec 25 '18 at 9:21
P_Yadav
1,5193923
1,5193923
asked Dec 25 '18 at 6:01
Patrick H
61
61
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (-X
option in thessh
command).
– xenoid
Dec 25 '18 at 10:26
1
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08
add a comment |
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (-X
option in thessh
command).
– xenoid
Dec 25 '18 at 10:26
1
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (
-X
option in the ssh
command).– xenoid
Dec 25 '18 at 10:26
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (
-X
option in the ssh
command).– xenoid
Dec 25 '18 at 10:26
1
1
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08
add a comment |
3 Answers
3
active
oldest
votes
As mentioned in comments, assuming the remote machine is running X Window Server
, you can redirect the display to this machine using -X
:
From man page:
-X Enables X11 forwarding.
So from remote host:
ssh user@raspberry -X
Then simply run your app:
python myapp.py
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
add a comment |
You need to start an X server on your Raspberry Pi, then just type in DISPLAY=:0 python myapp.py
into your SSH session. It should start.
add a comment |
Success!
Interestingly, it was not necessary to use the -X argument...
From the remote system:
ssh RPi
Then do:
DISPLAY=:0 python myapp.py
Thanks to both responders!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490842%2fhow-to-start-an-app-in-a-remote-desktop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As mentioned in comments, assuming the remote machine is running X Window Server
, you can redirect the display to this machine using -X
:
From man page:
-X Enables X11 forwarding.
So from remote host:
ssh user@raspberry -X
Then simply run your app:
python myapp.py
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
add a comment |
As mentioned in comments, assuming the remote machine is running X Window Server
, you can redirect the display to this machine using -X
:
From man page:
-X Enables X11 forwarding.
So from remote host:
ssh user@raspberry -X
Then simply run your app:
python myapp.py
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
add a comment |
As mentioned in comments, assuming the remote machine is running X Window Server
, you can redirect the display to this machine using -X
:
From man page:
-X Enables X11 forwarding.
So from remote host:
ssh user@raspberry -X
Then simply run your app:
python myapp.py
As mentioned in comments, assuming the remote machine is running X Window Server
, you can redirect the display to this machine using -X
:
From man page:
-X Enables X11 forwarding.
So from remote host:
ssh user@raspberry -X
Then simply run your app:
python myapp.py
answered Dec 25 '18 at 10:40
Kevin Lemaire
1,160624
1,160624
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
add a comment |
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
In response to Kevin... I tried doing 'ssh -X me@RPi as suggested, and then ran the 'python myapp.py' command, but I get an error: pygame.error: Unable to open a console terminal
– Padraig H
Dec 25 '18 at 17:14
add a comment |
You need to start an X server on your Raspberry Pi, then just type in DISPLAY=:0 python myapp.py
into your SSH session. It should start.
add a comment |
You need to start an X server on your Raspberry Pi, then just type in DISPLAY=:0 python myapp.py
into your SSH session. It should start.
add a comment |
You need to start an X server on your Raspberry Pi, then just type in DISPLAY=:0 python myapp.py
into your SSH session. It should start.
You need to start an X server on your Raspberry Pi, then just type in DISPLAY=:0 python myapp.py
into your SSH session. It should start.
answered Dec 25 '18 at 10:41
Михайло Оришич
113
113
add a comment |
add a comment |
Success!
Interestingly, it was not necessary to use the -X argument...
From the remote system:
ssh RPi
Then do:
DISPLAY=:0 python myapp.py
Thanks to both responders!
add a comment |
Success!
Interestingly, it was not necessary to use the -X argument...
From the remote system:
ssh RPi
Then do:
DISPLAY=:0 python myapp.py
Thanks to both responders!
add a comment |
Success!
Interestingly, it was not necessary to use the -X argument...
From the remote system:
ssh RPi
Then do:
DISPLAY=:0 python myapp.py
Thanks to both responders!
Success!
Interestingly, it was not necessary to use the -X argument...
From the remote system:
ssh RPi
Then do:
DISPLAY=:0 python myapp.py
Thanks to both responders!
edited Dec 26 '18 at 4:45
Jeff Schaller
39k1053125
39k1053125
answered Dec 25 '18 at 17:20
Padraig H
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490842%2fhow-to-start-an-app-in-a-remote-desktop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If your "other computer" runs an X-Windows server (default if using Linux with a GUI) then you can use X-forwarding (
-X
option in thessh
command).– xenoid
Dec 25 '18 at 10:26
1
Welcome to Unix & Linux Stack Exchange. It would appear that you have accidentally created two accounts. This will interfere with commenting, editing your own posts, and accepting an answer. You should use the contact form and select “I need to merge user profiles” to have your accounts merged. In order to merge them, you will need to provide links to the two accounts. For your information, these are unix.stackexchange.com/users/328379/patrick-h (Patrick H) and unix.stackexchange.com/users/328428/padraig-h (Padraig H). You’ll then be able to edit your question.
– G-Man
Dec 26 '18 at 2:08