By the way, I also found that the .encode() method of strings also works, should anyone else find this thread.

Hello everyone

I'm using python 3.1 and am trying to use the pyserial library.
However, when I try something like ser.write('hello'), I get a type error.
[CODE]>>> import serial

ser = serial.Serial('COM13')
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
File "C:\Program Files\Python31\lib\site-packages\serial\", line 249, in write
data = bytes(data)
TypeError: string argument without an encoding[/CODE]

how do I fix this? And is it normal to get this error? Most tutorials use the same format for the commands and don't get any error.

I had already visited the second link. I couldn't really make head or tail of the documentation for pyparallel.

Thanks for the info.. I would like to able to manage without the microcontroller. How could do this using a parallel port?

Hi. I want to try and control a Servo motor directly from a USB port. (without using an intermediate microcontroller). To do this, I need to send pulse width modulation signals on one (or more) wires of the USB cable.
Is it possible to do this with python? (I found a library called pyserial but I can't figure out how to use it)

It can't be my monitor because the problem disappears when I disable font smoothing (i.e clear type).

I seem to have a problem with my acer LCD screen. I didn't notice this before, but when the contrast settings of the monitor are increased, the left vertical edges of letters seem to have a purple tinge. This is especially noticeable where there are double L's or double I s. I have clear type enabled and I also ran MSs Clear type tuning tool to no avail. Do you guys know what can be causing the problem?

Hmm.. I gave up trying to use Msconfig. All the startup programs in there were there from the day I got my PC. that is, there are no new startup programs that were installed recently. Therefore, I don't believe it's simple the startup programs that are making start up slow.

Hm.. I disabled some startup programs using Msconfig but now every time I start up, I get a message from windows saying some programs have been disabled and that MsConfig is running in some particular mode. How do I fix this (without re-enabling the startup programs)

I have a new PC which I've been using for about 9 months with windows XP. However, since of late, the time it takes to load all the startup programs has become quite long.. i.e the time between when I click the login icon and when the system actually becomes usable after loading all the startup programs.
I haven't installed any new software recently, that is, before I noticed an increase in startup time so I don't want to delete any startup programs.
Could it be something like temporary internet files?

ah.. thanks.

I bought a graphics card a few years ago and recently my monitor developed a habit of not showing the display. Remobing and reconnecting the monitor cable a few times solves the problem. So yesterday, this happened again and I decided to temporarily switch to the on-board display adapter. After that, when I boot up the computer, everything displays correctly up to the point where windows boots up. I use XP and I see the blue progress bar loading and then the monitor displays the message saying "WArning, Signal our of range" the screen starts to flicker terribly.
Now, by the way, I've dual booted with linux and this doesn't happen when I boot into linux. Does any one know what's wrong?

Thanks a lot! That's exactly what I wanted.

Umm .. could you please explain how that works? I'm new to programming.

well... as usual I've got stuck. I'm having trouble organizing the cells in the 3 x 3 blocks involved in sudoku. I've adopted the approach shown in post #6. i.e use lists in list to represent cells in rows. Can someone help?

Yup. that was much clearer. Thanks for your help.

I'm sorry.. I couldn't quite understand that. Could you please explain how that works? (Thanks for the example by the way!)

[QUOTE=tonyjv;1189020]You can also think if it makes sense to divide the rows by 3 cell limits, you can also use tuples instead of lists.

Luck with the project,
Thanks.. that's really helpful.
Thanks to jice too..

I"m trying to make a [URL=""]sudoku[/URL] puzzle generator (or at least the basics of one) for my project.
I'm approaching this by dividing the sudoku grid into 9 rows.
Each of the rows will be represented by a list and each list will have 9 elements to represent the nine squares that the row is made up of.
Now, I could go ahead and make 9 list (for each of the 9 rows) manually by doing
row_one = []
rwo_two = []
two_three = [] etc.

but I feel that there must be a better way to do this. So, is there a better way to make several variables with similar names like this?

[QUOTE=tux4life;1187892]Try this: [url][/url][/QUOTE]
I'm afraid that link didn't help much.. I'm having trouble understanding how a stream connects to other programs or devices. For example, most tutorials just say the output stream connects to the monitor and the input stream connects to the keyboard. How is this connection achieved?

Thanks for the reply.. but could someone explain this in a little more detail?

What are these standard streams and how do they work? Are they just like normal files where one program writes to the file and another reads from it? If so, how can two programs access the same file at once?

Hi.. I have posted another thread about my broken PC. I'm having trouble identifying the BIOS version that was installed on it. The BIOS chip on the mother board says it is a phoenix BIOS(there is a holographic label which says phoenix.). Does this mean that the BIOS software is also by Phoenix?

I don't think what I'm hearing is any kind of code. The computer keeps making short, rapid beeps indefinitely.

Hi.. recently my old PC went bust. I don't know if it's relevant but just before I switched off the PC for the last time, I remembered there was a CD inside and opened the drive. However, before I could close the drive, the PC shut down. The next time I started up the PC, the tray went back in but then... I got nothing. No boot up screen.. no signal to the monitor. I just get repetitive , rapid beeps coming from the internal speaker. (the tiny one on the mother board. It sounds something like morse code but with just one tone). The power indicator LED on the from of the PC flickers in sync with the beeping.
I did a hard reboot and it didn't work.
I've now pulled out most of the components of the PC (graphics card , hard drive, network card ect) to try and figure out where the problem is..
Now, the only components still fixed are the most essential ; the processor, the mother board and the power supply.
That's all I know.. what do you guys think could be the problem?

Oh dear.. I think I'll leave it at that... ;-) Thanks for your help.

[QUOTE=Gribouillis;1117577]Apart from the sleep function, there is a Timer class in the threading module and there are timers in gui modules like tkinter and wxpython. Other ways to wait are the threading.Condition.wait() function, socket reading with a timeout and functions like which wait for I/O with an optional timeout.
Your choice depends on what you want to do exactly.[/QUOTE]
What I meant was 'how does python keep track of the passing seconds'? Does it count the clock pulses or something like that?

Thanks... that's what I needed. However, I'd like to know HOW a timer is created in python.

How can I make a program wait for a few seconds before proceeding? An example of where this would come in handy is when the program allows the user 5 seconds before it proceeds with some default option... can I do this using python?

[QUOTE=htrantk;1114492]This one didn't work. This is what I put

print 'Welcome to our weight conversion program!'

prompt for a number and confirm it

x = raw_input ('Enter a weight : ')
h = fx2.205 lbs = fx0.2642gal=fx0.26423.785l
print 'h'[/QUOTE]

what is 'fx'?
Here's what you should do.
x is the number that the user has entered.
define and print the following variables.
[CODE]x_L = x <conversion factor for Liters>
x_lbs = x
<conversion factor for lbs>
so the number you entered will first be converted from L to gal. Next, the program will assume that the number you entered is in kilograms and convert that number to lbs.