Hi,
Has anyone here got py.test running on Windows? How do I run a test
script?
I have previously installed and used it on Linux and it all worked
magically - all I needed to do was type in "py.test ".
However on windows, the installation doesn't seem to set the paths
appropriately.
Thanks,
Hi Folks
Another newbie here :) Heres a couple of questions:
1) I downloaded the python serial port module (pyserial-2.2.win32.exe)
from http://sourceforge.net/project/showfiles.php?group_id=46487
And installed it on my Win XP PC.
However, when I try to import the module, I get the foll: err
Hi,
A quick one...
How do I split a string like "Hans" into a list of characters
['H','a','n','s']?
Note that there are no spaces in the original string.
Str.split() without any arguments looks for whitespace as splitting
character. So, this doesn't serve the purpose.
And str.split("") app
Bingo :)
Thanks Rick
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Pasotto
Sent: Tuesday, 23 August 2005 1:55 p.m.
To: tutor@python.org
Subject: Re: [Tutor] Split a string into characters
On Tue, Aug 23, 2005 at 01:18:43PM +1200, Hans
Hi
Am trying to get my head around classes in python.
I have a file dummy_class.py with a class definition in it, as foloows
class dummy_class:
def __init__(self):
print "__init__"
def run(self):
print "run"
Now, I have another file test_dummy.py, which only has th
or your help (and time). U guys are awesome :)
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Thursday, 25 August 2005 12:17 p.m.
To: Hans Dushanthakumar
Cc: Tutor
Subject: Re: [Tutor] Importing modules/classes
> class dummy_class:
> def __init__(self):
>
Hi,
While running the foll script by double-clicking it (under WinXP), it
runs as expected. However, when I run it via IDLE, it hangs after a few
secs (no runtime errors - just hangs). Why does this happen?
Cheers
Hans
import threading
class incr_num(threading.Thread):
num = ''
d
nt.
Cheers
Hans
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Thursday, 25 August 2005 11:23 p.m.
Cc: tutor@python.org
Subject: Re: [Tutor] Differences in running a multithreaded script under
IDLE and otherwise
Hans Dushanthaku
Hi,
In a multithreaded program, how do I ensure that a block of code in a
thread is always executed fully before passing control to another
thread. Does "Lock" serve this purpose?
The foll program is a dummy one, with 2 threads. One put a number onto a
queue (of max size 1) and the other thread
Thanks Kent
How do I send a signal from the main thread to stop execution of a child
thread?
I tried the foll:, but got an error:
Other than by this method, is there any other mechanism to stop a
thread?
import threading
import time
class shownum(threading.Thread):
def __init__(self
Oops - the error was probably due to using 'stop' as a method name.
:)
-Original Message-----
From: Hans Dushanthakumar
Sent: Tuesday, 30 August 2005 2:18 p.m.
To: tutor@python.org
Subject: Killing a thread from main - was RE: [Tutor] "Lock"ing threads
Thanks Kent
Ho
print outputs the string to the std output (sys.stdout). You could
redirect the std output to a file instead of the screen as follows, but
it's a bit clumsy.
fptr = open("hans.log", "a+")
import sys
sys.stdout = fptr
print "Hi there"
This will output the string into the file hans.log. However, t
U might wanna change the code to something along the lines of
def getcredits(num):
if num < 7:
return 'Freshman'
elif num >= 7 and num <16
return 'Sophomore'
elif num >= 16 and num < 26:
return 'Junior'
Etc...
Or even
def getcredits(num):
if num < 7:
Ive worked on a similar application. I used one thread to read from the serial
port and another one to handle the writes.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hugo González
Monteverde
Sent: Tuesday, 15 November 2005 7:36 a.m.
To: nephish
Cc:
port
Release lock
Cheers
Hans
-Original Message-
From: nephish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 November 2005 10:47 a.m.
To: Hans Dushanthakumar
Cc: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
well thats encouraging, did you have to do
Lock() is provided by the threading module.
see
http://docs.python.org/lib/module-threading.html
&
http://docs.python.org/lib/lock-objects.html
Cheers
Hans
-Original Message-
From: nephish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 November 2005 11:23 a.m.
To: Hans Dushanthakuma
===
Cheers
Hans
-Original Message-
From: nephish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 November 2005 2:10 p.m.
To: [EMAIL PROTECTED]
Cc: Hans Dushanthakumar; tutor
Subject: Re: [Tutor] question about serial coms
oh yeah, i will need this too!
sk
On Mon,
A short-cut if you dont want to use DOS to traverse to your
directory or if you are feeling too lazy to type in the entire path & script
name.
You can right-click on the script file in the Windows
explorer and choose "Send to -> Command prompt". This opens a command prompt
with the path al
Hi,
Im trying to convert a python program to a stand-alone executable
that I can distribute. How do I use py2exe to do this?
The python program consists of a py script that uses (imports)
several other modules (py scripts) located in another directory.
Heres what Ive tried so far:
1) Run
Hi folks,
How do I pass a list by value to a function.
The foll: snippet of code produces the output as shown:
Code:
-
def junk(x):
x.append("20")
return x
a = ["10"]
b = junk(a)
print b
print a
Output:
---
>>>
b = ['10', '20']
a = ['10', '20']
This indicates that the
Tuesday, 6 December 2005 1:49 p.m.To: Hans
DushanthakumarSubject: Re: [Tutor] How to Pass lists by
value
On 06/12/05, Hans Dushanthakumar <[EMAIL PROTECTED]>
wrote:
Hi
folks, How do I pass a list by value to a function.The
foll: snippet of code produces the output as
sho
Thanks for your valuable feedback guys.
Cheers
Hans
-Original Message-
From: w chun [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 6 December 2005 9:11 p.m.
To: Hans Dushanthakumar
Cc: tutor@python.org
Subject: Re: How to Pass lists by value
On 12/5/05, Kent Johnson <[EMAIL PROTEC
Hi,
Is there any easy way of writing lists to a file and more
importantly, reading it back as a list of lists rather than as a list of
strings.
Eg:
>>> t = ["t1", "PASS", 31]
>>> f = open("pass.txt","a+")
>>> f.write(str(t) + "\n")
>>> f.write(str(t) + "\n")
>>> f.close()
At this stage, the
Anothet linux noobie here :)
How do I uninstall python? I use the SimplyMepis flavor of linux.
The reason I want to uninstall python is that its an old version (2.3).
Not that I particularly want the new version, but the IDLE installation
that I downloaded reports all kinds of errors because appar
Hi,
Is there any way to disable an entire frame (and all its included
widgets) in Tkinter. It does not seem to support state=DISABLED.
Another Tkinter question: In a listbox, how do I intially set a
"selected" item? What I want to do here is have the 1st item in a
listbox selected (ie highlight
o_children():
self.setState(child, state=state)
Cheers
Hans
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Fouhy
Sent: Friday, 6 January 2006 12:03 p.m.
To: tutor@python.org
Subject: Re: [Tutor] Disabling a frame in Tkinter
On 06/0
Hi,
Can a script return multiple values to the os?
What I have in mind is something like the following:
1) Test.py
---
import sys
r = 7
sys.exit(r)
# What I really want to do is something along the lines of sys.exit(r,
"Hans")
2) Script1.py (This script executes script test.py and pri
ginal Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Thursday, 12 January 2006 12:06 p.m.
Cc: Python Tutor
Subject: Re: [Tutor] Returning multiple values from a script
Hans Dushanthakumar wrote:
> Hi,
>Can a script return multiple values to th
Subject: Re: [Tutor] Returning multiple values from a script
Hans Dushanthakumar wrote:
> Yes I agree that it'd be cleaner to import the second script and call
> it.
>
> The reason I'm keen to find a alternate method is that I have a whole
> lot of scripts that were design
= test.run_test()
Cheers
Hans
-----Original Message-
From: Hans Dushanthakumar
Sent: Thursday, 12 January 2006 2:28 p.m.
Cc: Python Tutor
Subject: RE: [Tutor] Returning multiple values from a script
Thanks for your reply Kent.
Is it possible to dynamically import a module?
The foll s
Try this:
print word[::-1]
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of ryan luna
Sent: Thursday, 19 January 2006 12:13 p.m.
To: tutor@python.org
Subject: [Tutor] Strings backwards
Hello, what i need to do is get user input and then print the string
Under WinXP, the variable
sys.argv[0] holds the script file name (including the path). Not sure,
but it may work the same under Linux as well.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Bryan Carbonnell
Sent: Tuesday, 31 January 2006 3:11 p.m.
To: tu
Hi,
Not sure if this is a python thing or a Operating system peculiarity,
but here goes:
Why does the line
print "FirstLine" + "\rSecondLine"
produce different output when run via IDLE and when run in the python
prompt (both under Windows XP)?
Output in IDLE (ver 1.1.1, python 2.4.1):
>>> print
Thanks Alan for clearing that up...I was trying to see why my "\r\n"
does not print 2 empty lines when I stumbled across this 'gotcha'.
-Original Message-
From: Alan Gauld [mailto:[EMAIL PROTECTED]
Sent: Monday, 20 February 2006 9:22 p.m.
To: Hans Dushanthakum
Hi,
How do I use python for basic web-tasks
like inputting data or clicking buttons on web-pages. For eg, how do I enter my
username and password and click on the "OK" button on the yahoo mail
page?
I had
a look at the webbrowser module documentation (http://www.python.org/doc/current/lib
ECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dustin J. Mitchell
Sent: Monday, 7 August 2006 11:45 a.m.
To: tutor@python.org
Subject: Re: [Tutor] Python for basic web-testing
Hans Dushanthakumar wrote:
> Hi,
>How do I use python for basic web-tasks like inputting data or
> clicking
G'day everyone.
I'm experimenting with a custom console application, and trying to add
command history functionality to it. It seems to basically work ok
except for the fact that when I press the Up arrow key to run previous
commands, the right commands are not displayed. It displays a wierd
37 matches
Mail list logo