Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: XDG_RUNTIME_DIR not set in the environment #11

Open
SonicGerkor opened this issue Oct 31, 2020 · 9 comments
Open

error: XDG_RUNTIME_DIR not set in the environment #11

SonicGerkor opened this issue Oct 31, 2020 · 9 comments

Comments

@SonicGerkor
Copy link

Error while starting magicband.py

I get this error after it tries to load magicband.py on startup:

error: XDG_RUNTIME_DIR not set in the environment

Any thoughts?

@SonicGerkor
Copy link
Author

I have googled and tried everything, uninstall and reinstall a bunch of times, still stuck with this.
Now the error shows as:
(/run/user/1000) is not owned by us (uid 0). but by uid 1000

I keep trying to see how to change this but so far unable to do so.

Pls help!

@nukraze
Copy link

nukraze commented Dec 4, 2020

I'm also running into this same issue on a RaspberryPi Zero. Has there been any update on addressing this?

@SonicGerkor
Copy link
Author

Nah men, I’m still struggling with this, the script runs and the leds turn on, but because of that runtimeerror thing it exits the script and i cant read ant bands :(

@SonicGerkor
Copy link
Author

I'm using a RPI2 and keep having this issue...maybe it's something to do with the Rpi? I don't have a 3B+ to try it

@locvez
Copy link

locvez commented Dec 10, 2020

I had this same issue running Pi OS Lite - I installed the full O/S instead and this fixed the problem.

I haven't been able to test the rest of it yet as I think my RFID reader is faulty - nothing happens when a band is scanned so waiting for new readers.

@SonicGerkor
Copy link
Author

@locvez did you install the same things via terminal? Or did you change something in between, I opened it up and it was a graphical interface, I located the terminal but found it a bit confusing on where to install or where to begin following the install options

@irvingwa
Copy link

Hey I know this is an old issue but if anyone else runs into this its because of the pygame library used. I switched it to just use the play command via the os. https://vitux.com/play-mp3-files-on-the-ubuntu-command-line/

And then you can just replace the playsound function with something like
# play sound def playSound(self, fname): os.system("play -v 10.0 " + fname)

@joncherston
Copy link

Ok, I'm by no means an expert on this, but have been wrestling with this issue for a while. Best I can tell, alsalib doesn't like using user 1000 which is what we do using sudo. So, the runtime directory has to be set manually to user 0 which alsalib wants to use for audio.
I tried irvingwa's solution to play the command via the os gave me new errors, although I likely did something wrong.
I finally got rid of the XDG_RUNTIME_DIR error by adding the following line to the magicband.py file, just above the os.environ line:

os.environ['XDG_RUNTIME_DIR'] = "/run/user/0"

Hope that helps someone else. I'm also hoping this will resolve my buffer underrun error, where there appears to be a memory leak, but time will tell.

@joncherston
Copy link

Ok, quick update.
That line does resolve the XDG_RUNTIME_DIR error.
However, it does not resolve the buffer underrun issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants