I'm still very new to python (my 2nd day atm) but this is what I come
up with.
First note, I wasn't clear (I reread what I wrote) about my 'word'
'wordtwo' problem. Both words do Not need to be on the same line. But
rather say there was
Line 4: This is a line
Line 5: Yet another one
Line 6: its a
I found out that doing a re.findall will split up the results into an
array, or rather something called a list (looks like an array to me).
I'd be set if i could just count the elements in the array but I can't
seem to find anything in the documentation on how to : / ...
--
http://mail.python.or
Why Microsoft and Windows ?
B/c it was actually in the data I was trying to parse (though not
something I was needing to parse), I obscured everything except my test
search terms *shrugs*
I saw something on this group about 'to many "or's"' so I figured it
was an option. Thanks for the .splitline
dir(*) !!! That's beautiful! I was just wanting to know what was
available to an object. I was thinking, if there was just something
that quickly told me that info I could look through the documentation
quicker :D
I found the len(*) obscurely mentioned on someones webpage. Thanks for
the dir(*) po
[EMAIL PROTECTED] wrote:
> This can be interesting:
> http://science.slashdot.org/science/05/03/01/2340238.shtml
>
> Bearophile
Hey, that DataGlyph demo works pretty neat.
Decoding your DataGlyph.
DataGlyph decoded successfully.
four score and seven years ago our fathers brou
Tim Churches wrote:
> [EMAIL PROTECTED] wrote:
>
> >[EMAIL PROTECTED] wrote:
> >
> >
> >>This can be interesting:
> >>http://science.slashdot.org/science/05/03/01/2340238.shtml
> >>
> >>Bearophile
> >>
> >>
> >
&
take a look at os.walk, it is documented in the library documentation
--
http://mail.python.org/mailman/listinfo/python-list
This would be a good case to use OO design, imo. The following works
fine. Simply instantiate the object, call the method, and you can
access (and manipulate) the "module's" variable to your heart's
content.
module.py
class object:
def __init__(self):
I doubt it's a hardware issue... If these people have any knowledge of
computers, they would try connecting to other places to see if it gives
them the same error. It sounds obvious, but have them ping your DNS
alias as well as your IP address.
If they can't get anywhere else, then it's a local h
Good call. I was just trying to be generic in my quickly put-together
example. It's been a while since I've used Python so these things I
easily forget :)
'object' here would be more aptly named 'MyObject'.
--
http://mail.python.org/mailman/listinfo/python-list
Eric, your tagline doesn't parse correctly on my Python 2.4 shell.
--
http://mail.python.org/mailman/listinfo/python-list
I do not think there's a direct way of telling it - but you can try to
catch a DeprecationWarning, that is issued by most code deprecated
modules
--
http://mail.python.org/mailman/listinfo/python-list
Another reason NOT to use XML-RPC:
PSF-2005-001 - SimpleXMLRPCServer.py allows unrestricted traversal
http://python.org/security/PSF-2005-001/
--
http://mail.python.org/mailman/listinfo/python-list
I just read in the 'What's New in Python 2.4' document that the None
data type was converted to a constant:
http://python.org/doc/2.4/whatsnew/node15.html
"""
# None is now a constant; code that binds a new value to the name
"None" is now a syntax error.
"""
So, what's the implications of this?
Sheesh... I didn't actually pull the type(None) comparison out of my
code. I was simply throwing together a possible situation. Had I
thought about it for more than a second I would have remembered how I
would actually use it.
Thanks for clearing up the confusion. I wasn't previously aware that
ed through the results but all it showed was some
data
> structure, but i was actually looking for a list of all possible
> arguments and which arguments were/were not required.
The syntax of this command is:
NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
yep, that works better under Windows. Pretty obscure use of Python,
though! :-)
S
--
http://mail.python.org/mailman/listinfo/python-list
> > map :!d:\python24\python.exe %
> >
> >
> > but it comes with a new pop-up windowsdame~
>
> I'm no windows expert - but maybe pythonw.exe helps here?
I find that using pythonw.exe and the silent prefix in Vim works best
for me:
map :silent !pythonw.exe %
Regards,
Aaron
--
http://
thanks guys. Three good answers, each slightly different, but giving me
good food for thought.
Obviously my example was a trivial one, but I wanted to isolate the
behaviour I'm seeing in my real app. I now have some good ideas for
moving forward!
cheers
S
--
http://mail.python.org/mailman/lis
In regards to mod_python, I keep getting this warning when I do
apachectl configtest:
[warn] Loaded DSO libexec/mod_python.so uses plain Apache 1.3 API, this
module might crash under EAPI! (please recompile it with -DEAPI)
So I googled what I can, and have read various responses. Most say you
>From the Python 2.4 quickreference:
d.popitem() Removes and returns an arbitrary (key, value) pair from
d
If this isn't random enough, then you can generate a random number in
range(len(d))
--
http://mail.python.org/mailman/listinfo/python-list
I was wondering how to do this too. I'm trying to write a distutils
setup.py script that has some data I'd like to include. From the
distutils docs I get
data_files specifies a sequence of (directory, files) pairs in the
following way:
setup(...
data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2
I'm trying to do something along the lines of
>>> print '%temp %d' % 1
Traceback (most recent call last):
File "", line 1, in ?
ValueError: unsupported format character 't' (0x74) at index 1
although, obviously I can't do this, since python thinks that the '%t'
is a format string.
I've tried o
Thanks!!
--
http://mail.python.org/mailman/listinfo/python-list
I ended up using the trick I found in the Disutils Cookbook.
http://www.python.org/moin/DistutilsInstallDataScattered
This works fine for me now, but I have another distutils question.
My package requires Pmw and another home grown package that has a
source dist and a Windows dist built with the
Peter,
Agreed... which is why I said the 'random' module should be imported if
more randomness is required.
I only mentioned d.popitem() first in case Tores' application didn't
need a psuedo-random item and instead he was looking to pull any value
without randomness.
--
http://mail.python.org/m
This question applies specifically to RHEL 3.0 (actually Whitebox), but
also generally to Redhat and probably pretty much every distribution
that uses python for distribution-related tasks (configuration
managers, rpm package management, yum, etc).
So I want to upgrade to python 2.4 on Whitebox 3.
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> [EMAIL PROTECTED] wrote:
> > 2) added to MakeFile after config:
> > EXTRA_CFLAGS=-DEAPI
>
> You can do this, but it should be to "src/Makefile" and added
> to "CFLAGS" and not "EXT
Michael:
on my box, (winXP SP2), sys.getfilesystemencoding() returns 'mbcs'.
If you post your revised solution to this unicode problem, I'd be
delighted to test it on Windows. I'm working on a Tkinter front-end
for Vivian deSmedt's rsync.py and would like to address the issue of
accented charact
>From what it sounds like in your program, you're making an os.system()
function call and waiting for the results, correct? Have you tried
using the plethora of parallel system tools so that you don't have to
wait for a command to finish? Using a function that will launch your
command in a new th
Hi All,
I've been trying to come up with an elegant solution to this problem,
but can't seem to think of anything better than my solution below.
I have a Python program that needs to be converted into an executable.
The problem is that I have a "config" template file that I've been
using to modif
Larry,
I am using py2exe to package my application into an executable, but did
not have the need for an installer such as Inno Installer. This is
definately good info for future use, though. Thank you!
Tom,
No, I didn't know about the ConfigParser module and was exactly what I
was trying to fi
Since this utility will also be ported to the linux world, does anyone
know what the linux/unix counterpart of a Windows .INI configuration
file is?
I suppose I could get away with using XML for my config files and avoid
having two different tools altogether.
--
http://mail.python.org/mailman/li
There are a lot of good options here. Much more than I thought I had.
Since my program's configuration file will need to be read/writeable
from an existing Java Netbeans GUI, I'll most likely move the Python
module to an INI or XML document. The deciding factor will be
whichever the other program
Howdy,
I sure hope so.
I don't get around much, so I love to be able
to hear what I'm missing.
I bet lots of folks would appreciate audio/video
download/stream. Though video may be prefered,
I've found that listening to a Powerpoint
presentation is fine.
Thanks,
Kent
--
http://mail.python.or
In 2.4 at least, it looks like execfile can take an arbirary mapping
object for globals, so something like this may work:
class LoggedDict(dict):
def __setitem__(self, item, val):
dict.__setitem__(self, item, val)
# Do whatever logging is needed here
print "Assignment m
lots of good answers there, and quickly, too!
I can see that I need to explain a bit further what I'm up to.
I have a number of variables (environmental variables, actually), most
of which will have a value. But some may not have been found by
os.environ.get(), so I set those to None. Now, if any
The documentation tells that objects of different type are ordered
arbitrailiy but consistently. You compare a class with an integer and a
list, see : http://www.python.org/doc/2.3.5/lib/comparisons.html
--
http://mail.python.org/mailman/listinfo/python-list
I don't know the mentioned book, but if you rewrite like:
>>> import sys
>>> class LinuxDriverError(Exception):
... def __init__(self, *args):
... Exception.__init__(self, *args)
... self.message = args[0]
...
... def __str__(self):
... return str(sys.exc_info())
...
Hello, I'm new to both PostgreSQL and psycopg and I'm trying to connect
to my database running on localhost. I have postgres setup to do md5
authentication and this works when using a db admin tool on my local
network. For some reason, psycopg fails with IDENT authentication.
>>> import psycopg
>>
To generate path names take a look at os.path.join(see
http://docs.python.org/lib/module-os.path.html)
--
http://mail.python.org/mailman/listinfo/python-list
jrlen balane wrote:
> basically what the code does is transmit data to a hardware and then
> receive data that the hardware will transmit.
>
> import serial
> import string
> import time
> from struct import *
>
>
> ser = serial.Serial()
>
> ser.baudrate = 9600
> ser.port = 0
> ser
> ser.close()
>
John Machin wrote:
> [EMAIL PROTECTED] wrote:
> >
> > What actually gets transmitted is "C\x01\x02\x10'\x83".
>
> No, that's repr(What actually gets transmitted)
Drat, I always get burned by that.
>
> > That's 18 bytes. Is the command s
I did, the pg_hba conf is a big tricky to me. I've tried the following
things.. the commented out lines I also tried.
#localall ident
sameuser
localall md5
host all 127.0.0.1 255
Thanks for the reply. I figured it out, the problem was with my
postgresql configuration. the following seemed to do the trick.
localall
md5
host all 0.0.0.0 0.0.0.0 md5
--
http://mail.python.org/mailman/listinfo/python-list
Hi
I have a python script under linux, I wonder if I can be converted to
an executable or not?
Richard
--
http://mail.python.org/mailman/listinfo/python-list
I wonder if I get the executable like c program compiled by gcc
--
http://mail.python.org/mailman/listinfo/python-list
Hello
Ive recently found that you cannot type anything over 7 into a number that is
preceded with a 0.
ex:
>>> 01
1
>>> 07
7
>>> 08
SyntaxError: invalid token
>>> 011
9
>>> 017
15
>>> 077
63
>>> 078
SyntaxError: invalid token
I know this i
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hi.
I trying to write an extension module to call some C libraries so I can
use them in Python. Several of the library functions pass pointers to
structures as arguments. I was thinking that I could create a class for
each structure, but I'm not sure how to get the data back and forth.
The example
Thanks for all the replies so far. I'm starting to look at SWIG, but
the libraries I want access to are all static. I created a small
interface file and a setup.py file, but when I build it, I get
undefined symbols. It sounds like the pack/unpack struct method is a
little to messy for my tastes.
Hello,
I have the following commands:
testb -s
testb -s -o
testb -s -o
How do i split the commands so that all three are valid. And how do i
check for missing arguments?
Thanks,
-Joe
--
http://mail.python.org/mailman/listinfo/python-list
I have access to the source, so it seems that I can create shareable
libs for the libraries I want to use using distutils. I do a
glob.glob() on the *.c files in the libscr directory. If I copy the
main library.h file over to where my module.i file is, I can do a
%include on it and things seem to
Thanks. I'll try it .
--
http://mail.python.org/mailman/listinfo/python-list
I'm slowly learning how to use distutils. What I have now is a setup.py
and a subdirectory containing the extension I'm playing around with.
## setup.py ##
#!/bin/env python
import sys, os, glob
from distutils.core import setup, Extension
py_version='python%d.%d' % (sys.version
I've been searching high and low for a way to simply convert a small
XML configuration file to Python data structures. I came across gnosis
XML tools, but need a built-in option for doing something similar.
My knowledge of DOM and anything beyond simple XML structures is
rudimentary at best. Is
Amara does indeed make it effortless to transform an XML document into
a Python structure. Unfortunately this suggestion requires the 3rd
party software, Amara, _and_ a 4Suite installation according to the
website.
The reason I can't expect users to have 3rd party tools is because this
tool will
A good question... Here's a followup question:
Does third-party software compile as well as the built-in modules when
using distutils and the py2exe extension module?
--
http://mail.python.org/mailman/listinfo/python-list
Tkinter).
Peter
- Original Message -
From: "Mike Wimpe" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Tuesday, March 15, 2005 11:54 PM
Subject: Good use for Jython
> Other than being used to wrap Java classes, what other real use is
> there for Jython
Since I've exhausted every option except for Amara, I've decided to
give it a try. However, this will only work if I can compile Amara and
4suite along with my application. I doubt 4suite will be able to be
compiled, but I'll try it anyway.
If I weren't set on using XML (I know, not every applic
Lorn Davies wrote:
> Hi there, I'm a Python newbie hoping for some direction in working
with
> text files that range from 100MB to 1G in size. Basically certain
rows,
> sorted by the first (primary) field maybe second (date), need to be
> copied and written to their own file, and some string manip
[EMAIL PROTECTED] wrote:
> Lorn Davies wrote:
> > Hi there, I'm a Python newbie hoping for some direction in working
> with
> > text files that range from 100MB to 1G in size. Basically certain
> rows,
> > sorted by the first (primary) field maybe second (date), n
I've tried xmltramp and element tree, but these tools aren't what I had
in mind. I've come to the realization that it's not the tools that are
lacking. In fact, I'm a big fan of ElementTree now, but would only use
it for large parsing tasks. Instead, I think the problem is either
inherent in the
One reason I chose not to use ConfigParser module is that I also have a
similar config file for a MATLAB compiled program to run along with my
Python script. XML would eliminate the need to use two different style
configuration files.
Another reason is that the programmer who is writing the GUI t
Thanks Lutz!
I should have looked into Amara's binderytools module earlier. This is
just the type of tool I was looking for. When I tried testing its
compatibility with py2exe, I was _almost_ able to compile... Does
anyone know where the following libraries exist? I thought Amara would
have th
Here is the link to the web hosting company that I use for my 3 sites.
http://frontpage-web-hosting.org/
--
http://mail.python.org/mailman/listinfo/python-list
chris wrote:
> Hello,
> Just started with python and databases.
> I am making a small script to update a local database.
> Looked around and couldn't find to many links with info about python
with
> databases.
> Any links or other resources anyone can recommend is appreciated.
>
> My que
I'm trying to embed a Python interpreter in a GUI I'm developing, and
I'm having trouble understanding the proper use of
code.InteractiveInterpreter.
Here's what I'm trying:
% python
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help",
[EMAIL PROTECTED] (Nathan Weston) wrote:
>I'm new to Python and am looking for a book to get me up to speed
>quickly. I'm an experienced programmer and very proficient with Ruby,
>so Python is coming easily to me and I don't need a gentle
>introduction -- I just need
Hi, I had very bad experience with Tkinter when using input servers(for
CJK languages like scim, xcin...) on Linux (doesn't work), so you might
consider this.
--
http://mail.python.org/mailman/listinfo/python-list
The Python in a Nutshell by Alex Martelli is a very good book. For
someone completely new to programming, Learning Python by Lutz might be
a better choice.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Instead of copy and paste, I use functions for code reuse. I didn't see
the light of OOP, yet. I use Python but never did anything with OOP. I
just can't see what can be done with OOP taht can't be done with
standart procedural programing.
--
http://mail.python.org/mailman/listinfo/pytho
You are correct Peter, the exception read something like this:
"Folder 85 not found."
I am paraphrasing, but that is the crux of the error. It takes about an
hour to produce the error so if you want an exact quote from the
exception, let me know and give me awhile. I looked through the nested
dir
Andrew Dalke wrote:
[snip]
> The BASICs of my youth also supported graphics and sounds.
>
> PLAY "CGFED>http://mail.python.org/mailman/listinfo/python-list
Tomas wrote:
> "Fuzzyman" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > If you're willing to pay for one, Komodo is very good. Especially
for
> > projects.
>
> I would recomend Wing IDE over Komodo. My experience is that Wing IDE
has
I think this is a silly task, but I have to do it. I have to fill a
file server (1 TB SATA RAID Array) with files. I wrote a Python script
to do this, but it's a bit slow... here it is:
import shutil
import os
import sys
import time
src = "G:"
des = "C:scratch"
os.chdir(src)
try:
for x in xrange
I think you solved it Fredrik.
The first ten folders looked like this:
D:\0\1\2\3\4\5\6\7\8\9
22 Chars long.
The rest looked like this:
\10\11\12\13\82\83\84
~ 222 CHars long.
Subdir 84 had one file in it named XXX.bat
That file broke the 255 limit, then subdir 85 wasn't created
"chris" <[EMAIL PROTECTED]> wrote:
>I'm creating an excel document dynamically from scratch using Python
>and the win32com module. All is well, but now I need to add a macro to
>the spreadsheet and run it (to enable some sorting features in the
>spreadsheet).
I call it "DBITM" or database internal text messaging.
For a free writing of this, send email to:
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
How many items can be stored in a Python list? I have close to 70,000
items... is this within a lists limits?
--
http://mail.python.org/mailman/listinfo/python-list
I did install the python 2.4 and nltk.
I am trying to follow the tutorial, but I kept getting error messages
about importing corpus as follows
===
>>> from nltk.corpus import gutenberg
Traceback (most recent call last):
File "", line 1, in -toplevel
I have a variable that I want to make global across all modules, i.e. I
want it added to the builtin namespace. Is there a way to do this?
--
http://mail.python.org/mailman/listinfo/python-list
Here's my situation, I've created some scripts to configure WebSphere
and the WAS scripting engine assigns the variable AdminConfig to a Java
object. I have created classes that wrap the AdminConfig settings,
simplifying the interface for those who want to script their server
installs.
At the com
Dear Tony.Meyer,
Thank you for answering this. I did exactly what you told me, but I got
following messages.
Do you have any idea?
=
>>> import nltk
>>> from nltk.corpus import gutenberg
Traceback (most recent call last)
Hello,
I'm doing a small website survey as a consultant for a company that has
a large private lan. Basically, I'm trying to determine how many web
sites there are on their network and what content the sites contain
(scary how they don't know this, but I suspect many companies are this
way).
Ever
Hi,
According to your advice, I installed the numeric library which is
numarray-1.1.1.win32-py2.4.exe, but I got the error message as follows.
Any help? frustrated...
>>> from nltk.corpus import gutenberg
Traceback (most recent call
Dear Jeff,
Thank you, it was the numeric. After I installed the numeric library
which is Numeric-23.6.win32-py2.3.exe for python 2.3.4 verson, it is
working correctly.
Thank you again,
Kyung
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm a complete newbie in learning python.
I was testing some sample codes I found in this newsgroup and seems it
could not locate the module ctypes.py. I installed python 2.4, wxPython
and pywin32. Just could not find this file. I thought it should be in
Lib/site-packages/ directory but it
Thanks a lot Alex. I got the file.
- wcc
--
http://mail.python.org/mailman/listinfo/python-list
Peter,
Thank you very much. I'll keep that in mind.
- wcc
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I was trying to install pywin32 on one computer which has Python 2.4
installed and it failed.
The error message I got was
"Can't load Python for pre-install script".
I tried unintalling & reinstalling python and that didn't fix the
problem.
What might be the problem? Thank you very much
Tuples are defined with regards to parentheses ()'s as everyone knows.
This causes confusion for 1 item tuples since (5) can be interpreted
as a tuple OR as the number 5 in a mathematical expression
such as x = (5) * (4+6).
Wouldn't it have been better to define tuples with <>'s or {}'s or
someth
> There just isn't enough
> neat-looking punctuation in the ASCII character set.
Alex
I can't thank you enough for your reply and for everyones' great info
on this thread. The end of your email gave a rock solid reason why it
is impossible to improve upon ()'s for tuples
*There simply isn't
Brian
I am so thankful for your reply and for Alex's and everyone else's on
this thread. (See my reply to Alex.) This email may seem minor but it
was bugging me for months. You just
pointed out what I should have remembered on my own...
*<>'s wouldn't have been a perfect choice because they wo
The beta 10 of webGobbler is available for download.
http://sebsauvage.net/python/webgobbler/
Amongst the changes, the Windows screensaver now works,
although it still misses a configuration GUI.
I also created a non-technical page for webGobbler, the gallery:
http://sebsauvage.net/webgobbler/
PIGIP will hold it's March meeting tonight at 7pm at the Lawrenceville
Public Library.
Anyone in Central New Jersey, USA interested in the Python Programming
Language is invited to attend.
We will be reviewing the Python tutorial (Chapters 6,7,and 8), and open
discussion about Python use will be e
since I'm developing in Tkinter, I'm intrigued by your comment that:
"It allowed me to do things in hours,
which literally took weeks with tkinter, "
please elaborate!
Cheers
S
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I am trying to convert some C code into python.
Here's the C code...
typedef enum {
CODE1 = 0x1,
CODE2 = 0x2
} CODE
testit(unsigned char *buffer,
unsigned long length,
CODE code)
{
unsigned long data
switch (code)
{
case CODE1:
while(len--)
{
Can i do something like this?
if code == CODE1:
data = 0x0
While True:
len = len - 1
if len == -1:
break
buffer = data
Do i need to initialze the buffer?
-Thanks,
Joe
--
http://mail.python.org/mailman/listinfo/python-list
I'm unclear on how .pth files work. Some posts imply they can be
arbitrarily named, as long as they include the .pth extension, and can
exist anywhere in the current sys.path. Other documentation seems to
imply that they must be named .pth, although I'm not sure what
"package" it would be named a
901 - 1000 of 4915 matches
Mail list logo