On an import python looks for the module in the directories specified in
sys.path.
The documentation on sys.path says:
"As initialized upon program startup, the first item of this list is the
directory containing the script that was used to invoke the Python
interpreter." [1]
So it`s importa
Hi,
Kevin Holleran wrote:
Traceback (most recent call last):
File "testing.py", line 1, in
from Sub_Dir.My_Class import *
ImportError: No module named Sub_Dir.My_Class
Make sure, the script you execute by passing it to the python
interpreter is in the parent directory of Sub_Dir.
A
Hi,
do a "print sp" after the split and you might see that the strings don't
look as you expected. There might be leading or trailing whitespaces in
the splitted strings and in sp[10] there probably is a line break "\n"
at the end.
To remove those unwanted characters you could use the strip()
Chris Angelico wrote:
The other thing you may want to consider, if the values are supposed
to be integers, is to convert them to Python integers before
comparing. Currently, you're working with strings. Replace this:
if sp[9] == sp[10]:
with this:
if int(sp[9]) == int(sp[10]):
I thought of t
Chris Angelico wrote:
I'd not consider the performance, but the correctness. If you're
expecting them to be integers, just cast them, and specifically
_don't_ catch ValueError. Any non-integer value will then noisily
abort the script. (It may be worth checking for blank first, though,
depending o
Am 24.01.2013 13:02, schrieb Chris Angelico:
On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. wrote:
Chris Angelico wrote:
I'd not consider the performance, but the correctness. If you're
expecting them to be integers, just cast them, and specifically
_don't_ catch ValueError.
Hello guys,
I am using the asyncio package (Codename 'Tulip'), which will be
available in Python 3.4, for the first time.
I want the event loop to run a function periodically (e.g. every 2
seconds). PEP 3156 suggests two ways to implement such a periodic call:
1. Using a callback that resched
Thanks a lot for your helpful posts, Terry!
On 11/23/2013 01:00 AM, Terry Reedy wrote:
* Make the task function a parameter 'func'.
I actually like subclassing, but yes I know there are some downsides :)
* Rename start to _set to better describe what is does and call it in
the _run function
Thanks Phil, now I understand!
I wasn't aware of the fact that tasks are automatically attached to the event
loop when they are created via their constructor. I thought I have to pass them
to a run_* method explicitly.
Phil Connell schrieb:
>On Sat, Nov 23, 2013 at 09:30:29PM +0100
Hello,
I am currently writing an event-driven client library for a network
protocol [1] and chose to use the new asyncio module. I have no
experience with asynchronous IO and don't understand all the concepts in
asyncio yet. So I'm not sure if asyncio is actually the right choice .
My goal:
Thanks for your answers! I didn't have the time to test any of your
suggestions so far but they already gave me something to think about. At
least now I'm much more clearer on what I am actually looking for.
On 23.12.2013 20:59, Terry Reedy wrote:
What would be easiest for user-developers wou
On 24.12.2013 17:07, vanommen.rob...@gmail.com wrote:
Hello, for the first time I'm trying te create a little Python program. (on a
raspberri Pi)
I don't understand the handling of variables in a loop with Python.
Lets say i want something like this.
x = 1
while x <> 10
var x = x
12 matches
Mail list logo