On 2013.08.27 12:44, Paul Pittlerson wrote:
Security issue!? Do you mean someone could enter devious python h4xx into the
chat or something? I had no idea using pickle was so dangerous, but I don't
know any other method of transmitting data in python :(
JSON, XML, or any other format that
On 2013.09.04 22:39, Dennis Lee Bieber wrote:
On Wed, 04 Sep 2013 07:26:47 +0200, Steve Hayes hayes...@telkomsa.net
declaimed the following:
Can anyone recommend a web site that gives a good beginner's guide to Python?
One that tells one, especially --
-- what kind of projects Python is good
On 2013.10.23 22:23, Victor Hooi wrote:
For example:
def run_all(self):
self.logger.debug('Running loading job for %s' % self.friendly_name)
try:
self.export_to_csv()
self.gzip_csv_file()
self.upload_to_foo()
On 2013.10.24 20:09, Victor Hooi wrote:
Also, @Andrew Berg - you mentioned I'm just swallowing the original exception
and re-raising a new RuntimeError - I'm guessing this is a bad practice,
right? If I use just raise
except Exception as err: # catch *everything
On 2012.09.11 19:17, Peter wrote:
If your desire is to learn Python then I would stick to 2.7
My reasoning would be that there are still a significant number of packages
that have not been ported to 3.x (and may never be ported).
This is true, but the /potential/ for the need for one of
On 2012.09.20 21:31, Dave Angel wrote:
I don't have a Windows machine set up right now, but I believe there are
two more directories to search, besides the ones described in the PATH
variable.
One is the current directory, and the other is the Windows directory
(maybe also the xxx/system32
On 2012.09.22 02:08, Jamie Paul Griffin wrote:
I find this intriguing, I had no idea bots existed to post to mailing
lists in this way. What's the point of them?
To amuse their owners is my guess.
--
CPython 3.3.0rc2 | Windows NT 6.1.7601.17835
--
On 2012.09.29 15:03, David Dillard wrote:
With the release of Python 3.3.0 does that mean the 3.2.x line is now end of
life?
No. Old releases get security fixes for years.
I've looked for some sort of end of life policy on python.org, but was unable
to find one.
On 2012.09.30 14:14, Edward Diener wrote:
The situation is so confusing on Windows, where the file associations,
registry entries, and other internal software which allows a given
Python release to work properly when invoking Python is so complicated,
that I have given up on trying to
On 2012.09.30 22:06, Edward Diener wrote:
The problem with that is that one has to already being using 3.3 to use
this facility. I was hoping for a solution which was backwards
compatible with Python 2.x.
It's a separate tool that comes with 3.3. You can install 3.3 and never
use the actual
On 2012.10.04 00:13, Shambhu Rajak wrote:
Here i have two questions,
1. I want to write a framework for Linux machine that can execute
commands on windows machine:
How to create a persistent shell between Linux and Windows machine.
2. I require to extract windows disk
On 2012.11.07 17:27, Oscar Benjamin wrote:
Are you using cmd.exe (standard Windows terminal)? If so, it does not
support unicode
Actually, it does. Code page 65001 is UTF-8. I know that doesn't help
the OP since Python versions below 3.3 don't support cp65001, but I
think it's important to point
On 2012.11.08 08:06, Oscar Benjamin wrote:
It would be a lot better though if it just worked straight away
without me needing to set the code page (like the terminal in every
other OS I use).
The crude equivalent of .bashrc/.zshrc/whatever shell startup script for
cmd is setting a string value
On 2012.11.09 11:17, danielk wrote:
I'm converting an application to Python 3. The app works fine on Python 2.
Simply put, this simple one-liner:
print(chr(254))
errors out with:
Traceback (most recent call last):
File D:\home\python\tst.py, line 1, in module
print(chr(254))
On 2012.11.09 15:17, danielk wrote:
I guess the question I have is: How do you tell Python to use a specific
encoding for 'print' statements when I know there will be characters outside
of the ASCII range of 0-127?
You don't. It's raising that exception because the terminal cannot
display
On 2012.12.25 23:26, iMath wrote:
why print(e) cannot print out any information ?
If you want to manipulate tracebacks, use sys.exc_info() and the
traceback module from the standard library. The logging module also
comes with an exception() function and an exception() method for Logger
objects
On 2012.12.28 00:51, Jamie Paul Griffin wrote:
The benefit of the tmux client (terminal multiplexer) is that I can see
all the screens at the same time and quickly switch between them. I
believe Linux has screen(1) which does the same thing.
tmux is generally easily available for Linux, and
On 2012.12.28 09:30, philip.a.mol...@gmail.com wrote:
Is the Python directory (i.e. C:\Python33) assigned to the PATH variable
using the Batch PATH built-in command? If so, where?
As of Python 3.3, there is a py.exe in the system32 directory that
launches the appropriate version of Python for
On 2012.12.30 22:18, contro opinion wrote:
here is my haha class
class haha(object):
def theprint(self):
print i am here
haha().theprint()
i am here
haha(object).theprint()
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: object.__new__() takes no
On 2013.11.16 11:02, Paul Smith wrote:
The one that really irks me is people using loose when they mean
lose. These words are not related, and they don't sound the same.
Plus this mistake is very common; I typically see it at least once a
day.
Don't be surprised if such people pronounce them
On 2013.11.16 22:16, Chris Angelico wrote:
I decided a while ago that my life would be alot better[1]
For those who haven't yet seen it:
http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html
--
CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0
--
On 2013.11.18 17:56, Ed Taylor wrote:
This will be very simple to most of you I guess but it's killing me!
print (Please type in your age)
age = input ()
leave = 16
print (You have + leave - age + years left at school)
I want to have an input where the users age is inserted and then
On 2013.11.25 14:48, Eamonn Rea wrote:
I've heard that there is a library that allows you to get the appdata
directory for a given OS, but I'd like to do it myself, as a learning
experience.
Is there a built in way to get a users Appdata Directory? For example on OS X
it's in
On 2013.12.26 23:04, Travis McGee wrote:
The Python.org site says that the future is Python 3, yet whenever I try
something new in Python, such as Tkinter which I am learning now,
everything seems to default to Python 2. By this I mean that, whenever I
find that I need to install another
On 2013.12.30 15:56, Dan Stromberg wrote:
I keep hearing naysayers, nay saying about Python 3.x.
Here's a 9 question, multiple choice survey I put together about
Python 2.x use vs Python 3.x use.
I'd be very pleased if you could take 5 or 10 minutes to fill it out.
Here's the URL:
On 2014.01.29 23:56, Jessica Ross wrote:
I found something like this in a StackOverflow discussion.
def paradox():
... try:
... raise Exception(Exception raised during try)
... except:
... print Except after try
... return True
... finally:
To download Python 3.3.0 visit:
http://www.python.org/download/releases/3.3.0/
The Windows links point to 3.3a1 installers, even though the links say
3.3a2.
--
CPython 3.2.2 | Windows NT 6.1.7601.17640
--
http://mail.python.org/mailman/listinfo/python-list
cx_Freeze is the only program that can freeze py3k code that I know of.
I didn't have any major issues with it, but I've only played with it.
In any case, if you're going to roll your own, I'd be happy to help test it.
--
CPython 3.2.2 | Windows NT 6.1.7601.17640
--
On 4/7/2012 8:07 AM, Bill Felton wrote:
We are using Python 3.2 and tkinter. It appears, and limited testing bears
out, that py2app, and presumably py2exe, are not options given lack of 3.x
support.
cx_Freeze supports Python 3.2. It works fine for my purposes, but I have
not done any serious
On 4/7/2012 11:59 AM, goldtech wrote:
I thought if I SSH
even from a Linux to a Windows machine whatever I say on the SSH
client command line would be the same as me doing a command on the
DOS command-line in Windows. I incorrectly thought SSH is just a
tunnel for text...
It gives you
On 4/9/2012 1:52 AM, Chris Angelico wrote:
I think this will be a real winner, and you
should team up with Ranting Rick to produce a new operating system and
Python with this new specification and RULE THE WORLD!
But only after going back to the cage to plan for tomorrow night.
--
CPython
On 4/9/2012 5:01 AM, Janis wrote:
I have this problem with my script exiting randomly with Linux OS
status code -9 (most often) or -15 (also sometimes, but much more
rarely). As far as I understand -9 corresponds to Bad file descriptor
and -15 Block device required.
1) Is there a way how I
On 4/14/2012 1:25 PM, vmars316 wrote:
I installed portablePython(pP) here:
C:\Users\vmars\Python3
?Does that look ok?
I would suggest including the minor version number (i.e. Python32
instead of Python3) because not all 3.x code is compatible with all
versions of Python 3.x - all code that
On 4/15/2012 3:01 PM, Bryan wrote:
I'd like to encourage my users to check out
Python 3, but installing it on Windows will take over the '.py'
extension and break stuff that currently works.
Have you tried telling your users to tell the installer not to do that?
IIRC, it's a simple checkbox
On 4/15/2012 11:30 PM, vmars316 wrote:
Isn't there a way just to doubleClick on myProg.py, to get it into the
interpret/RUN?
Use the standard installer from python.org if you want to do things with
the registry. The standard installer sets up the registry for you so
that the interpreter will be
On 4/26/2012 6:37 AM, Kiuhnm wrote:
Python has been forked into 2.x and 3.x because some breaking changes
ought to be made to the language in order to improve it and clean it up.
That's not really a good way to put it. 2.6 and 2.7 will get security
fixes, but there won't be a 2.8 unless someone
On 4/26/2012 8:02 AM, deuteros wrote:
So how do I tell my IDE (Eclipse with PyDev) which version of Python I
want to use?
When you start a new PyDev project, it will ask.
--
CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790
--
http://mail.python.org/mailman/listinfo/python-list
On 4/28/2012 6:45 PM, Temia Eszteri wrote:
Professional? He's boring!
I agree. Ranting Rick is much more entertaining (usually).
--
CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790
--
http://mail.python.org/mailman/listinfo/python-list
Why wouldn't a for loop work? If something works, you can break out,
otherwise continue.
working_obj = None
for obj in iterable:
try:
obj.do_something()
working_obj = obj
break
except:
continue
--
CPython 3.3.0a3 |
Forgot to add that all this is covered in the tutorial in the official docs:
http://docs.python.org/tutorial/controlflow.html#for-statements
--
CPython 3.3.0a3 | Windows NT 6.1.7601.17790
--
http://mail.python.org/mailman/listinfo/python-list
On 5/3/2012 7:36 PM, Peng Yu wrote:
When convert two sets with the same elements to two lists, are the
lists always going to be the same (i.e., the elements in each list are
ordered the same)? Is it documented anywhere?
Sets are by definition unordered, so depending on their order would not
be
On 5/9/2012 4:25 PM, Alan Ristow wrote:
Select the code block you want to indent and hit Tab. To do the reverse,
hit Shift-Tab.
You can also select a code block and choose Shift Right or Shift
Left from the context menu.
--
CPython 3.3.0a3 | Windows NT 6.1.7601.17790
--
On 5/17/2012 6:48 AM, Mark R Rivet wrote:
I am in the process of learning python, and want to learn tkinter for
GUI stuff. Is tkinter what people are using for GUI?
tkinter is one of several GUI toolkits that can be used with Python.
IIRC, most people use PyGTK or PyQt for serious projects.
On 5/22/2012 6:44 PM, Gelonida N wrote:
I'd like to install python 2.6 and 2.7 on Windows?
In fact I have already 2.6 installed and would like to additionally
install 2.7
When clicking on .py file I'd like to execute it with python 2.6
There is an checkbox for an option to
On 5/23/2012 3:25 PM, Gelonida N wrote:
So I just install 2.7 and uncheck this box and I'll keep 2.6 right?
Different versions are installed in different locations by default, and
if you uncheck that box, the installer will leave file associations alone.
--
CPython 3.3.0a3 | Windows NT
On 5/24/2012 8:59 PM, Dave Angel wrote:
so I fixed that, and got
inconsistent use of tabs and spaces in indentation
because you mistakenly used tabs for indentation.
Not to start another tabs-vs.-spaces discussion, but tabs are perfectly
legal indentation in Python. That exception is
On 5/30/2012 1:52 AM, ru...@yahoo.com wrote:
Was there a reason for dropping the lexical processing of
\u escapes in strings in python3 (other than to add another
annoyance in a long list of python3 annoyances?)
To me, this would be a Python 2 annoyance since I would expect r'\u3000'
to be
On 6/3/2012 5:01 PM, Janet Heath wrote:
Thanks Alain. I should have a compiler on my Mac OS X Lion. I am thinking
that it isn't set in my $PATH variable. I don't know where the $PATH is set
at. I will check to see if their is a binary.
There are always Windows and OS X binary installers
On 6/6/2012 1:45 PM, MRAB wrote:
On 06/06/2012 18:23, Jugurtha Hadjar wrote:
[snip]
range returns a « generator », convert it to list to see.. --
converts instead of convert.
No, convert is correct here; it's the imperative, i.e. convert it to
a list if you want to see
frequently
On 6/10/2012 4:22 AM, Alexey Gaidamaka wrote:
Practically the plugin is a simple html archive from python
documentation website running
inside Eclipse so you can call it using Eclipse help system.
As for now it is pretty large (~7 mb), but i'm planning to optimize it
in near future.
Rather
On 6/13/2012 1:17 AM, John Nagle wrote:
What does urllib2 want? Percent escapes? Punycode?
Looks like Punycode is the correct answer:
https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode
I haven't tried it, though.
--
CPython 3.3.0a3 | Windows NT 6.1.7601.17790
On 6/15/2012 11:31 PM, contro opinion wrote:
is the /usr/lib/python-3.2.3/bin/python3 same as
/usr/lib/python-3.2.3/bin/python3.2?
It should be. IIRC, ls -l will tell you if something is a link. You
could also run python3 and it will tell you the version.
--
CPython 3.3.0a4 | Windows NT
On 6/17/2012 7:07 PM, Jon Clements wrote:
I'm reminded of:
http://xkcd.com/936/
http://xkcd.com/792/
There's also one where it's pointed out it's easier to brute force a
person who has the code, than brute force the computer. [but can't find
that one at the moment]
Perhaps this will clear things up:
Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC
v.1600 64 bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
ua = u'a'
literal_ua = u'a'
ua == literal_ua
False
input_ua = input()
u'a'
input_ua
u'a'
On 6/18/2012 11:32 AM, Jussi Piitulainen wrote:
jmfauth writes:
Thinks are very clear to me. I wrote enough interactive
interpreters with all available toolkits for Windows
r = input()
u'a
Traceback (most recent call last):
File stdin, line 1, in module
SyntaxError: u'a
Er, no,
On 6/18/2012 12:03 PM, Dave Angel wrote:
And you're missing the context. jmfauth thinks we should re-introduce
the input/raw-input distinction so he could parse literal strings. So
Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams.
You're right. I missed that part of
Are there any tools out there that will parse a script and tell me if it
is compatible with an arbitrary version of Python and highlight any
incompatibilities? I need to check a few of my scripts that target 3.2
to see if I can make them compatible with 3.0 and 3.1 if they aren't
already. I found
On 6/21/2012 10:42 PM, Xander Solis wrote:
Hello Python list,
Noob here with a newbie question. I'm reading and working on the
exercise of the book, Learn Python the Hard way 2.0. When I use this
code, I get None on the output. My question is why does this happen?
Your function prints the
On 6/23/2012 7:16 PM, gmspro wrote:
Why is python source code not available on github?
If you mean CPython, it's because the devs use Mercurial and have their
own hosting on python.org.
hg clone http://hg.python.org/cpython
http://docs.python.org/devguide/setup.html
github is far from the only
On 6/25/2012 12:27 AM, Charles Hixson wrote:
The documentation section covering the except statement could stand to
be a *LOT* clearer. I read the sections on the except statement and
exception handlers several times and couldn't figure out was the as
argument of the except statement was
On 6/23/2012 10:46 PM, gmspro wrote:
What's wrong editing/customizing/changin python2.7 instead of making a
seperate language?
py3k is not a separate language. In fact, it is possible to maintain a
codebase that supports 2.2 (maybe even older), 3.3, and every version in
between.
What's wrong
On 6/28/2012 12:11 PM, David Thomas wrote:
Hi,
I have the following error regarding a loop tutorial found on
http://www.sthurlow.com/python/lesson04/
a=0
while a10:
... a=a+1
File stdin, line 2
a=a+1
^
IndentationError: expected an indented block
You indented in the IDE,
On 6/29/2012 10:58 AM, David Thomas wrote:
Just discovered this in the tutorial further down. I'm currently learning
Python 2 because there seems to be a lot of tutorials out there covering
Python 2 rather than 3.
The latest edition (3rd?) of Programming Python by Mark Lutz covers py3k
(it
On 7/1/2012 1:53 PM, Thomas Jollans wrote:
As far as I can tell, there are no concrete plans to integrate
concurrency better, or get rid of the GIL, at the moment. To quote
http://wiki.python.org/moin/GlobalInterpreterLock
Getting rid of the GIL is an occasional topic on the python-dev
On 7/2/2012 7:49 PM, self.python wrote:
Traceback (most recent call last):
File C:wrong.py, line 8, in module
print rf.read().decode('utf-8')
UnicodeEncodeError: 'cp949' codec can't encode character u'u1368' in position
This has probably been discussed before, but why is there an implicit
conversion to a boolean in if and while statements?
if not None:
print('hi')
prints 'hi' since bool(None) is False.
If this was discussed in a PEP, I would like a link to it. There are so
many PEPs, and I wouldn't know
On 7/15/2012 5:56 AM, Steven D'Aprano wrote:
3) Rather than distinguishing true from false, a more useful
dichotomy is between something and nothing. Python includes a number
of ways of spelling nothing of various types, such as:
None, 0, 0.0, '', [], {}, set()
and nearly everything
On 7/15/2012 11:19 AM, Ian Kelly wrote:
Ugh, that's irritating. I can't think of any scenario where I would
ever want the semantics if timeval (is not midnight):.
It's not implemented with such a test, but
logging.handlers.TimedRotatingFileHandler has an option to rollover at
midnight.
--
On 7/15/2012 9:38 PM, Steven D'Aprano wrote:
I would expect None to mean doesn't exist or unknown or
something like that - e.g., a value of 0 means 0 jelly beans in the jar
and None means there isn't a jar.
How you interpret some_variable = None depends on what some_variable
represents. If
On 7/15/2012 3:28 PM, Terry Reedy wrote:
Because everything does (or should).
I can see how truth testing for empty values is convenient, but perhaps
objects should only have a truth value if explicitly given one -
particularly in cases where such a value wouldn't be obvious or the
obvious value
On 7/16/2012 7:43 PM, Steven D'Aprano wrote:
The existence of a jar or no jar is irrelevant to the question of how
many jellybeans there are. They are two different things, and therefore
need two different values. There are many ways to implement this.
I have a better real example, but I
On 7/16/2012 11:11 PM, Steven D'Aprano wrote:
If you are right that SimpleNamespace should be treated as a container,
then it should implement container semantics. Since it doesn't, that is
either:
1) a bug; or
2) a triumph of laziness over correctness
I imagine though that the Python
On 7/16/2012 11:39 PM, Steven D'Aprano wrote:
If you need three (or four, or fifty)
distinguishable states, then obviously boolean context will not solve
your problem. I never said it would.
That is the impression I got from this statement:
How you interpret some_variable = None depends on
On 7/17/2012 2:08 AM, Steven D'Aprano wrote:
The default behaviour is that every object is something, hence true-like,
unless explicitly coded to be treated as false-like. Since both loggers
and functions are objects, they are true-like unless the default is
overridden.
I am aware of the
On 7/17/2012 6:01 AM, Lipska the Kat wrote:
Anyway, I'm looking at Python as a rapid prototyping language.
I have an idea and just want to get it down in basic outline code as
quickly as possible before it departs my aging brain... I'm not used to
using variables without declaring their type
On 7/17/2012 6:44 AM, Lipska the Kat wrote:
I'll check it out, thanks.
I forgot to add this:
http://wiki.python.org/moin/Python2orPython3
It's a little outdated (there is more progress toward py3k by 3rd-party
libraries every day), but still quite helpful.
--
CPython 3.3.0b1 | Windows NT
On 7/17/2012 9:01 AM, Lipska the Kat wrote:
Wow, that was a blast from the past
Just downloaded, unzipped, untarred, configured, made and installed
python 3.2.3 ... it's YEARS since I've done this, makes me feel young again.
Most Linux distributions should have a premade package for stable
On 7/17/2012 12:30 PM, Terry Reedy wrote:
(In some ways, it is already better than 3.2.3.)
I certainly make heavy use of some of the new features. I'm not sure we
can have enough separate exceptions for OS errors without exhausting
every possibility and I might start looking for excuses to use
On 7/18/2012 9:34 AM, Grant Edwards wrote:
people who us tabs are wrong
Don't make me get my flamethrower!
and people who mix spaces and tabs -- well, we don't
talk about them in polite company.
Mixing can make sense, but not in Python.
*hides*
--
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
On 7/21/2012 2:33 AM, Jan Riechers wrote:
Block
...
versus this block:
...
Now, very briefly, what is the better way to proceed in terms of
execution speed, readability, coding style?
Using if/else is the most readable in the general sense. Using return
(or break or continue as applicable)
On 7/21/2012 3:13 AM, Jan Riechers wrote:
Cause, as I understand the interpreter chooses either the else (1st
block) or just proceeds with following code outside the if.
If none of the if/elif statements evaluate to something true, the else
block is executed.
So if there is some overhead in
On 7/21/2012 5:48 AM, Dave Angel wrote:
Has anybody else noticed the sudden double-posting of nearly all
messages in the python mailing list?
I am also using the mailing list, but I haven't experienced this.
--
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
--
On 7/22/2012 3:37 AM, Lipska the Kat wrote:
Many in
the Linux world seem to use git. Seeing as I've been using Linux at home
since the early days of slackware I suppose I'd better look into it.
There are Mercurial (aka Hg) and Bazaar as well for DVCS. AFAIK, git,
Mercurial, and Bazaar are all
On 7/25/2012 6:05 AM, jaroslav.dob...@gmail.com wrote:
What I really want to do is use something like
try:
# open file, read line, or do something else, I don't care
except UnicodeDecodeError:
sys.exit(Found a bad char in file + file + line + str(line_number)
Yet, no matter
On 7/29/2012 7:12 PM, Rodrick Brown wrote:
Python is a glue language much like Perl was 10 years ago. Until the
GIL is fixed I doubt anyone will seriously look at Python as an option
for large enterprise standalone application development.
The GIL is neither a bug to be fixed nor an inherent
On 7/30/2012 9:25 PM, Steven D'Aprano wrote:
I don't. But in my experience, the risk of security breaches is *much*
less than the chance that the new version will break functionality,
introduce bugs, have a worse user interface, and generally be a step
backwards rather than forward.
4.0
On 8/5/2012 2:51 PM, John Mordecai Dildy wrote:
print We'd have %d beans, %d jars, and %d crabapples. %
secret_formula(start_pont
sentence = All good things come to those who wait.
You are missing a parenthesis at the end of the previous line.
.print_first_word(sorted_words)
That dot will
I've set up groups of arguments for a script I'm writing, and any time I
give an argument a value, it gets stored as a list instead of a string,
even if I explicitly tell it to store a string. Arguments declared with
other types (e.g. float, int) and default values are stored as expected.
For
On 2011.04.28 02:11 PM, Uncle Ben wrote:
It was suggested to me privately that I search for
HKEY_CLASSES_ROOT\*\shell,
right_click on shell,
create a new key called EDIT with IDLE
and another called command python.exe %1
The key you're looking for is HKCR\Python.File\shell. Add a subkey
I need to find whether a given file is 32-bit or 64-bit (and raise an
exception if the file doesn't exist or isn't an executable file). I
thought platform.architecture() would do this, but it returns ('64bit',
'') no matter what value I assign to the executable parameter (looks
like it uses the
On 2011.05.09 04:10 PM, Irmen de Jong wrote:
http://stackoverflow.com/questions/1345632/determine-if-an-executable-or-library-is-32-or-64-bits-on-windows
The code using struct doesn't look terribly complicated, so that could
work. I might need to inspect other executable types, but I don't see it
I'm a bit new to programming outside of shell scripts (and I'm no expert
there), so I was wondering what is considered the best way to handle
errors when writing a module. Do I just let exceptions go and raise
custom exceptions for errors that don't trigger a standard one? Have the
function/method
On 2011.05.11 12:57 PM, Patty wrote:
Hi Andrew -
Sometimes you want an exception come up and then use that information to
take your
program in some direction.
Right, but I'm wondering how I should handle errors in a module, where
different people will want their programs to do different
On 2011.05.11 01:05 PM, Roy Smith wrote:
You want to raise specific errors. Let's say you've got a function like
this:
def airspeed(swallow):
speeds = {european: 42,
african, 196}
return speeds[swallow]
If somebody passes an invalid string, it will raise KeyError as
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not defined. I don't know how to
define the exception.
--
On 2011.05.12 03:20 PM, Corey Richardson wrote:
class HelloError(Exception):
pass
Of course, there are all sorts of other things you could do with your
exception.
http://docs.python.org/tutorial/errors.html#user-defined-exceptions
So that's where that info is. I wasn't looking in the
I'm trying to understand why HMTLParser.feed() isn't returning the whole
page. My test script is this:
import urllib.request
import html.parser
class MyHTMLParser(html.parser.HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'a' and attrs:
On 2011.05.15 06:12 AM, Tim Golden wrote:
... and for Windows:
code
import wmi
for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1):
print nic.Caption, nic.IPAddress
/code
One thing I found out about Win32_NetworkAdapterConfiguration is that it
only contains /current/
On 2011.05.16 02:26 AM, Karim wrote:
Use regular expression for bad HTLM or beautifulSoup (google it), below
a exemple to extract all html links:
linksList = re.findall('a href=(.*?).*?/a',htmlSource)
for link in linksList:
print link
I was afraid I might have to use regexes (mostly
On 2011.05.18 03:30 AM, Stefan Behnel wrote:
Well, it pretty clearly states that on the PyPI page, but I also added it
to the project home page now. lxml 2.3 works with any CPython version from
2.3 to 3.2.
Thank you. I never would've looked at PyPI for info on a project that
has its own site.
1 - 100 of 399 matches
Mail list logo