Go to advanced search

by DrMag
Mon May 21, 2018 8:32 pm
Forum: General discussion
Topic: Battery power / power display in termial
Replies: 3
Views: 361

Re: Battery power / power display in termial

To give you more of an idea of what you're in for with a request like this, here are a number of things that you have to understand: The Raspberry Pi really needs a solid 5V power--no more, no less, because it was designed without the power-management circuitry you get in other computers. Battery-po...
by DrMag
Tue Jun 06, 2017 4:26 pm
Forum: General discussion
Topic: Sending data from pi to PC via wifi
Replies: 5
Views: 9904

Re: Sending data from pi to PC via wifi

There are a number of ways this could be done, but which one we might recommend depends a great deal on just what you're after in the end. Can you explain the setup a little better? What are you intending to do with the data once transferred, just store it in a file? How much data (rate) are we talk...
by DrMag
Wed Sep 25, 2013 2:36 pm
Forum: Python
Topic: USB Pendrive read write
Replies: 1
Views: 513

Re: USB Pendrive read write

The USB drive is mounted like any other drive; whether that's automatic or not depends on how you have your OS configured. Once it's mounted, you can open, read, write files to the drive like you can to any other directory. If you aren't sure about actually using files in Python, you might start her...
by DrMag
Tue Sep 24, 2013 5:03 pm
Forum: Python
Topic: PIL Image capture store
Replies: 2
Views: 918

Re: PIL Image capture store

There's plenty of help available on the web for the image capturing part. A quick google search turned this up for example.

As for the rest, what is it you want to do with the image?
by DrMag
Fri Sep 20, 2013 8:39 pm
Forum: Python
Topic: Stuck with C/C++ library and my project is Python
Replies: 11
Views: 6680

Re: Stuck with C/C++ library and my project is Python

Hard to know what happened-- it may depend on how you've compiled it. A quick look at the repository has a link to a blog that explains how to install the library on your Pi. If you follow all the way through the make install, you can load the library from that directory. If you stop at make, you'll...
by DrMag
Fri Sep 20, 2013 1:51 pm
Forum: Python
Topic: SimpleCV Installation
Replies: 3
Views: 9058

Re: SimpleCV Installation

Edit: Never mind, I should have followed your links first.

Have you installed setuptools? You should be able to get both simplecv and svgwrite using easy_install, or even better pip.
by DrMag
Fri Sep 20, 2013 2:26 am
Forum: Python
Topic: Stuck on Codecademy! Please help!
Replies: 4
Views: 1847

Re: Stuck on Codecademy! Please help!

Next thing to do, once that is working to add "ay" to the end of words begining with consonants, is to replace the "print('vowel') with code to remove the first letter from the start, put it at the end and add "ay" then print it. I think you have that backwards-- words that start with a vowel just ...
by DrMag
Thu Sep 19, 2013 6:10 pm
Forum: Python
Topic: How do I run the command line in the background?
Replies: 7
Views: 2816

Re: How do I run the command line in the background?

After thinking about your question, I dug up a project I had done some time ago that is similar to what you're attempting-- I had forgotten that opencv is sufficient for this, and you won't even need a dedicated GUI API. Unless, of course, you want to learn the API or be able to add extra buttons/fe...
by DrMag
Thu Sep 19, 2013 3:16 pm
Forum: Python
Topic: Stuck with C/C++ library and my project is Python
Replies: 11
Views: 6680

Re: Stuck with C/C++ library and my project is Python

Of course. Here's a similar example using a custom library: test.c #include <stdio.h> void greet(void) { printf("Here's a message from a shared C library.\n"); } Compiling to a shared library: $ gcc -c -Wall -Werror -fpic test.c $ gcc -shared -o libtest.so test.o Now in Python: >>> import ctypes >>>...
by DrMag
Thu Sep 19, 2013 2:09 pm
Forum: Python
Topic: Stuck with C/C++ library and my project is Python
Replies: 11
Views: 6680

Re: Stuck with C/C++ library and my project is Python

Read up on the ctypes module in the standard library--it will let you use your C/C++ libraries within Python.

An example:

Code: Select all

import ctypes
libc=ctypes.cdll.LoadLibrary("libc.so.6")
message=ctypes.create_string_buffer(b"Hello, World!!")
libc.printf(message)
by DrMag
Wed Sep 18, 2013 5:10 pm
Forum: Python
Topic: subprocess.call() vs os.system()
Replies: 3
Views: 11275

Re: subprocess.call() vs os.system()

