Hi
My Python project's directory structure looks like this:
myproj - gui
|
|-- python
The 'gui' folder contains my main.py. The 'python' folder contains various
modules that we have written.
My gui/main.py contains this sort of import code:
import os, sys
sy
> If you don't want to let the original timeout error bubble up you can create
> your own little hierarchy of exceptions:
>
> class ResponseError(Exception):
> pass
>
> class TimeoutError(ResponseError):
> pass
>
> class BadDataError(ResponseError):
> pass
>
> Then the baseclass of
Hi
Consider a 'send' method that sends a message to another system via a socket.
This method will wait for a response before returning. There are two possible
error conditions:
1) Timeout - i.e. no response received
2) Illegal response received
I need to communicate these errors
> data = array.array("i", inf.read())
Thanks for all the answers to my question. I used the array method in the end.
Best regards
David
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mail
Hi
I have a binary file of 32-bit unsigned integers. I want to read all those
integers into a list.
I have:
ulData = []
with open(ulBinFileName, "rb") as inf:
ulData.append(struct.unpack('i', inf.read(4)))
This obviously reads only one integer from the file. How would I modify
If I have a script called main.py and document a function in it:
def get_value(x):
"""
Some text ...
:param x: Some value
:returns: Something useful
"""
What is the most basic way of showing those docstrings at the
>> If I have a script called main.py and document a function in it:
>>
>> def get_value(x):
>> """
>> Some text ...
>> :param x: Some value
>> :returns: Something useful
>> """
>>
>> What is the most basic way of showing those docstrings at the Python
>> prompt?
>
> Tr
Hi
If I have a script called main.py and document a function in it:
def get_value(x):
"""
Some text ...
:param x: Some value
:returns: Something useful
"""
What is the most basic way of showing those docstrings at the Python prompt?
For getting started with document
Thanks very much for all the answers to my question. I have taken the advice to
return a list of differing files, rather than raise an exception.
I do have a follow-up question:
I have a list of paths that contain files I want to check.
paths = [pathA, pathB]
then I check the files in each pa
Hi
I have a function that compares a set of files with a reference set of files.
All files are compared and then, if any differences were found, an exception is
raised:
class Error(Exception): pass
def check_results(file_list):
if isDifferent:
raise Error('One or more resul
Hi
I have a solution for this now.
Best regards
David
> -Original Message-
> From: Tutor [mailto:tutor-bounces+david.aldrich=eu.nec@python.org]
> On Behalf Of David Aldrich
> Sent: 15 June 2015 12:03
> To: tutor@python.org
> Subject: [Tutor] How to import a dicti
Hi
I have defined a dictionary in a module:
mydir.py:
REG_LOOKUP = {
'REG_1' : some_value1,
'REG_2' : some_value2,
}
How would I import that dictionary from my main() function (which lives in a
different module) please?
Best regards
David
12 matches
Mail list logo