среда, 5 июля 2017 г., 3:39:28 UTC+3 пользователь 
mic...@callthecomputerdoctor.com написал:
>
> I think I can answer this. When your keyboard and mouse are plugged 
> directly into a Linux box and you're sitting in front of the box using it 
> regularly, the system has already started the X Window server, which is a 
> root-level process, for you. 
>
> When you log into the Linux box using ssh, you are given a text-only 
> container/shell to play in. The X Window server is attached to a different 
> login instance, not to you. So if you want to have access to the video 
> sub-system from an ssh shell, you need to get root permission.
>
> Alternatively, you could set up a VNC daemon server on the Pi to run when 
> your desktop loads, and then from a remote computer, you could log into the 
> Pi and control the desktop. I think that is more what you're looking for.
>

I’m not sure that X Window server is the cause, because I set up my 
Raspberry Pi to boot to command line. At least I see no desktop GUI after 
booting with keyboard connected, just command line login prompt. There is 
also second reason: I instruct pygame to not use X Window server (which, if 
I understand right, should set $DISPLAY environment variable), but to use 
framebuffer. 

But I think you are right in that ssh console and “real” console are 
different in some aspects which are important for pygame initialization. 

By the way, I examined __init__.py file of pygame (on my system it’s 
located in /usr/lib/python2.7/dist-packages/pygame/) and found out that it 
imports some modules with self-descriptive names like “key”, “mouse” and 
“joystick”. Moreover, comments and code in this file told me that these 
modules are not mandatory. So I renamed “mouse.so”, “key.so” and 
“joystick.so” in the aforementioned directory. My hope was that this will 
at least help me to get rid of mouse pointer in the top left corner of the 
screen or maybe even will let pygame initialize from ssh console without 
sudo. But, unfortunately, renaming didn’t change anything apart from 
several warnings printed on each pygame import:

 

pyscopefb.py:2: RuntimeWarning: import joystick: No module named joystick

(ImportError: No module named joystick)

 import pygame

pyscopefb.py:2: RuntimeWarning: import key: No module named key

(ImportError: No module named key)

 import pygame

pyscopefb.py:2: RuntimeWarning: import mouse: No module named mouse

(ImportError: No module named mouse)

 import pygame

Reply via email to