There is a pretty complete (no pun intended) example in the standard
cmd module
http://docs.python.org/lib/module-cmd.html
Check file cmd.py in your Python installation .../lib/pythonX.Y/cmd.py,
specifically the methods Cmd.preloop() and Cmd.complete().
Another, more elaborate example
Is there an Index server available in Python? For example:
I have large intranet with several servers and I would like to index
documents like search engines do. Users then can search for a domument
in ALL intranet servers like I do on Google.
Thanks for answers
L.A.
--
http://mail.python.org
(from
where I download the pages) is rather poor.
Is there a solution how to prevent the script from hanging before all
pages are downloaded?
Thanks for help
Lad.
--
http://mail.python.org/mailman/listinfo/python-list
. Is it a good solution? Or is
there a better solution?
Thanks for help
Lad
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
Ola Natvig wrote:
[EMAIL PROTECTED] wrote:
Does anyone know
how to lanch a webbrowser ( from Python) without menu and
toolbars?
Thanks for help
Lad
You've got the webbrowser module which lauches the OS's standard
browser
from webbrowser import get
get
Hello,
How to post a news article with NNTPlib if the news server requires
login. I did not find nay login command in nntplib module.
Thank you
lad.
--
http://mail.python.org/mailman/listinfo/python-list
Do Re Mi chel La Si Do wrote:
Hi !
nntplib.NNTP(newsserver,port,user,passe)
--
Michel Claveau
Thank you
--
http://mail.python.org/mailman/listinfo/python-list
/python-list
.
--
http://mail.python.org/mailman/listinfo/python-list
Take a look at Pyrex.
http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/
More at
http://www-106.ibm.com/developerworks/library/l-cppyrex.html
/Jean Brouwers
Jamie R. Parent wrote:
Hello,
How do you go about taking a variable which was declared in C and
pass
that through
, prefix, units)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Below is a function to find the caller's file name, line number, etc.
inside Python. Maybe this works for your case.
/Jean Brouwers
- import traceback
-
- def caller(up=0):
- '''Get file name, line number, function name and
-source text of the caller's caller as 4-tuple
hello and thanks for reading this.
i am a long time windows/visual_basic user and i have been quite happy using
that.
i am doing a consulting project for a dry cleaning company.
in the past i would use windows and visual basic but i want to create an app
using python and linux using something
this.
in fact, the free version of the visual studio 2005, which is free, have this
ability.
so how can i use python to debug code and change that code without having to
restart the code.
thanks so much,
dave
--
http://mail.python.org/mailman/listinfo/python-list
pointing at,
i simple copy and paste the bad code line just below the actual code line.
i fix this copied code line.
then i just turn the bad line into a comment line and the debugger will move
the current focus to the next time, which
is the fixed code.
how can such a dynamic language like python
, line, func, text).
-
-The optional argument 'up' allows retrieval of
-a caller further back up into the call stack.
-
-Note, the source text may be None and function
-name may be '?' in the returned result. In
-Python 2.3+ the file name may be an absolute
|5]
print PORT # | PROTOCOL | PORT NAME | PORT DESCRIPTION
print myPort, myProtocol, myName, myDescription
cursor.close()
conn.close()
# end function -
grabPortInfo(22)
--
Lloyd Kvam
Venix Corp
--
http://mail.python.org/mailman/listinfo/python-list
On 15 mrt 2008, at 23:06, Mike Driscoll wrote:
On Mar 15, 3:09 pm, Eric von Horst [EMAIL PROTECTED] wrote:
Hi,
I am looking for Python modules that allow you to manipulate 3D
objects, more specifically Alias Wavefront .OBJ objects.
Also, a module that would allow you to vizualize
I understand that many portions of the string module are redundant with
the native methods of strings and will removed in Python 3.0. Makes
sense to me.
But what will happen to the portions of the string module that are not
covered by native string methods - like the following:
- string
Does Python 2.5.2's embedded SQLite support full text searching?
Any recommendations on a source where one can find out which SQLite
features are enabled/disabled in each release of Python? I'm trying to
figure out what's available in 2.5.2 as well as what to expect in 2.6
and 3.0.
Thank you
Is there an official list of all Python's __special-methods__?
I'm learning Python and trying to get an idea of what
__special-methods__ are available and specifically, what
__special-methods__ are used by each native Python data type?
Thanks!
Malcolm
--
http://mail.python.org/mailman/listinfo
Hrvoje,
Is there an official list of all Python's __special-methods__?
http://docs.python.org/ref/specialnames.html
Wonderful!! Thank you very much.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
While reading feedback to my post Does Python 2.5.2's embedded SQLite
support full text searching? I noticed that there appears to be some
confusion regarding whether Python 2.5 includes the SQLite engine.
My Windows 2.5.2 binary download includes SQLite.
But other posters claim otherwise, re
be an iterator(?) type
object that tracked file names and line numbers as it returns individual
lines.
Is there a Python parsing library to handle this type of task or am I
better off writing my own?
The effort to write one from scratch doesn't seem too difficult (minus
recursive file
define_regexp.sub(define_repl, line)
It would be easy to modify it to keep track of line numbers and file
names.
/snip
--
http://mail.python.org/mailman/listinfo/python-list
://mail.python.org/mailman/listinfo/python-list
in dictionary and lookup the function to be
called
Any suggestions on the best way to do this?
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
. a for-loop) that manually calls my file/stream
iterator/generator's .next() method while manually handling the
StopIteration exception. Doesn't sound too elegant.
Is there a Pythonic design pattern/best practice that I can apply here?
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python
George,
Is there an elegant way to unget a line when reading from a file/stream
iterator/generator?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502304
That's exactly what I was looking for!
For those following this thread, the above recipe creates a generic
object that wraps
Bruno,
Thank you for your detailed analysis. I learned a lot about Python
reading everyone's responses.
For development I'm using #5: globals().get(func) because its
seamless to add additional functionality.
But when I release into production I'm going to shift to #3: Place all
my functions
Duncan,
If speed is an issue then it may be better to avoid the test altogether ...
snipped
Thanks for your suggestion.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Hi Max,
Thank you for pointing out the pattern of my request.
Using your google query
(http://www.google.dk/search?hl=enq=python+factory+pattern) I found the
following description of what I'm doing.
Command Dispatch Pattern
http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#id26
] = func
return func
@register
def foo(): print Foo!
@register
def bar(): print Bar!
functions
{'foo': function foo at 0x6f2f0, 'bar': function bar at 0x6f330}
functions['bar']()
Bar!
/snip
--
http://mail.python.org/mailman/listinfo/python-list
Erik,
Perhaps I missed something earlier in the thread, but I really don't see the
need for that registry dict or the register decorator. Python already
maintains a dictionary for each scope:
The advantage of the decorator technique is that you explicitly declare
which functions are eligible
plan on posting your next update?
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Bad file names, i.e. filenames the OS considers illegal, will cause
functions in the os.path module to raise an error.
Example:
import os.path
print os.path.getsize( 'c:/pytest/*.py' )
On Windows XP using Python 2.5.2 I get the following traceback:
Traceback (most recent call last):
File
with a browser based interface as well.
I'm looking for feedback from anyone that has pondered the same question
as well as any pros/cons or tips from anyone that has chosen the
browser/lcoal web server route.
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
looking forward to hearing what others say on
this topic.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
looking forward to hearing what others say on
this topic.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Matimus and John,
Thank you both for your feedback.
Matimus: I agree with your analysis. I blame lack of caffeine for my
original post :)
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
James,
Check out the optparse module as well. The optparse module supercedes(?)
the cmd module and offers a lot more functionality.
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
/listinfo/python-list
level's label type, separators, and error checking. If there's an
existing, road tested class (with unit tests) that does this, I would
rather avoid re-inventing/re-testing the wheel.
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Pistacchio,
Templite
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496702
A light-weight (~40 lines), fully functional, general purpose templating
engine, allowing you to embed python code directly into your text. This
engine is suitable for any templating (not only HTML/XML
elegant approaches.
Its interesting to compare your two very different approaches. I will to
spend some more time studying your techniques before I choose a final
approach.
Thank you both again. I'm learning a lot of Python by studying your
examples! :)
Malcolm
--
http://mail.python.org/mailman
... are you
referencing formatter.py?
http://www.koders.com/python/fid4B7C6E1C20384FC7521414F46DF9DAA33DF2CA11.aspx
Thanks for your help on this - I'm learning a lot!
Malcolm
PS: throw( up ) ... very funny! :)
--
http://mail.python.org/mailman/listinfo/python-list
Dennis,
I was a touch bored in the last hour at work today so...
Thank you!!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
.__name__] = func
return func
@register
def foo(): print Foo!
@register
def bar(): print Bar!
functions
{'foo': function foo at 0x6f2f0, 'bar': function bar at 0x6f330}
functions['bar']()
Bar!
/snip
Thanks for your feedback,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Tim,
Sounds like an interesting project.
Have you considered using SnagIt to produce your screenshots?
www.TechSmith.com/SnagIt
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Stef,
Looks great!!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
, count
def enumerate(iterable, start=0):
return izip(count(start), iterable)
list(enumerate('spam', 1))
[(1, 's'), (2, 'p'), (3, 'a'), (4, 'm')]
Brilliant!!
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Stef,
Take a look at what the dabo team has put together.
http://dabodev.com
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
help on another
project.
Thank you!
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Rainy,
Great stuff! Thanks for your examples with the community!!
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
A sort of premature pessimization, then.
QOTW!
+1
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Python 2.7's regex will include possessive quantifiers, atomic groups,
variable-length lookbehinds, and Unicode properties (at least the common
ones), amongst other things.
Wow, that's excellent news!
Many thanks for all your efforts to enhance the re capabilities in
Python!
+1
Andrew,
I'm on a lot of Python (and Python related) mailing lists and haven't
received a message like you described.
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
On 16 mrt 2009, at 18:21, Lou Pecora wrote:
Since this happened with a Python script and some people here use OS X
and Terminal to run scripts I thought this might be helpful.
I recently ran into this problem using Terminal and found the
solution.
I thought those who use the Terminal in OS
/Applications/Utilities/Terminal
it comes up with a window and you can execute any script from there
without the window closing when the script exits, or not?
--
http://mail.python.org/mailman/listinfo/python-list
On 16 mrt 2009, at 22:15, Lou Pecora wrote:
In article mailman.1980.1237237525.11746.python-l...@python.org,
Python pyt...@rgbaz.eu wrote:
--
why don't you just execute the script directly form the terminal?
then you will be able to read all error messages...
and you can delete all
Are there any benchmarks (pystones or other) that compare a
32-bit and 64-bit versions of Python?
Ideally I'm looking for a benchmark comparing recent Python
releases (2.6.x, 3.x) on an Intel platform.
I'm specifically interested in areas of the Python language where
a 64-bit implementation
Stefan,
Is it possible to use the same install of lxml across multiple versions
of Python, eg. I have 2.4, 2.5, 2.6, and 3.0 installed on my workstation
- can I use a single copy of lmxl for 4 versions of Python?
My understanding is that we can replace our use of elmentree and
htmlparser
manipulation example (also reinforce Unicode support)
8. Modules (including the ability to reference modules in a zip file)
Unique Python features:
1. Lists, dictionaries and sets
2. Pickling
3. IDLE console
4. Working with command line args (and optionally optparse)
5. Dynamic code
Any recommendations on Python based tree data structures that I
can study? I'm working on an application that will model a basic
outline structure (simple tree) and am looking for ideas on
Pythonic implementation techniques. By outline I mean a
traditional hierarchical document outline (section
On 12 apr 2009, at 15:07, Gabriel wrote:
Hello,
I'm python newbie and i need to write gui for my school work in
python.
I need to write it really quick, because i haven't much time .)
So question is, which of gui toolkits should i pick and learn? I
heard PyGTK and Glade are best
', False ) ]
However, I can't figure out a way to replace my list of hard-coded
function names with the output from the dir() command.
Thank you for your thoughts,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Hi there!
I'm trying to match the results of an md5 checksum done in a tcsh shell.
I keep getting different results and can't find anything on google...
here's an example:
[EMAIL PROTECTED]:~% echo hello | md5
b1946ac92492d2347c6235b4d2611184
[EMAIL PROTECTED]:~% python
Python 2.5.1 (r251
On 10 sep 2008, at 18:34, Fredrik Lundh wrote:
Python wrote:
I'm trying to match the results of an md5 checksum done in a tcsh
shell.
I keep getting different results and can't find anything on google...
here's an example:
[EMAIL PROTECTED]:~% echo hello | md5
On 10 sep 2008, at 18:30, Richard Brodie wrote:
Python [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
here's an example:
[EMAIL PROTECTED]:~% echo hello | md5
b1946ac92492d2347c6235b4d2611184
How do I get the same results?
Checksum the same string.
md5.new(hello\n).hexdigest
On 10 sep 2008, at 19:39, Grant Edwards wrote:
On 2008-09-10, Wojtek Walczak [EMAIL PROTECTED] wrote:
On Wed, 10 Sep 2008 19:12:28 +0200, Python wrote:
[EMAIL PROTECTED]:~% echo test test.txt
[EMAIL PROTECTED]:~% md5 test.txt
MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249
import md5
!
my bad... i cut some crap from the path to make it a bit easier to read
but that was before the time i knew it was checksumming the
actual path in stead of the contents of the file.
So I figured it didn't matter...
;)
--
http://mail.python.org/mailman/listinfo/python-list
programs in C:/Python25/Progs/
How do I add so that I can just do import somefile from anywhere in
that directory in the interpreter and it can load files from other
folders in that directory.
--
http://mail.python.org/mailman/listinfo/python-list
a temp solution is to append it to that list
, 'Operation timed out')
I guess its a firewall problem... How do i go abt it?
any help? --
does it work if you temporarily switch off the firewall?
gr
Arno
--
http://mail.python.org/mailman/listinfo/python-list
On 23 okt 2008, at 05:49, ryan wrote:
On Oct 22, 6:18 pm, Python [EMAIL PROTECTED] wrote:
On 22 okt 2008, at 13:50, ryan fox wrote:
i have implemented a small client server model to do file transfer
over a LAN network.
It work with some machines on the network and on others it doesnt
I'm trying to compress a string.
E.g:
BBBC - ABC
Doesn't preserve order, but insures uniqueness:
line = BBBC
print ''.join( set( line ) )
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Shakir,
I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'
Desired output: '858215558'
I want to remove any spaces between string and any dashes between
strings. I could do
Mensanator,
snip
import os.path
dl = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
drives = ['%s:' % d for d in dl if os.path.exists('%s:' % d)]
drives
/snip
Very clever!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
appreciate somebody to join and put new views on this project
Send us a link to one of the sites with your code, eg.
http://python.pastebin.com
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
http://www.geocities.com/drew_csillag/pycover.html
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Ryan,
snip
If you don't mind being Windows-only, there's another approach that I've
been working on. I use a WTL application to host the web browser, then
pass
the browser instance to a COM server written in Python, along with a COM
wrapper of the application window. This gives me the flexibility
use a database in place of dictionaries, but I'm
looking for maximum performance.
The following page lists two 64 bit versions of Python for Windows:
http://www.python.org/download/releases/2.5.2/
For Win64-Itanium users: python-2.5.2.ia64.msi
For Win64-AMD64 users: python-2.5.2.amd64.msi
1
Dear List,
Thanks for everyone's feedback - excellent detail - all my questions
have been answered.
BTW: Roel was correct that I got confused over the AMD and Intel naming
conventions regarding the 64 bit versions of Python for Windows. (I
missed that nuance that the Intel build refered
for my workstation's 2G of RAM.
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
I'm looking for a version of Python for Blackberry mobile phones
- has anyone heard of such a thing? I've been googling this topic
without success.
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Anyone have any benchmarks on the difference in performance between 32
and 64 bit versions of Python for specific categories of operation, eg.
math, file, string, etc. operations?
My question is OS neutral so feel free to share your experience with
either Windows or Linux OS's.
Thank you
...
thanks in advance,
Arno
--
http://mail.python.org/mailman/listinfo/python-list
On 7 sep 2008, at 00:25, John Machin wrote:
On Sep 7, 8:03 am, Python [EMAIL PROTECTED] wrote:
Hi there,
I moved a few modules into the modules folder (on OSX: /opt/local/
lib/
python2.5/site-packages/).
They don't show up though when I start IDLE...
Is there a way to reload the modules
On 7 sep 2008, at 13:50, Gabriel Genellina wrote:
En Sat, 06 Sep 2008 20:26:24 -0300, Python [EMAIL PROTECTED] escribió:
now one question came up, how do I make those path permanent?
i mean, sys.path.append(path) adds it for the current session,
yet when i logout of IDLE and start it again
script,
but some reason, that is a mystery to me, when you scale the window up.
the item2(sub) is getting blocked by a white box. Im not sure where
this box is coming from and not really sure how to get rid of it.
Im fairly new to python and even newer to wxPython, if Im going around
my head
=list1
list2.remove['a']
main():
global list1
method1()
method2()
print list1[0]
it prints 'b'.
How could I keep the list1 not to change when remove list2's elements?
--
http://mail.python.org/mailman/listinfo/python-list
in python , could I accomplish the purpose that a=Console.read() used
in C?
when program is running, I wanna add a statement like
a=Console.read() in C language,it will wait for user's input, after
user's typing a character , and click enter key, the program will go
on running.
--
http
something with me hiding the second panel. Please help me out here
thanks
Attached is my two python scripts that im using
use the test.py to test
the PaintPanel script..import wx
class PaintPanel(wx.Panel):
def __init__(self, parent, id, sub = 0, *args, **kwds):
wx.Panel.__init__(self
I installed it, but can't find py2exe.exe in my computer. why?
And , when I execute python setup.py py2exe under command line, it
prompt error:wrong command py2exe .
--
http://mail.python.org/mailman/listinfo/python-list
it prompt: invalid command 'py2exe'.
I have import py2exe in setup.py file.
--
http://mail.python.org/mailman/listinfo/python-list
I have new a list , when it hava large number of values, I wonna to
delete all the values in it,how to do?
And, if a list have 801 values, I want to get its values index from 300
to 400, could use list1[300:400],are right me?
--
http://mail.python.org/mailman/listinfo/python-list
:
linkReturned=i.start()
for j in linkReturned:
links.append(j)
--
http://mail.python.org/mailman/listinfo/python-list
To BJörn Lindqvist :
thank you . how to write the code specifically ?Could you give a
example?
--
http://mail.python.org/mailman/listinfo/python-list
To BJörn Lindqvist :
thank you . how to write the code specifically ?Could you give an
example?
--
http://mail.python.org/mailman/listinfo/python-list
Is there a formula for determining the approximate size of a dictionary
(minus its data) under 32 and 64 bit Python with a specific average key
size?
For instance, if we were running a 64-bit version of Python and created
a dictionary of 1 million items with an average key length of 48 bytes
Steven,
Wonderful! You and your references answered all my questions.
I had missed 2.6's new getsizeof() function. Yet another reason to do
the 2.5-to-2.6 upgrade.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 5780 matches
Mail list logo