erfaces.
http://wiki.zope.org/zope3/FrontPage
http://wiki.zope.org/zope3/programmers_tutorial.pdf
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
#
else:
raise ValueError
If they are different functions based on type do something like this:
#
# Set up a dictionary with keys for different types and functions
# that correspond.
#
fdict={type(''): a, type(1): b, type(1.0): c}
#
# Call the appropriate function based on type
#
fdict[type(x)](x)
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
k in advance
>
> AMMS
>
Do you absolutely need .DLL? You can make a class into a COM object that
nearly every language on the planet can dispatch with ease. Here is some
info:
http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html
Calling an existing .DLL? Use ctypes module.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
hoice is py2exe to bundle and then Inno Installer
to make a setup.exe distrubution program that handles the install
and uninstall. Others can chime in on linux, mac, etc.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
utation-are-thread-safe.htm
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
IMHO Python programmers would never use
s=c+s on strings as it is quite inefficient. The methods
and functions he uses reversed(), .join(), list() are very
powerful Python constructs that you will need to learn how
to use. The slicing word[-1::-1] is also something that
will come in handy later if you learn how to use it. This
is a simple example that you can learn a lot from if you
will study Grant's responses.
Just my two cents.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Deep wrote:
> Hi all,
> I am a newbie to python
> I have an input of form
> space
> ie.
> 4 3
> how can i assign these numbers to my variables??
>
Or with list comprehension:
n1, n2 = [int(n) for n in raw_input().split()]
Neither of these methods checks for errors (e.
to
do something with the key if it exists and the best method is:
try: names['name_key']+=1
except KeyError:
#
# Key doesn't exist, create it, display error, or whatever you want
# to do if it doesn't exist.
#
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
take.
>>
>> Sparklines shows this in action:
>>
>> http://bitworking.org/projects/sparklines/
>>
>> max
>
>
If it hasn't already bitten you it will: It is a BAD idea to use
'file' as a variable name. If you do, you mask the built-in file
function. That is why most people use fp or something else.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
it()[4]).split("_")[1]
if gate in line:
return "i_a/i_b/ROM/%s %s LOC =%s" % (gate, index, pos)
return "Error"
search_gates=[('B6', '[1:0]'), 'B10', '[3:2]'),
'B14', '[5:4]'), 'B17', '[7:6]')]
for line in lines:
print search(search_gates, line)
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
t
> intellectual curiosity as the current solution obviously does the job.
>
> Steven
>
You can certainly get it down pretty small if you turn it into a function
as I did, and use a list comprehension, but I think it is hard to read.
def search(line):
global search_gates
for gate, index in search_gates:
pos = (line.split()[4]).split("_")[1]
if gate in line:
return "i_a/i_b/ROM/%s %s LOC =%s" % (gate, index, pos)
return "Error"
search_gates=[('B6', '[1:0]'), 'B10', '[3:2]'),
'B14', '[5:4]'), 'B17', '[7:6]')]
print '\n'.join([search(line) for line in lines])
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Mark Bryan Yu wrote:
> Hi,
>
> I'm trying to make a Audio CD ripper using python.
>
> is there a way (library, module, etc) to detect when a CD was inserted
> or ejected?
>
That is going to be OS dependent, so please share with us
what OS you are on?
-Larry
--
http
Erik Johnson wrote:
> "Dave Opstad" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Is the lack of a struct.error when the byte-order mark is at the start
>> of the format intentional? This seems like a bug to me, but maybe
>> there's a subtlety here I'm not seeing.
>
> I am b
rom a 1st sight
> I couldn't see if it allows for easy graphic
> charts - may be with svg ...
>
> Thanks for any suggestions.
You can use ReportLab Graphics to generate the
graphs as .JPG files and display them in a
browser window with simple HTML.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
rong.
If hint='n'
hint !='n' is False
hint !='y' is True
False or True equals True
I think you want something like:
hint = raw_input("\nAre you stuck? y/n: ")
hint = hint.lower()
while hint not in ['y', 'n']:
hint = raw_input("Please specify a valid choice: ")
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
that the place
where you installed fipy isn't on your PYTHONPATH so
python can't find the module.
If you haven't already, take a look at:
http://www.ctcms.nist.gov/fipy/installation.html
Manual looks quite good and covers installation well.
It appears you can go here and
IDispatch (COM) object
# so I can pass it to my COM object.
#
idCallback=win32com.server.util.wrap(cb)
#
# Call the COM interface and pass it the callback function
#
r=oC.WSset_callback(idCallback)
In my case the COM object was also written in Python so to get
to the python object I do following:
def WSset_callback(idCallback)
self.callback=win32com.client.Dispatch(idCallback)
Now I can call .progress method of callback class from the COM
object.
self.callback.progress(total, number)
Hope this helps in some way.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
tory. Files get timestamped and then put
> into the corresponding directory. It is just that having
> 'C:\a\very\long\path\file.ext' as a filename on the server is not nice.
>
> Thomas
>
You will need to write some Javascript and assign something to a hidden
field that gets posted. Here is some Javascript to get you started:
http://www.javascripter.net/faq/operatin.htm
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
ions but
the VB one has got me stumped.
Thanks in advance for any assistance.
Regards,
Larry
--
http://mail.python.org/mailman/listinfo/python-list
')
Python knows you aren't done because you haven't provided the closing
parenthesis.
I do this in list comprehensions also:
n=[(variable1, variable2) for variable1, variable2 in something
if variable1.startswith('z')]
You do need it in your first example, but not in your second.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
o get an instance.
What you got was a pointer (x) to the DemoClass not an instance of
DemoClass.
2) Same for WriteToFile()
3) Probably best to move the path to main and always pass it into
WriteToFile.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
ost recent call last):
> File "test1.py", line 23, in ?
> print str(getattr(obj, methodList[0]).__doc__)
> TypeError: 'str' object is not callable
>
> This is part of some code in Diving Into Python,Chapter 4. In case a
> function doesn't have a __doc__
do anything with this that would stretch your
application across all 2 (or 3) monitors. I think screensize isn't
going to give you enough information to automatically size or
position a window.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
ed and simplified DatabaseIndex.get().
>
> * Fixed ConnectionHub.doInTransaction() - close low-level connection on
> commit() to prevent connections leaking.
>
> For a more complete list, please see the news:
> http://sqlobject.org/News.html
>
> Oleg.
WOW! Went from 0.7.4 to 0.8.1 in the span of only 23 minutes!
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
7;c:\Library\TurboDelphi\TurboDelphi.exe')
At least by doing it this way you won't break anything if you get a new zipfile
module. It just won't show progress any more and then you can patch it.
Hope info helps.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
ith encryption included. They are REALLY cheap.
http://www.kingston.com/flash/DataTravelers_enterprise.asp
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
://www.oreilly.com/catalog/twistedadn/
I'll bet it will be worth the purchase price if you choose to go this
direction.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
>>the easier way to get that final output.
>
> Thanks in advance.
>
>
d={}
for a, b, c in lista:
if d.has_key(b):
if d[b].has_key(c):
if a not in d[b][c]: d[b][c].append(a)
else:
d[b][c]=[a]
else:
d[b]={c:[a]}
print d
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi,
>
> I create a dictionary like this
> myDict = {}
>
> and I add entry like this:
> myDict['a'] = 1
> but how can I empty the whole dictionary?
>
> Thank you.
>
just point myDict to an empty dictionary again
myDict=
Aahz wrote:
> In article <[EMAIL PROTECTED]>,
> Larry Bates <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>>> I create a dictionary like this
>>> myDict = {}
>>>
>>> and I add entry like this:
>>> myDict['a'
Bruno Desthuilliers wrote:
> Larry Bates a écrit :
>> Aahz wrote:
>>> In article <[EMAIL PROTECTED]>,
>>> Larry Bates <[EMAIL PROTECTED]> wrote:
>>>> [EMAIL PROTECTED] wrote:
>>>>> I create a dictionary like this
>>>
27; character in front of all their choices, so I was thinking of
> accepting the string input first, then adding in the '-' character
> myself.
>
> So my qusetion is, how do I change:
>
> "2a 3ab" into "-2a -3ab".
>
> Regular expressions? :/
>
s="2a 3b"
s="-%s -%s"% tuple(s.split())
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
= zipfile.ZipFile('/zips/archive%s.zip' % archive_num, "w")
outfile.write(full_name_path,full_name_path,zipfile.ZIP_DEFLATED)
There is still a couple of "issues":
1) Files larger than 15Mb may not be able to be compressed to fall below the
limit.
2) If you are near the 15Mb limit and the next file is very large you have the
same problem.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
to
be pretty easy). I was easily able to call from VB, Delphi and Python
COM. I haven't tried C/C++ yet, but expect no problems. I think COM is
now the way to go (unless you do .NET).
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
what you mean by close-minimize icons unvisible, but
I can answer the .exe question. Take a look at py2exe which allows
you to bundle up python program as .exe for distribution. You can
see it a www.py2exe.org.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
> Thanks in advance.
>
> Anbeyon
>
If you are on Windows take a look at PyScripter:
http://mmm-experts.com/Products.aspx?ProductId=4
I would also recommend a copy of Python Cookbook
which has LOTS of example code you can look at and
use.
-Larry Bats
--
http://mail.python.org/mailman/listinfo/python-list
. Am I?
>
> Thanks a lot,
> Sergio
The problem is that C:\Python25\Lib\site-packages\spam is not
the current working directory when you run the program. If it were,
and if configuration.txt is in that directory it WILL find it. If
you are running this from a shortcut make the working directory
C:\Python25\Lib\site-packages\spam
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
s of:
import difflib
correct_lines=open(r"C:\Python25\Scripts\Output" \
"\correct_settings.txt", "r").readlines()
current_lines=open(r"C:\Python25\Scripts\Output\output.txt",
"r").readlines()
delta=difflib.unified_diff(correct_lines, current_lines)
diffs=''.join(delta)
print diffs
Will show you the lines that are different and some lines
around it for context.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
t; But then when try to access the information in the dictionary it
> doesn't seem to exist:
>
> In [2]: env['EDITOR']
> ---
> exceptions.NameError Traceback (most
> recent call last)
>
> /Users/destiney/
>
> NameError: name 'env' is not defined
>
>
> Thanks,
>
>
In Cpython you get this with:
import os
os.environ['EDITOR']
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
way to do, like MD5 or similar, please let me know.
>
>
> Thanks,
> Jimmy
Put the private key on a USB key and read it from there to create the logs.
When you unplug the USB key, the private key is gone from the machine.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
't
> guarantee that this will happen overnight, but I'd like to make a start.
>
> regards
> Steve
Apollo Hosting has this available (www.apollohosting.com).
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
le line, as it is often more prone to error.
>
> Thanks
> bahoo
>
Use os.walk to talk your branch of directories.
Use glob.glob to find only those files that match your mask.
Use zipfile or tarfile module (depending on if you want .gz or
.zip compressed file) to add each file to the comp
--
> Protect yourself from spam,
> use http://sneakemail.com
Use a dispatch dictionary:
dispatch={'int': getint,
'bool': getboolean}
then call it:
dispatch(t)(*args)
Note: You should NOT use type as a variable name because it will shadow
the built-in type function.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
;
> Laszlo
>
You can use htmlentitydefs module to help with this.
import htmlentitydefs
chr(htmlentitydefs.name2codepoint['gt'])
and (to go the other way)
htmlentitydefs.codepoint2name[ord('>')]
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
of a parent).
> Having a handle on any of the links in the graph would be a useful
> thing.
>
I believe you are looking for setattr(obj, attr, value) and
getattr(obj, attr) functions. Since everything in python its a
pointer to an object, I wasn't able to understand EXACTLY what you
were asking (an example would help).
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
27;, len(bytes), 'bytes'
> print 'and', count, 'lines'
>
> The first line in the file I am examining will be a number followed by
> more whitespace. Looks like I cannot split by whitespace?
>
You have told split to split on single blank space not whitespace.
To split on whitespace use .split() (e.g. no arguments)
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
on many different pieces. I have not experience with XLRD
but the other pieces you use work just fine. Check on www.py2exe.org
for docs an wiki. There is also a newsgroup at gmane.comp.python.py2exe
that you can submit questions to if you like. I know that it is
monitored by Mark Hammond, Thomas Heller, and other users of py2exe
that can help you.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
le method that just moves the directory entries around.
>From Win32 Documentation:
win32api.MoveFile
MoveFile(srcName, destName)
Renames a file, or a directory (including its children).
Parameters
srcName : string
The name of the source file.
destName : string
The name of the destin
peg-jpg-tiff-bmps-converter.htm
http://www.print-driver.com/howto/converting/convert_microsoft_powerpoint_presentation_to_jpeg.htm
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
#
def somemethod(self):
#
# Put this method's code here
#
pass
#
# In your program
#
id=win32com.server.util.wrap(who())
x.AddShapeInfo("who",0,id)
I could be way off base here, but I hope that this helps.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
=win32com.client.Dispatch("typelib name").
You need to find out the COM dispatch typelib name and make sure the DLL is
registered (regsvr32 your.dll).
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
e to write something like (VB):
oFOO=foo()
for each n in oFOO
'
' Do something with n
'
next
Seems like there should be a way. Hope explanation is clear enough.
Regards, Larry
--
http://mail.python.org/mailman/listinfo/python-list
Alex Martelli wrote:
> Larry Bates <[EMAIL PROTECTED]> wrote:
>
>> recently learned that you can ship COM as either an .EXE or a .DLL (nobody
>> has yet let me know why).
>
> The "why" is pretty obvious -- you may want to be able to instantiate a
>
Yingpu Zhao wrote:
> Thanks to Larry.
> I want to pass the IDispatch pointer of other COM object to
> AddShapeInfo or pass null to tell x do nothing.
> for example.
>
> Rect= Dispatch("Rect.Document")
> ShapeSet = Dispatch("xxx.Document")
> Sha
't find any relevant
> environment variables.
>
> Thanks from a newbie for any insight.
>
PYTHONPATH environment variable is next in line to be searched.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Lorenzo
>
IMHO variables like what you describe are really data not program variables.
You might consider putting variables like these in a dictionary and then check
to see if the keys exist before assignment:
var_dict={}
#
# See if 'varname' initialized, if not it needs to be
#
if 'varname' not in var_dict:
var_dict[varname]=somevalue
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Since you are going to need to do a dialog, I would use wxWindows tree
control. It already knows how to do what you describe. Then you can
just walk all the branches and create the folders.
-Larry
Martin M. wrote:
> Hi everybody,
>
> Some of my colleagues want me to write a script
on the desktop, when you
drop any file on it in Windows it is passed into the program via the sys.argv
list as the second (e.g. sys.argv[1]) argument. If you drop multiple files,
they are passed in sys.argv[1] sys.argv[n]. All you need to do is to pick up
the filename and do your processing.
-
t;
> matt
Might want to take a look at wxGlade (http://wxglade.sourceforge.net), you will
need wxWindows and py2exe to complete the toolkit.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
wondering what is done at Google with
> Python and which Python "environments/applications" (Zope, TurboGears,
> mod_python ...) are in use, and what is done with other languages, and
> which other languages are they using.
>
Have you tried Google "google python&qu
How about:
ord=''.join([unichr(int(x,16)) for x in hexs])
I don't know if its faster, but I'll bet it is.
-Larry
[EMAIL PROTECTED] wrote:
> Here's how I'm doing this right now, It's a bit slow. I've just got
> the code working. I was wondering if
p.
> L.
>
Depends on what the server requires. You can do basic authenticate to a https:
site if it supports it.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Here is how you would do it if all your backup files begin with
fstab.
import glob
list_of_backup_files=glob.glob('/home/shriphani/backupdir/glob*')
If "fstab" can appear anywhere in the filename, this might not work for you.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
using SpamBayes with Outlook/IMAP for about 6 months without any
problems. One "issue" is that it doesn't seem to filter my mail when I first
start up each morning. I have to manually run the filtering process. I've
never seen UnicodeDecodeError. I'd be happy to test something for you.
FYI, Larry
--
http://mail.python.org/mailman/listinfo/python-list
es (if needed), create
shortcuts, etc. The time I spend installing and learning Inno has paid for
itself many times over.
FYI, Larry
--
http://mail.python.org/mailman/listinfo/python-list
if line.startswith('msgid'):
parts=line.split(' ')
try: parts[1]=xlate[parts[1]]
except:
#
# Handle exception if your translation dictionary does
# not have the string you are looking for here.
#
raise KeyError
newline=' '.join(parts)
fp2.writeline(newline)
fp1.close()
fp2.close()
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
folder that make the deletion of folders
impossible. This project has become significantly more complex than it
appeared
at first. Anyone out there have any "sage" advice on how to tackle this beast?
Thanks in advance for any pointers.
Regards,
Larry Bates
--
http://mail.python.o
gram
# aborts"as well as some information about what caused the program to
# abort.
#
import traceback
#
# Get traceback lines
#
tblines=traceback.format_exception(type, value, tb)
#
# Write some lines to log
#
log_error_to_file()
#
gt; A "works-for-me":
>
> >>> pairs = (test[i:i+2] for i in xrange(len(test)-1))
> >>> for a,b in pairs:
> ... print a,b
> ...
> H e
> e l
> l l
> l o
> o
> w
> w o
> o r
> r l
> l d
> >>>
>
> -tkc
>
>
>
import itertools
test = u"Hello World"
ltest=["'%s'" % c for c in test]
for a, b in itertools.izip(ltest, ltest[1:]):
print x, y
'H' 'e'
'e' 'l'
'l' 'l'
'l' 'o'
'o' ' '
' ' 'W'
'W' 'o'
'o' 'r'
'r' 'l'
'l' 'd'
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
then the total number of
> calories.
Boolean problem:
if cal or fat <= 0
That may be the way you say it or "think" it but it won't work.
'cal or fat' is evaluated first. Since they both have values this ALWAYS
evaluates to 1 which is NEVER less than or equal
find a way.
>
> Is there a way to make f1.py and f2.py available as if they were located
> in the base directory,
> without knowing their names (so in general all py-files in the subdir1) ??
>
> thanks,
> Stef Mientki
>
>
Put basedirectory\subdir in t
lasses are classes can be stored in lists or dictionaries. In lists you
reference them via their index (or iterate over them) and in dictionaries you
can give them a name that is used as a key.
Hope this helps.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
t;, line 13, in __init__
> self.panel = Panel(self, -1)
> File "~/xpy/cnc/i2g/prefDialog/test/frame2.py", line 48, in __init__
> self.staticbox = wx.StaticBox(self, -1, "StaticBox")
> File
> "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_controls.py
sql, *args):
global db
try:
import pdb; pdb.set_trace()
cursor = db.cursor() # db is .
[...]
except:
print "Problem contacting MySQL database. Please contact root."
sys.exit(-1)
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
e talking about. Certainly if you have a lot (millions),
you should implement binary search, but I would write code first and if it is
too slow, fix that part.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
__, elem, isSame)
>...
>['.aList[0]', '.elem', '.a1']
>['.aList[1]', '.elem', '.a2']
>>>>
>
> Don't see how this could help,
>
> Jean-Paul
If you want to accomplish something like this use the following:
class A(object):
def __init__(self, name=None):
self.name=name
aList=[]
aList.append(A(name='a1')
aList.append(A(name='a2')
for elem in aList:
print elem.name
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
ter replies
to wxPython specific questions. Looks like you might want OnEnter(self, x, y,
d) and OnLeave(self) methods of wxDropTarget class
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
>
First of all [A,B,C,D] is a list not a tuple. (A,B,C,D) is a tuple.
Without a better example or explanation of what you are trying to do it is
difficult, but I'll give it a try:
myTuple=(A,B,C,D)
for n, item enumerate(myTuple):
if n in (0,2):
myList.append(item)
-Larry
-
i in xrange(0,5):
x=raw_input("input number for store=%i ?" % i)
stores.append(int(x))
for i in xrange(0,5):
hundreds, remainder=divmod(stores[i], 100)
print "Store: %i %s" % (i+1, hundreds*"*")
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
can simply open LPT1, LPT2 or LPT3 as a file and
write to it (for simple printing). For more complex "Windows" printing you
must
use Win32 extensions or something like wxWindows.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
the message would be
happily received by its subscribers.
Cheers,
/larry/
--
http://mail.python.org/mailman/listinfo/python-list
or basically ANY
other language that can call COM objects) quite easily and compile them
with py2exe for distribution without python itself.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
> jrpfinch wrote:
>> Thank you. I have just realised I completely misunderstand how SMTP
>> servers work. From what I can tell, when you run the cookbook script
>> it listens locally on port 8025.
>>
>> You then have to configure a Linux (in my case) account with a username
>>
hanks,
>
When you say API what EXACLY do you mean. Is it a .DLL that you
need to call (if so see ctypes module) or a COM API (if so see
win32 module)? Other APIs could use sockets, pipes, etc. you will
need to give us more to be able to help.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
le, seek to the old length and
read bytes up to the new length and close the logfile.
What is read will be the new log entry (or entries).
Reset the logfile length high water mark and loop.
Hope information helps.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
t
an integer as the third element
a float as the third element
a dictionary as the fourth element
a class instance as the fifth element
The tutorial is a good place to start if you haven't already looked at
it.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
s on an - easy and clear - path to follow ?
>
>
I use py2exe and inno installer. Works great.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Victor Polukcht wrote:
> Can anybody suggest a correct way of checking in python module exists
> and correctly installed from python program.
>
Not sure I understand the question, but I'll try:
try: import yourmodule
except:
print "Can't import yourm
s searchable via an index. If you REALLY
need speed you can consider an in-memory database.
Create soundex keys for each name in your small list and query the database
with this key into the table in the DB that is indexed on soundex keys.
If you get a hit, the key is sufficiently "alike" to be a candidate. I'll
leave the remainder to you. Perhaps there is other information that will
help determine if there is a match?
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
ds of lines of config
data is extremely small. I use it a LOT and it is very flexible and
the format of the files is easy for users/programmers to work with.
-Larry Bates
--
http://mail.python.org/mailman/listinfo/python-list
Imbaud Pierre wrote:
> Larry Bates a écrit :
>> Imbaud Pierre wrote:
>>
>>> The applications I write are made of, lets say, algorithms and data.
>>> I mean constant data, dicts, tables, etc: to keep algorithms simple,
>>> describe what is peculiar,
something after each loop or do you really
want to peg the CPU checking forever?
Q: How do you ever get out of this infinite loop?
Note: while 0=0 is better written as while 1: and you need a
break somewhere to get out of the loop.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
t; list2):
> x = list1[2]
> y = list2[2]
> if
> x>y:
> return
> 1
> elif
> x==y:
> return
> 0
> else: #
> x return -1
>
> But as before sorting with this function returns None.
>
> What have I ov
rt ConfigParser
cfg = ConfigParser()
cfg.read("proj.cfg")
projectSections=[section for section in cfg.sections()
if x.startswith('PROJECT')]
#
# Note: sections are case sensitive
#
for project in projectSections:
#
# Do your work
#
-Larry
This seems to work quite well. I hope information helps.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
-i", "--identifier", dest="identifier")
> (opts, args) = parser.parse_args()
> if opts.number is not None:
> MyService._svc_name_ += opts.identifier
> MyService._svc_display_name_ += opts.identifier
> MyService._provider_id
Double check me on that.
I don't see anything that references C:\\aaa\temp in your
code. Does it exist on your hard drive? If so does it
maybe contain temp files that are open? zipfile module
can't handle open files. You must use try/except to
catch these errors.
Hope info helps.
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
Kiran wrote:
> Hi everybody,
> I am making python run an executable using the os module. Here is
> my question. The executable, once it is running, asks the user to
> input a filename that it will process. Now, my question is how do i
> automate this. let me make this clear, it is not an argu
Chris Curvey wrote:
> On Feb 1, 2:10 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
>> Chris Curvey wrote:
>>> Hi all,
>>> I have used the win32com libraries to set up a service called
>>> MyService under Windows. So far, so good. Now I need to run mult
a[0] == n[0]:
> a.append(n[1:])
> del alist[i+1]
>
> Sorry about the lengthy message and thanks for your suggestions - I'm
> trying to learn...
>
One solution:
l=[['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c','4'],
['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
d={}
for k, v in l:
if d.has_key(k): d[k].append(v)
else: d[k]=[v]
print "d=", d
l=[x for x in d.items()]
print l
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
hon/win32_how_do_i/watch_directory_for_changes.html
BTW-It helps us out here if you let us know what platform you
are running on (e.g. Windows, Linux, Mac, etc.).
-Larry
--
http://mail.python.org/mailman/listinfo/python-list
1201 - 1300 of 1904 matches
Mail list logo