With the syntax you have there, yes it is necessary. You could also do: subprocess.call(["sudo", "halt"]) The differences between the two are subtle for the general user. Using shell=True is considered less secure, and the list of arguments method is preferred. (See http://docs.python.org/2/library/...
by DrMag
Wed Sep 18, 2013 4:45 pm
Forum: Python
Topic: How do I run the command line in the background?
Replies: 7
Views: 2816

Re: How do I run the command line in the background?

You're going to run into a problem with that approach, as feh will open a new window each time it is called. It won't take long to have hundreds (thousands even) of windows open that way, which will quickly swamp your Pi's resources. Alternatively, have you looked into opencv in conjunction with a g...
by DrMag
Wed Sep 18, 2013 4:31 pm
Forum: Python
Topic: mount USB stick withing Try-Finally block
Replies: 2
Views: 940

Re: mount USB stick withing Try-Finally block

You won't be able to use a try/exception construction directly, though you could build your own framework to use it if you desired. subprocess.call() will, however, return a value based on the success/failure of the call (specifically it will be the shell return code). If the call succeeds, then it ...
by DrMag
Tue Aug 27, 2013 3:32 pm
Forum: Python
Topic: How to send broadcast IP address to network?
Replies: 5
Views: 3463

Re: How to send broadcast IP address to network?

Blkant wrote:Where are you learning the python socket programming? So far most resources I find are one page of only the most basic of information.
I've found the text Foundations of Python Network Programming to be very helpful; if you don't want to purchase it, perhaps your local library may have a copy?
by DrMag
Fri Aug 23, 2013 3:47 am
Forum: Python
Topic: what am i doing wrong?
Replies: 6
Views: 1092

Re: what am i doing wrong?

Can you import pyside itself?
What's the result of

Code: Select all

import PySide
by DrMag
Wed Aug 21, 2013 7:48 pm
Forum: Python
Topic: Help me choose a Gui for python
Replies: 9
Views: 26218

Re: Help me choose a Gui for python

How much python experience do you have? pyGTK and pyQt are most likely to give you professional looking results, but if you're not comfortable with classes and objects and such, learning the toolkits from most online help may be a bit frustrating. Tkinter is probably easier to learn, but the results...
by DrMag
Wed Aug 21, 2013 7:37 pm
Forum: Python
Topic: How to echo in python
Replies: 14
Views: 5931

Re: How to echo in python

Here's a quick one would it be possible to send the contents of a text file to the serial port with this code? Read up on python's file object usage. If you open a text file, the read() function will return the contents of the file as a string: f=open('textfile.txt','r') contents=f.read() f.close()...
by DrMag
Wed Aug 21, 2013 7:29 pm
Forum: Python
Topic: RPi to USB to SERIAL to USB to PC
Replies: 3
Views: 887

Re: RPi to USB to SERIAL to USB to PC

What serial device are you using? If it's one of the standard FTDI chips or the CP2102, the linux kernel should recognize it as a serial port without any effort. If that's the case, and since you've posted in a python forum, you'll want to have a look at the pyserial module. Really, the language you...
by DrMag
Wed Aug 21, 2013 7:24 pm
Forum: Python
Topic: a chat app
Replies: 8
Views: 1570

Re: a chat app

Do you mean you want to build a python chat client yourself from scratch? I'm not sure you'll find a guide, per se, for that; it would probably be the length of a textbook. If you want to build it from scratch, you'll need to learn IP sockets using UDP, then GUI programming (probably either qt or gt...
by DrMag
Wed Aug 07, 2013 6:11 pm
Forum: Python
Topic: RF serial via USB port
Replies: 25
Views: 7957

Re: RF serial via USB port

I wonder if this is an issue of connecting/toggling the wrong handshake pin? It can confuse people when Tx has to connect to Rx; CTS is supposed to connect to RTS as well. I don't have your particular module, so I can't mess with it at all, but it's a thought I had. This discussion might be helpful.
by DrMag
Tue Aug 06, 2013 2:25 pm
Forum: Python
Topic: RF serial via USB port
Replies: 25
Views: 7957

Re: RF serial via USB port

You've only said you have a module "much like" another; can you give us the exact model you're using? It'd be helpful to see a datasheet to know what the module is expecting.
by DrMag
Mon Aug 05, 2013 6:40 pm
Forum: Python
Topic: Runing system command from code?
Replies: 6
Views: 1644

Re: Runing system command from code?

Assuming you don't want a binary executable like suggested, you can make a python script executable in linux by adding this line (exactly) at the top: #!/usr/bin/env python Then from the command line: $ chmod +x file.py $ ./file.py The first line will make the file executable (only need to do this o...
by DrMag
Mon Aug 05, 2013 6:35 pm
Forum: Python
Topic: Problems reading file
Replies: 5
Views: 1040

Re: Problems reading file

That's exactly what's going on. The output of a function only prints automatically when run directly in the interpreter. You can only print the output of the file.readline() call with a print statement directly. In other words, your program is working just fine; it's only trying to teach you about t...
by DrMag
Thu Aug 01, 2013 7:25 pm
Forum: Python
Topic: Project: TCP/IP, UART and GPIO
Replies: 6
Views: 2555

Re: Project: TCP/IP, UART and GPIO

A little searching on the forum turned this up pretty quickly:
http://www.raspberrypi.org/phpBB3/viewt ... 5&p=334272
by DrMag
Thu Aug 01, 2013 7:22 pm
Forum: Python
Topic: Serial port via USB port
Replies: 6
Views: 31138

Re: Serial port via USB port

When you plug in your RF module, use dmesg to see what device attachment it received... it'll be /dev/ttySOMETHING most likely. Then just pass that as your name.

Go to advanced search