Go to advanced search

by elParaguayo
Thu Jan 18, 2018 5:32 pm
Forum: Python
Topic: Python RFID UID code
Replies: 12
Views: 16167

Re: Python RFID UID code

I'm not going to fix your issue but I'd like to make a few comments: 1 - please, please, please, when posting code - use the code tags to preserve indentation. 2 - I'd like to offer a couple of suggestions to tidy up a couple of lines that look a bit ugly to me: This print "Card read UID: "+str(uid[...
by elParaguayo
Wed Jan 17, 2018 8:37 pm
Forum: Python
Topic: All Python Scripts Stop Working After ~3hrs With No Errors?
Replies: 6
Views: 1399

Re: All Python Scripts Stop Working After ~3hrs With No Errors?

It's also not helpful having try... except... blocks that catch every exception (it's actually pretty bad practice to do this). This is probably why your code fails silently.

There may be some exceptions that it's ok to ignore but it seems clear that there are some that are causing you problems!
by elParaguayo
Wed Jan 17, 2018 3:12 pm
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1330

Re: How to disable GPIO button when scriptis running

I feel bad for replying - you'd done all the leg work up to then!
by elParaguayo
Wed Jan 17, 2018 2:58 pm
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1330

Re: How to disable GPIO button when scriptis running

You might be missing your parentheses... The line should be: play_obj = wave_obj.play() Without the parentheses, play_obj is a reference to the play method of wave_obj (which won't have the "wait_done" method). Adding the parentheses will execute the method and assign the return value to play_obj. I...
by elParaguayo
Tue Jan 16, 2018 3:11 pm
Forum: Python
Topic: total newbie to Linux/python/sh
Replies: 1
Views: 338

Re: total newbie to Linux/python/sh

You can run shell commands using the subprocess module (you can also use os.system but, as python recommend using subprocess instead, that's what I'm going to show you!). One disclaimer: I don't know the dropbox uploader script so I will assume that the code you've got in your post is correct and co...
by elParaguayo
Tue Jan 16, 2018 3:00 pm
Forum: Python
Topic: Cannot install Cython
Replies: 2
Views: 1302

Re: Cannot install Cython

I built cython when installing kivy (I followed these instructions). I saw that message too (I think it's just a warning rather than an error) but, eventually, it did finish building.

When you say the terminal freezes, how long have you waited?
by elParaguayo
Sat Jan 13, 2018 7:22 am
Forum: Python
Topic: Code for displaying an image (raspberry pi 3 & Python)
Replies: 11
Views: 11076

Re: Code for displaying an image (raspberry pi 3 & Python)

Well, I wouldn't go that far but I'm glad I could help!
by elParaguayo
Fri Jan 12, 2018 7:16 pm
Forum: Python
Topic: Code for displaying an image (raspberry pi 3 & Python)
Replies: 11
Views: 11076

Re: Code for displaying an image (raspberry pi 3 & Python)

You could use the subprocess module rather than os.system. As an example: import subprocess #Display the image image = subprocess.Popen(["feh", "--hide-pointer", "-x", "-q", "-B", "black", "-g", "1280x800", "/home/pi/images/pic01.jpg"]) # Do other stuff here... # You can now close the image by doing...
by elParaguayo
Tue Jan 09, 2018 7:45 pm
Forum: Python
Topic: Python.h not found. error command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Replies: 2
Views: 13305

Re: Python.h not found. error command 'arm-linux-gnueabihf-gcc' failed with exit status 1

Do step 2! You need the python header files which are installed by that command.
by elParaguayo
Fri Dec 22, 2017 2:03 pm
Forum: Python
Topic: Running python script within a python script
Replies: 1
Views: 6270

Re: Running python script within a python script

Well you could use subprocess:

Code: Select all

import subprocess
subprocess.call(["python", "drcontrol.py", "-d", "DAE003zi",  "-r",  "1",  "-c",  "on"])
However, it may be neater just to import drcontrol into your ircontrol.py script and then call the relevant functions from your script.
by elParaguayo
Thu Dec 21, 2017 7:03 am
Forum: Python
Topic: Picamera Code: How to Change JPEG Quality
Replies: 1
Views: 1023

Re: Picamera Code: How to Change JPEG Quality

From what I can see in the docs, you just need to add an additional "quality" argument to the "capture" method eg

Code: Select all

camera.capture(output_filename, format="jpeg",
quality=60) 
by elParaguayo
Sun Dec 17, 2017 9:40 pm
Forum: Python
Topic: No module mainscreen
Replies: 4
Views: 709

Re: No module mainscreen

How have you installed OnAirScreen?

main screen.py seems to get built by the makefile.
https://github.com/saschaludwig/OnAirSc ... akefile#L3
by elParaguayo
Sun Dec 17, 2017 12:51 pm
Forum: Python
Topic: open python in python
Replies: 7
Views: 820

Re: open python in python

I'm guessing they just want open IDLE and have it give them a blank document to work in.
by elParaguayo
Sat Dec 09, 2017 7:11 am
Forum: Python
Topic: unboundlocalerror local variable 'start' referenced before assignment
Replies: 12
Views: 3195

Re: unboundlocalerror local variable 'start' referenced before assignment

What distance sensor are you using? The gpiozero library has code which could help
http://gpiozero.readthedocs.io/en/stabl ... nce-sensor
by elParaguayo
Fri Dec 08, 2017 1:09 pm
Forum: Python
Topic: Script crashes randomly
Replies: 10
Views: 1456

Re: Script crashes randomly

I don't think it's uncommon to get the occasional bad result from that sensor. I think I've seen numerous posts saying that over the years!
by elParaguayo
Fri Dec 08, 2017 12:41 pm
Forum: Python
Topic: unboundlocalerror local variable 'start' referenced before assignment
Replies: 12
Views: 3195

Re: unboundlocalerror local variable 'start' referenced before assignment

I don't think you should be using try...except... here. Thagrol's approach looks more sensible to me. Did you try it?
by elParaguayo
Fri Dec 08, 2017 12:37 pm
Forum: Python
Topic: Script crashes randomly
Replies: 10
Views: 1456

Re: Script crashes randomly

I suspect you're not getting valid values for humidity and temperature each loop so you need to put in some error handling before trying to format the data. As an example: h,t = dht.read_retry(dht.DHT22, 18) # Poll DHT-22 try: # Let's see if we can format the text temp_str = '{0:0.1f}'.format(t) exc...
by elParaguayo
Sat Dec 02, 2017 12:15 pm
Forum: Python
Topic: ImportError: No module named rpi_rf
Replies: 2
Views: 1639

Re: ImportError: No module named rpi_rf

by elParaguayo
Wed Nov 22, 2017 12:10 pm
Forum: Python
Topic: Control an IP camera Onvif compliant
Replies: 14
Views: 12857

Re: Control an IP camera Onvif compliant

That's disappointing (but I would have been amazed if it had worked).

I'm out of ideas and, without a camera of my own, there's little else I can do.

You may want to paste that error onto the Github issues page given that it's an error that arises from a line in their own example code.
by elParaguayo
Wed Nov 22, 2017 10:11 am
Forum: Python
Topic: Control an IP camera Onvif compliant
Replies: 14
Views: 12857

Re: Control an IP camera Onvif compliant

Well, if you're doing a ContinuousMove operation, you should look at the example in Github. Having looked at that, here's a guess for doing it from python: from onvif import ONVIFCamera def perform_move(ptz, request, timeout): # Start continuous move ptz.ContinuousMove(request) # Wait a certain time...
by elParaguayo
Tue Nov 21, 2017 12:21 pm
Forum: Python
Topic: Control an IP camera Onvif compliant
Replies: 14
Views: 12857

Re: Control an IP camera Onvif compliant

I've just noticed you posted your question in a different subforum a couple of weeks ago so I understand your anxiety. Unfortunately, I would guess that the lack of response means that (so far) no one who has seen your post is familiar with onvif camera and the relevant python library. I note that y...
by elParaguayo
Tue Nov 21, 2017 8:02 am
Forum: Python
Topic: Control an IP camera Onvif compliant
Replies: 14
Views: 12857

Re: Control an IP camera Onvif compliant

Go easy on the bumping. It hasn't even been 24 hours since your first post. Everyone here is a volunteer who answers questions whenever they can so please give people a chance to read your post in their own time. One comment: your example isn't really python related (other than the tool being writte...
by elParaguayo
Fri Nov 17, 2017 7:35 am
Forum: Python
Topic: [Solved] Run python script in another python script
Replies: 5
Views: 20130

Re: [Solved] Run python script in another python script

Can you post your scripts?
by elParaguayo
Tue Nov 14, 2017 3:57 pm
Forum: Python
Topic: Problems with the code (while-loop)
Replies: 6
Views: 747

Re: Problems with the code (while-loop)

Ha. Hadn't noticed the file path!
by elParaguayo
Tue Nov 14, 2017 3:08 pm
Forum: Python
Topic: Problems with the code (while-loop)
Replies: 6
Views: 747

Re: Problems with the code (while-loop)

Put

Code: Select all

global seite
before

Code: Select all

seite = seite + 1

Go to advanced search