[issue3199] 2.6b1 Build Fails On OSX 10.5

2008-06-25 Thread John Abel

New submission from John Abel [EMAIL PROTECTED]:

The build process on Leopard fails:

cd Mac  make altinstallunixtools DESTDIR=
if [ ! -d /usr/local/bin ]; then  \
/usr/bin/install -c -d -m 755 /usr/local/bin ;\
fi
for fn in python2.6 pythonw2.6 idle2.6 \
  pydoc2.6 python2.6-config) smtpd2.6.py ;\
do \
ln -fs 
/Library/Frameworks/Python.framework/Versions/2.6/bin/${fn} 
/usr/local/bin/${fn} ;\
done
/bin/sh: -c: line 0: syntax error near unexpected token `)'
/bin/sh: -c: line 0: `for fn in python2.6 pythonw2.6 idle2.6  
pydoc2.6 python2.6-config) smtpd2.6.py ;do  ln -fs 
/Library/Frameworks/Python.framework/Versions/2.6/bin/${fn} 
/usr/local/bin/${fn} ;done'
make[1]: *** [altinstallunixtools] Error 2
make: *** [frameworkaltinstallunixtools] Error 2

To fix, remove the additional ) following -config on line 116 of 
Mac/Makefile:

  pydoc$(VERSION) python$(VERSION)-config) 
smtpd$(VERSION).py ;\

--
components: Build
messages: 68730
nosy: johna
severity: normal
status: open
title: 2.6b1 Build Fails On OSX 10.5
versions: Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread John Abel
Your server is only listening on 127.0.0.1.

Jose Carlos Balderas Alberico wrote:
 Up till now I've been setting up my server and client in the same 
 machine, using the localhost address for everything.
 Once I've made it work, I need to move my client application to the 
 computer where it'll be run from, and for some reason, I get a 
 socket.error: (111, 'connection refused').
  
 The server is listening on port 8000. I've used the line
  
 server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost, 8000), )
 ##register functions...
 ...
 ...
 server.serve_forever()
  
  
 And the client does the following:
  
 host = :8000 (where  is the server's IP address)
 conn = xmlrpclib.connect(host)
 data = conn.requestData() (requestData is a function previously 
 registered in the server)
  
 I've made sure the server is listening on port 8000, since the netstat 
 command says it's listening on port 8000.
 I've also pinged the server from the client and viceversa and I get an 
 answer. So they can see each other.
  
 I've tried looking in google but couldn't find a solution to this 
 problem. Anyone can give me a hand on this?
 Thank you very much.
  
 Jose Carlos.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread John Abel
Using the '' makes it listen on all interfaces.

Jose Carlos Balderas Alberico wrote:
 Okay, I changed this:
   server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost, 8000), 
 )
 for this:
   server = SimpleXMLRPCServer.SimpleXMLRPCServer(('', 8000), )
  
 Replacing localhost with two simple quotes ' makes it work.
 Anyone knows the reason for this?
  
 Thank so much.
  
 Jose Carlos
  
 2006/4/12, Jose Carlos Balderas Alberico 
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

 Thank you for the quick reply John...
 Is there a way to sort this out? Should I specify another address
 here:
  
 server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost,
 8000), )
  
 instead of localhost ?
  
 I'm kind of new to client/server programming, so I'm at a loss here.
 Thank you very much for your attention.
  
 Jose Carlos.
  
  


  
 2006/4/12, John Abel [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

 Your server is only listening on 127.0.0.1 http://127.0.0.1/.

 Jose Carlos Balderas Alberico wrote:
  Up till now I've been setting up my server and client in the same
  machine, using the localhost address for everything.
  Once I've made it work, I need to move my client application
 to the
  computer where it'll be run from, and for some reason, I get a
  socket.error: (111, 'connection refused').
 
  The server is listening on port 8000. I've used the line
 
  server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost,
 8000), )
  ##register functions...
  ...
  ...
  server.serve_forever()
 
 
  And the client does the following:
 
  host = :8000 (where  is the server's IP address)
  conn = xmlrpclib.connect(host)
  data = conn.requestData() (requestData is a function previously
  registered in the server)
 
  I've made sure the server is listening on port 8000, since
 the netstat
  command says it's listening on port 8000.
  I've also pinged the server from the client and viceversa and
 I get an
  answer. So they can see each other.
 
  I've tried looking in google but couldn't find a solution to this
  problem. Anyone can give me a hand on this?
  Thank you very much.
 
  Jose Carlos.


  



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xml.dom.minidom - parseString - How to avoid ExpatError?

2005-10-27 Thread John Abel
Have a look on:

http://xml.com/pub/a/98/10/guide0.html?page=4#WELLFORMED

Explains it better then I can.

J

Gregory Piñero wrote:

 What do you mean by well-formed?  What is required to make XML well 
 formed?

 -Greg


 On 10/26/05, *John Abel* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

 Try this page:

 http://docs.python.org/lib/module-xml.sax.saxutils.html

 I've just tried the code, taking out the nbsp, and adding in the
 belo,
 as the XML is not well formed, otherwise.

 ?xml version=1.0 encoding=ISO-8859-15?

 The code then works.

 HTH

 J

 Gregory Piñero wrote:

  Should I try some sort of XML group instead?  I'm still stuck on
 this.
 
  -Greg
 
 
  On 10/25/05, *Gregory Piñero* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
 
  Hi guys,
 
  I was hoping some XML expert could help me make this code work.
  Below is sample code with sample XML similar to what I'm
 dealing with.
 
  How can I make the weird characters in the XML not break the
  parser?  I'll do anything to make this work!
 
  (Note: the nbsp; broke my parser yesterday but doesn't seem
 to in
  this sample code)  But really I'm looking for solutions that
 will
  handles lots
  of unusual characters.
 
  Much thanks,
 
  Greg
 
 
  code
  from xml.dom.minidom import parseString
  data=
  blog
  post
  This is sample problem text. nbsp; £500.00
  /post
  /blog
  
  myDOM=parseString(data)
  /code
 
  error
  Traceback (most recent call last):
File
 
 C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py,
  line 307, in RunScript
  debugger.run(codeObject, __main__.__dict__,
 start_stepping=0)
File
 
 C:\Python23\Lib\site-packages\pythonwin\pywin\debugger\__init__.py,
  line 60, in run
  _GetCurrentDebugger().run(cmd, globals,locals,
 start_stepping)
File
 
 C:\Python23\Lib\site-packages\pythonwin\pywin\debugger\debugger.py,
  line 631, in run
  exec cmd in globals, locals
File C:\Documents and Settings\Gregory\My
 Documents\Python\xml
  help\xmlproc.py, line 9, in ?
  myDOM=parseString(data)
File C:\Python23\lib\xml\dom\minidom.py, line 1929, in
 parseString
  return expatbuilder.parseString (string)
File C:\Python23\lib\xml\dom\expatbuilder.py, line 940, in
  parseString
  return builder.parseString(string)
File C:\Python23\lib\xml\dom\expatbuilder.py, line 223, in
  parseString
  parser.Parse(string, True)
  ExpatError: undefined entity: line 4, column 29
  /error
 
 
 
  --
  Gregory Piñero
  Chief Innovation Officer
  Blended Technologies
  (www.blendedtechnologies.com
 http://www.blendedtechnologies.com
 http://www.blendedtechnologies.com
 http://www.blendedtechnologies.com)
 
 
 
 
  --
  Gregory Piñero
  Chief Innovation Officer
  Blended Technologies
  (www.blendedtechnologies.com
 http://www.blendedtechnologies.com
 http://www.blendedtechnologies.com)


 --
 http://mail.python.org/mailman/listinfo/python-list
 http://mail.python.org/mailman/listinfo/python-list




 -- 
 Gregory Piñero
 Chief Innovation Officer
 Blended Technologies
 (www.blendedtechnologies.com http://www.blendedtechnologies.com) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looping Problem (Generating files - only the last record generates a file)

2005-10-26 Thread John Abel
[EMAIL PROTECTED] wrote:

Hello All,

I have a problem with the program that should generate x number of txt
files (x is the number of records in the file datafile.txt).

Once I execute the program (see below) only one file (instead of x
files) is created. The file created is based on the last record in
datafile.txt.

The program is as follows:

#!  python

HEADER = This page displays longitude-latitude information
SUBHEADER = City

for line in open(datafile.txt):


town, latlong = line.split('\t')

f = open(town + .txt, w+)

f.write(HEADER + \n)
f.write(SUBHEADER + :  + town + \n)
f.write(LAT/LONG + :  + latlong + \n)
f.close()

  

These lines need to be within your loop.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xml.dom.minidom - parseString - How to avoid ExpatError?

2005-10-26 Thread John Abel
Try this page:

http://docs.python.org/lib/module-xml.sax.saxutils.html

I've just tried the code, taking out the nbsp, and adding in the belo, 
as the XML is not well formed, otherwise.

?xml version=1.0 encoding=ISO-8859-15?

The code then works.

HTH

J

Gregory Piñero wrote:

 Should I try some sort of XML group instead?  I'm still stuck on this.

 -Greg


 On 10/25/05, *Gregory Piñero* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Hi guys,

 I was hoping some XML expert could help me make this code work. 
 Below is sample code with sample XML similar to what I'm dealing with.

 How can I make the weird characters in the XML not break the
 parser?  I'll do anything to make this work!

 (Note: the nbsp; broke my parser yesterday but doesn't seem to in
 this sample code)  But really I'm looking for solutions that will
 handles lots
 of unusual characters.

 Much thanks,

 Greg


 code
 from xml.dom.minidom import parseString
 data=
 blog
 post
 This is sample problem text. nbsp; £500.00
 /post
 /blog
 
 myDOM=parseString(data)
 /code

 error
 Traceback (most recent call last):
   File
 C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py,
 line 307, in RunScript
 debugger.run(codeObject, __main__.__dict__, start_stepping=0)
   File
 C:\Python23\Lib\site-packages\pythonwin\pywin\debugger\__init__.py,
 line 60, in run
 _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
   File
 C:\Python23\Lib\site-packages\pythonwin\pywin\debugger\debugger.py,
 line 631, in run
 exec cmd in globals, locals
   File C:\Documents and Settings\Gregory\My Documents\Python\xml
 help\xmlproc.py, line 9, in ?
 myDOM=parseString(data)
   File C:\Python23\lib\xml\dom\minidom.py, line 1929, in parseString
 return expatbuilder.parseString(string)
   File C:\Python23\lib\xml\dom\expatbuilder.py, line 940, in
 parseString
 return builder.parseString(string)
   File C:\Python23\lib\xml\dom\expatbuilder.py, line 223, in
 parseString
 parser.Parse(string, True)
 ExpatError: undefined entity: line 4, column 29
 /error



 -- 
 Gregory Piñero
 Chief Innovation Officer
 Blended Technologies
 (www.blendedtechnologies.com http://www.blendedtechnologies.com) 




 -- 
 Gregory Piñero
 Chief Innovation Officer
 Blended Technologies
 (www.blendedtechnologies.com http://www.blendedtechnologies.com) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Apache Oddness On OSX

2005-10-25 Thread John Abel
[EMAIL PROTECTED] wrote:

John Abel wrote:
  

Hi,

I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI
scripts using the builtin Apache.  For ease, I've symlinked my custom
modules into the /Library/Python/2.3/site-packages directory, and they
import OK via command line python.  However, when I perform the import
from a cgi script, python fails to find the module.  It is definately
something to do with the symlink, as the CGI works OK if I copy the
directory into site-packages.  Is there some oddness with Python/Apache
and symlink imports?

Any pointers would be most useful.



If running OS supplied Apache, it runs as the user www. Because this
isn't you or root, check that the directory your symlink points at is
accessible to others as well as any directories above it back up to the
root directory. If it isn't accessible, the user Apache runs as will
not
be able to find and use the files. When you are copying the directory
you are possibly giving it read access for others in  the process and
that is why it works then.

Graham

  

Yup, that's the problem.  Just got to figure out OSX's permissions, now.

Thank you!

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Security on XML-RPC

2005-10-25 Thread John Abel
dcrespo wrote:

Hi all,

Anyone knows a simpler but stronger control access to XML-RPC functions
than the one I comment here?

My actual system works like this:

I have a TCP Server and an XML-RPC Server. Both of them verify if the
IP address is allowed.

The TCP Server works for validate and register an IP address if it
wasn't validated previously, while the XML-RPC Server works only if the
requester IP address was allowed through the mentioned TCP Server. This
means, anyone who wants to connect to the XML-RPC Server has to pass
the TCP Server.

How a client connects to the TCP Server and authenticate his IP?

Well, there is an interchange of encrypted data between the Client and
the TCP Server, where, in few words, the client sends a UserName and a
Password, all this through the send() function of the Socket
connection. If the TCP Server authenticate an IP address, then that
Client will be able to connect to the XML-RPC Server and use its
defined functions.

The problem I see here is that if I want someone to taking advantage of
my XML-RPC functions, I have to tell him all these. I would like to get
a strong but simpler way of doing all these.

Thank you for reading and thinking.

Daniel

  

Not the most secure, but I have a modified XMLRPC Server/client using 
Digest auth, if that's any use?

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Python/Apache Oddness On OSX

2005-10-24 Thread John Abel
Hi,

I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI 
scripts using the builtin Apache.  For ease, I've symlinked my custom 
modules into the /Library/Python/2.3/site-packages directory, and they 
import OK via command line python.  However, when I perform the import 
from a cgi script, python fails to find the module.  It is definately 
something to do with the symlink, as the CGI works OK if I copy the 
directory into site-packages.  Is there some oddness with Python/Apache 
and symlink imports?

Any pointers would be most useful.

Thanks

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dynamical importing

2005-10-19 Thread John Abel
Try:

userModule = _importModule( pathToModule )

def _importModule( moduleName ):
modName = __import__ ( moduleName )
modComponents = moduleName.split( '.' )
for indivComp in modComponents[ 1: ]:
modName = getattr( modName, indivComp )

return modName

HTH,

J

Joerg Schuster wrote:

Hello,

I need to import modules from user defined paths. I.e. I want to do
something
like:

module_dir = sys.argv[1]

my_path = os.path.join(module_dir, 'bin', 'my_module')

from my_path import my_object

Obviously, it doesn't work this way. How would it work?

Jörg Schuster

  


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dynamical importing

2005-10-19 Thread John Abel
Fredrik Lundh wrote:

John Abel wrote:

  

def _importModule( moduleName ):
modName = __import__ ( moduleName )
modComponents = moduleName.split( '.' )
for indivComp in modComponents[ 1: ]:
modName = getattr( modName, indivComp )

   return modName



__import__ takes a module name, not an arbitrary file name.

/F 



  

Didn't mean to imply that it did.  By pathToModule, I meant spam.ham as 
in 
http://localhost/documentation/Python-Docs-2.4.1/lib/built-in-funcs.html#l2h-6 
( hopefully, that should explain things to the OP ).

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Make SimpleXMLRPCServer Require Auth?

2005-10-12 Thread John Abel
John Abel wrote:

Hi,

I implemented a SimpleXMLRPCServer, modified it slightly to restrict 
clients based on their IP, but I need to take it a stage further, and 
add user authentication.  I would appreciate any pointers as to how I 
might go about this, or any packages which already provide this.  I'm 
guessing that I'll need to make changes to BaseHTTPServer.

Thanks

J
  

Never mind, managed to modify SimpleXMLRPCServer with code from the 
digest examples in Python sandbox.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating images with text in them

2005-07-21 Thread John Abel
Have you downloaded the pilfonts.zip from effbot.org?

J

phil hunt wrote:

I am trying to generate some images (gifs or pngs) with text in 
them. I can use the Python Imaging Library, but it only has access 
to the default, rather crappy, font. 

Ideally I'd like to use one of the nicer fonts that come with my X 
Windows installation. Using Tkinter I can draw these fonts on the 
screen; is there any way to get these fonts into a bitmapped image?
For example, can I draw some text on a canvas and then grab that 
canvas as a bitmap into PIL, and then save it as a file?

Alternately, is there a good source of PIL font files (.pil files)
somewhere?

If the writers of the Python Imaging Library are reading this, may I 
suggest that they add more fonts to it. Yes, that would increase 
the size, but these days disk space is cheap and programmer time
expensive.

  


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python scripts wont run - HELP

2005-07-18 Thread John Abel
windozbloz wrote:

Bye Bye Billy Bob...

Hello All,
I'm a fairly literate windoz amateur programmer mostly in visual basic. I
have switched to SuSE 9.2 Pro and am trying to quickly come up to speed
with Python 2.3.4.  I can run three or four line scripts from the command
line but have not been able to execute a script from a file.  

I have used EMACS and JEDIT to create small test routines.  I would right
click the file and set properties to executable.  I would then click the
icon, the bouncy ball would do its thing then a dialog box would flash on
the screen for a fraction of a second.  I could tell it had a progress bar
on it but could not catch anything else on it.  Then nothing else would
happen.

If I could execute a script the world would once again be my playground...
PLEASE HELP.



  

You will need to include

#!/usr/bin/python

At the top of your script.

HTH

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Missing Something Simple

2005-07-12 Thread John Abel
Hi,

I have a list of variables, which I am iterating over.  I need to set 
the value of each variable.  My code looks like:

varList = [ varOne, varTwo, varThree, varFour ]

for indivVar in varList:
indivVar = returnVarFromFunction()

However, none of the variables in the list are being set.  I thought of 
using setattr, but this code sits in a function, and not class, so I'm 
unsure what the object would be.

I'm hoping someone can point me in the right direction.

John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing Something Simple

2005-07-12 Thread John Abel
harold fellermann wrote:

Hi,

  

I have a list of variables, which I am iterating over.  I need to set
the value of each variable.  My code looks like:

varList = [ varOne, varTwo, varThree, varFour ]

for indivVar in varList:
indivVar = returnVarFromFunction()

However, none of the variables in the list are being set.



You only change the value of the local variable in the body
of the for loop. it has no effect on the list. you could do e.g.

varList = [vorOne,varTwo,varThree,varFour]
for i in len(varList) :
   varList[i] = returnVarFromFunction()

However, as in this example the former list values are not used anyway,
you could just write:

varList = [ returnVarFromFunction for i varList ]


cheers,

- harold -

--
Tages Arbeit, abends Gäste,
saure Wochen, frohe Feste!
-- Johann Wolfgang v. Goethe

  

The problem I have, is the variables are referenced elsewhere.  They
have been declared before being used in the list.  Basically, I'm after
the Python way of using deferencing.

J

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing Something Simple

2005-07-12 Thread John Abel

have been declared before being used in the list.  Basically, I'm after
the Python way of using deferencing.
  

OK, that should say dereferencing.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing Something Simple

2005-07-12 Thread John Abel
harold fellermann wrote:


so, if I understand you right, what you want to have is a list of
mutable objects, whose value you can change without changing the 
objects'
references.
  

Yes!

class Proxy :
   def __init__(self,val) : self.set(val)
   def set(self,val) : self.val = val
   def get(self) : return self.val


a = Proxy(1)
b = Proxy(2)
c = Proxy(3)

varList = [a,b,c]

for i in varList :
   i.set(returnVarFromFunction())

print a,b,c

prints whatever returnVarFromFunction has returned.
n.b.: instead of the Proxy class, you can use any other mutable
objects, e.g. lists.


- harold -


--
All unsere Erfindungen sind nichts als verbesserte Mittel
  zu einem nicht verbesserten Zweck.
-- H.D. Thoreau

  

That does it.  Thank you! 

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Got an interesting problem. (platform ruuning issue)

2005-06-29 Thread John Abel
Jeffrey Maitland wrote:

when running scripts they seem to work fine on ia-32 but I get
segfault on ia-64 what the heck should I be looking for?

I did notice that it seems to work ok only for certain scripts but any
script that imports MySQLdb or glob seems to make this occur.

Thanks Jeff
  

That sounds to me like an issue with compiled libraries.  Does cli mysql 
work on the machine ( would verify a working libmysqlclient_r )?  I'm 
guessing glob fails due to it's dependence on re, and the os specific 
parts of os?

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: building python 2.4.1

2005-06-28 Thread John Abel
Andreas Heiss wrote:

Hi !
I am trying to build python 2.4.1 from source on a Linux system.
Everything seems fine, but tkinter seems not to work.
The file _tkinter.pyd is missing.
How can  tell configure to build all necessary components ?

Thanks
Andreas
  

It looks to like Tcl/Tk is not installed on your system.  You will need 
to have them installed for Tkinter to build.

HTH

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: building python 2.4.1

2005-06-28 Thread John Abel
Andreas Heiss wrote:

John Abel wrote:

  

Andreas Heiss wrote:



Hi !
I am trying to build python 2.4.1 from source on a Linux system.
Everything seems fine, but tkinter seems not to work.
The file _tkinter.pyd is missing.
How can  tell configure to build all necessary components ?

Thanks
Andreas
 

  

It looks to like Tcl/Tk is not installed on your system.  You will need
to have them installed for Tkinter to build.



Actually, tk and tcl 8.4 are installed. 
However, there are no tcl.h and tk.h header files. I haven't ssen those
files since Tcl/Tk8.0


  

Hmmm, where they a pre/package install?  I'm sure I had to build Tcl/Tk 
from source on my Debian install.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python choice of database

2005-06-20 Thread John Abel
Gadfly
PySQLite ( requires SQLite library )

J

Philippe C. Martin wrote:

Hi,

I am looking for a stand-alone (not client/server) database solution for
Python.

1) speed is not an issue
2) I wish to store less than 5000 records
3) each record should not be larger than 16K


As I start with Python objects, I thought of using shelve, but looking at
the restrictions (record size + potential collisions) I feel I should study
my options a bit further before I get started.


Regards,

Philippe

  


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python choice of database

2005-06-20 Thread John Abel
Just thought of a couple more:

SnakeSQL
KirbyBase

J

John Abel wrote:

Gadfly
PySQLite ( requires SQLite library )

J

Philippe C. Martin wrote:

  

Hi,

I am looking for a stand-alone (not client/server) database solution for
Python.

1) speed is not an issue
2) I wish to store less than 5000 records
3) each record should not be larger than 16K


As I start with Python objects, I thought of using shelve, but looking at
the restrictions (record size + potential collisions) I feel I should study
my options a bit further before I get started.


Regards,

Philippe

 




  



.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python choice of database

2005-06-20 Thread John Abel
Philippe C. Martin wrote:

Thank you all for your answers.

A pure Python would have beenmy first choice. yet I now feel I should spend
some time looking at PySQLite (I like the fact it's pre-compiled for
Windows).

Thanks.

Philippe



Philippe C. Martin wrote:

  

Hi,

I am looking for a stand-alone (not client/server) database solution for
Python.

1) speed is not an issue
2) I wish to store less than 5000 records
3) each record should not be larger than 16K


As I start with Python objects, I thought of using shelve, but looking at
the restrictions (record size + potential collisions) I feel I should
study my options a bit further before I get started.


Regards,

Philippe



  

Out of the suggestions SnakeSQL and KirbyBase are pure python.  Gadfly 
is sorta pure, in that it will work without the compiled kjbuckets lib.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Perl s/ To Python?

2005-06-10 Thread John Abel
Does anyone know of a quick way of performing this:

$testVar =~ s#/mail/.*$##g

The only way I can think of doing it, is:

mailPos = testVar.find( mail )
remainder =  testVar[ :mailPos ]

Any ideas would be appreciated.  I'm iterating over a lot of entries, 
and running these lines for each entry.

J


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Perl s/ To Python?

2005-06-10 Thread John Abel
JZ wrote:

Dnia Fri, 10 Jun 2005 14:57:21 +0100, John Abel napisa(a):

  

$testVar =~ s#/mail/.*$##g

The only way I can think of doing it, is:

mailPos = testVar.find( mail )
remainder =  testVar[ :mailPos ]

Any ideas would be appreciated.  I'm iterating over a lot of entries, 
and running these lines for each entry.



import re
testVar = re.compile(r'/mail/.*$').sub('', testVar) 

--
JZ
  

That's brill.  Never even thought if using re.  Thank you!

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Basic questions about packages/modules.

2005-06-10 Thread John Abel
Negroup wrote:

Hi, first of all sorry for boring you with a such simple request. I'm
using Python since few days, and I like it even if I'm not yet in
confidence. I'd like to organize my programs in hierarchical
structures, thus I thought that packages could be the solution,
however I have some difficulties understanding their utilization (even
after reading chapter 6 of the tutorial, about modules).

Now an example (silly) to clarify my doubts:

This is the structure:
main.py
importers/
__init__.py (empty)
importer1.py
config/
__init__.py (empty)
parameters.py

main.py
===
from importers import importer1
print importer1.display()

importers/importer1.py
==
from config import parameters
def display():
return '-' * parameters.counter

config/parameters.py

counter = 5


All works fine when I run python main.py, while I get an error
trying to run python importers/importer1.py:

Traceback (most recent call last):
  File importers/importer1.py, line 1, in ?
from config import parameters
ImportError: No module named config

Can you explain why does that happen? It prevents me to test
importer1.py alone.

TIA,
negroup
  

For your code to work, config would have to be a subdirectory under 
importers.  Unless, config had been installed in the site-packages.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: optparse.py: FutureWarning error

2005-06-09 Thread John Abel
Magnus Lycka wrote:

John Abel wrote:
  

Magnus Lycka wrote:



  

As a programmer on Win32, and *nix platforms, I agree with needing 
better tools.  however, I find cygwin a pita.  For tools such as grep 
and find, try this http://unxutils.sourceforge.net/.  No need for cygwin 
( though that's not say cygwin isn't useful ).



Is there any shell there? While I do think that cd /cygdrive/c is a
bit silly, I still prefer bash to Microsoft's cmd.exe (even if cmd.exe
is much, much better than the old command.com).
  

There is a sh, but no bash, scroll down the the linked page for a full 
list of the executables.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple SMTP server

2005-06-09 Thread John Abel
Jesse Noller wrote:

Hello -

I am looking at implementing a simple SMTP server in python - I know
about the smtpd module, but I am looking for code examples/snippets as
the documentation is sparse.

The server I am looking at writing is really simple - it just needs to
fork/thread appropriately for handling large batches of email, and all
it has to do is write the incoming emails to the disk (no
relaying/proxying/etc).

If anyone has any good examples/recipes I'd greatly appreciate it.

Thanks

-jesse
  

twisted.mail for a starting point, or Quotient which is an SMTP Server 
based on twisted.mail.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: optparse.py: FutureWarning error

2005-06-08 Thread John Abel
Magnus Lycka wrote:

Terry Reedy wrote:
  

This should REALLY be on the doc page of the Python site. 


Agreed.

  

It is really time to stop pretending that the only Python users 
that count have a *nix on their desk.


I agree with this too, but if you're a programmer
on the Windows platform with possibility to install
software on the machine you work with, I strongly
suggest that you install cygwin or something
equivalent. Not just for man python. Tools like
grep and find are vastly superior to anything I've
seen natively on windows if you want to process the
data you find in some automated way.

In my experience, Windows 2000 and later are fairly
decent operating systems if you have Python and
cygwin installed, but I'd feel awfully handicapped
without those tools.
  

As a programmer on Win32, and *nix platforms, I agree with needing 
better tools.  however, I find cygwin a pita.  For tools such as grep 
and find, try this http://unxutils.sourceforge.net/.  No need for cygwin 
( though that's not say cygwin isn't useful ).

J
-- 
http://mail.python.org/mailman/listinfo/python-list


More Rewrite Request Within SocketServer?

2005-05-27 Thread John Abel
OK, I'm guessing what I was after ( see below ) isn't possible.  Does 
anyone know of an easy way of having verify_request inform the request 
handler of certain events, say client is unauthorised?  I thought of 
having it set a flag, and referring to it from the handler class ( 
self.server.hostAllowed for example ), but that wouldn't work quite 
right in a threaded server.

Any ideas?

J

 Original Message 
Subject:ReWrite Request Within SocketServer?
Date:   Wed, 25 May 2005 17:04:53 +0100
From:   John Abel [EMAIL PROTECTED]
To: python-list@python.org



Hi!

I may be missing something simple, but is there a way to have 
verify_request change the request before it gets processed by the 
RequestHandlerClass?

Regards

J
-- 
http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: More Rewrite Request Within SocketServer?

2005-05-27 Thread John Abel
Paul Rubin wrote:

John Abel [EMAIL PROTECTED] writes:
  

OK, I'm guessing what I was after ( see below ) isn't possible.  Does
anyone know of an easy way of having verify_request inform the request
handler of certain events, say client is unauthorised?  I thought of
having it set a flag, and referring to it from the handler class (
self.server.hostAllowed for example ), but that wouldn't work quite
right in a threaded server.



I'd think you could do that.  Isn't the new thread already started
when the verify method runs?
  

Unfortunately not.  verify_request is called before process_request 
which launches the thread ( in the ThreadingMixIn version ).  Unless I 
passed the flag as an argument to the thread, and then had it reset.  
Hm, worth thinking about,

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running a python program during idle time only

2005-05-27 Thread John Abel
Shane Hathaway wrote:

Mike Meyer wrote:
  

On a completely different topic, this looks like the wrong way to solve
the problem. You want to update a search engine based on changes to the
underlying file system. The right way to do this isn't to just keep
rescanning the file system, it's to arrange things so that your scanner
gets notified of any changes made to the file system. I did something like 
this for my web site search engine, but that's hooked into the SCM that's
used for propogating changes to the web site. I know someone is working
on patches to the FreeBSD kernel to make this kind of thing work. It would
seem that some of the backup facilities that worked by keeping a mirror
of the disk on separate media would have to have used such hooks, but maybe
not.



I think you're right that filesystem change notification is what Carlos
needs.

If you're interested in using Linux, Carlos, inotify is a new kernel
module that can notify your program of filesystem changes.  It's not
folded into the mainline kernel yet, but it's a clean patch.

http://www.edoceo.com/creo/inotify/

I don't know if Windows has anything like it.  I'd be interested to hear
if it does.

Shane
  

Using the PyWin32 extensions, you can register an event with the kernel, 
and then have the script sleep.  If I can remember how, I'll post some 
code.  It's been a while since I coded specific Win32 stuff.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running a python program during idle time only

2005-05-27 Thread John Abel
John Abel wrote:

Shane Hathaway wrote:

  

Mike Meyer wrote:
 



On a completely different topic, this looks like the wrong way to solve
the problem. You want to update a search engine based on changes to the
underlying file system. The right way to do this isn't to just keep
rescanning the file system, it's to arrange things so that your scanner
gets notified of any changes made to the file system. I did something like 
this for my web site search engine, but that's hooked into the SCM that's
used for propogating changes to the web site. I know someone is working
on patches to the FreeBSD kernel to make this kind of thing work. It would
seem that some of the backup facilities that worked by keeping a mirror
of the disk on separate media would have to have used such hooks, but maybe
not.
   

  

I think you're right that filesystem change notification is what Carlos
needs.

If you're interested in using Linux, Carlos, inotify is a new kernel
module that can notify your program of filesystem changes.  It's not
folded into the mainline kernel yet, but it's a clean patch.

http://www.edoceo.com/creo/inotify/

I don't know if Windows has anything like it.  I'd be interested to hear
if it does.

Shane
 



Using the PyWin32 extensions, you can register an event with the kernel, 
and then have the script sleep.  If I can remember how, I'll post some 
code.  It's been a while since I coded specific Win32 stuff.

J
  

Couldn't find my code, but this page has various ways of doing it on Win32.

http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html

HTH

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: More Rewrite Request Within SocketServer?

2005-05-27 Thread John Abel
Paul Rubin wrote:

 If verify_request is finished before the new thread starts, then I'd

think it could set a flag and the new thread could find it.  You get a
race condition only if both threads are trying to mess with the flag
simultaneously.
  

Hmm, I think you're right.  Thanks!

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running a python program during idle time only

2005-05-27 Thread John Abel
Shane Hathaway wrote:

Mike Meyer wrote:
  

On a completely different topic, this looks like the wrong way to solve
the problem. You want to update a search engine based on changes to the
underlying file system. The right way to do this isn't to just keep
rescanning the file system, it's to arrange things so that your scanner
gets notified of any changes made to the file system. I did something like 
this for my web site search engine, but that's hooked into the SCM that's
used for propogating changes to the web site. I know someone is working
on patches to the FreeBSD kernel to make this kind of thing work. It would
seem that some of the backup facilities that worked by keeping a mirror
of the disk on separate media would have to have used such hooks, but maybe
not.



I think you're right that filesystem change notification is what Carlos
needs.

If you're interested in using Linux, Carlos, inotify is a new kernel
module that can notify your program of filesystem changes.  It's not
folded into the mainline kernel yet, but it's a clean patch.

http://www.edoceo.com/creo/inotify/

I don't know if Windows has anything like it.  I'd be interested to hear
if it does.

Shane
  

As an alternative to inotify there's this 
http://oss.sgi.com/projects/fam/, with various libraries ( Perl, Python, 
etc ).

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__() not called automatically

2005-05-26 Thread John Abel
bruno modulix wrote:

Paul McNett wrote:
  

Sriek wrote:



(snip)
  

Similarly, why do we have to explicitly use the 'self' keyword
everytime?
This is closer to a wart, IMO, 
  


  

Here's one of the shorter threads discussing 'self'.  I remember one 
long running thread, but can't seem to find it, at the minute

http://groups.google.co.uk/group/comp.lang.python/browse_thread/thread/f28dea8d63ac44/a0c80d8b1c92101c?q=python++self+implicitrnum=1hl=en#a0c80d8b1c92101c

J
-- 
http://mail.python.org/mailman/listinfo/python-list


ReWrite Request Within SocketServer?

2005-05-25 Thread John Abel
Hi!

I may be missing something simple, but is there a way to have 
verify_request change the request before it gets processed by the 
RequestHandlerClass?

Regards

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Process monitoring

2005-05-20 Thread John Abel
gsteff wrote:

Hey, I'm working on a Python program that will launch some other
non-Python process using os.spawn (in the os.P_NOWAIT mode) and then
basically wait for it to finish (while doing some other stuff in the
interim).  Normally, the new process will signal that it's done by
writing to a file, but I'd like to also find out if the new process
died unexpectedly.  Anyone know any preferrable ways to do this?

Greg Steffensen

  

If you're using 2.4, have a look at the subprocess module.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Defunct Processes With subprocess.Popen

2005-05-11 Thread John Abel
Hi!

I'm currently writing a script which launches external programs, but it 
keeps leaving zombie/defunct processes behind, until I kill the 
launching script, which is a bit of a pain, as it's supposed to be a 
daemon.  The code I'm using is:

newPid = subprocess.Popen( cmdLine[ 1: ], executable=cmdLine[ 0 ], 
close_fds=True ).pid

I've tried calling it using the shell=True flag, but that leaves a 
zombie for the sh, instead.  I'm not interested in any output, the only 
thing I need returning, is the pid of the new process.  I've tried using 
spawn*, with the same results.  Does anyone have any ideas?

Thanks.

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: reg mail sending without smtp module

2005-05-11 Thread John Abel
praba kar wrote:

Dear All,

 Is it possible to send a message as a mail
with out smtplib module?  If you find out any module
for mail sending(without smtplib) kindly mail me.

regards
Prabahar
 


Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
  

socket

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Module on Time Date

2005-05-10 Thread John Abel
Sara Khalatbari wrote:

Is there a Module in Python that gives you the time 
date of today???



   
__ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs
  

time - http://docs.python.org/lib/module-time.html
datetime - http://docs.python.org/lib/module-datetime.html

J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you convert a string obj to a file obj?

2005-05-04 Thread John Abel
Matthew Thorley wrote:

I'm writing a web app whereby a user uploads a tar acrhive which is then
opened and processed. My web form reads the file like this:

while 1:
data = value.file.read(1024 * 8) # Read blocks of 8KB at a time
if not data: break

which leaves me with data as a string obj. The problem that I have is
that the function that processes the archive expects a file object. So
far the only solution I have found it to write the file to disk and then
read it back.

Is there an easy way to convert data, in the example above into a file
object?

Thanks
-Matthew
  

fileObj = StringIO.StringIO()
fileObj.write( data )

J

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting PID for process

2005-04-29 Thread John Abel
try:
import os
myPID = os.getpid()
So you can kill it at a later date, it would be worth writing that out 
to a file somewhere - C:\temp?  I'm sure you can get a kill command for 
Win32.

HTH
J
Harlin Seritt wrote:
Let's say I have a simple script on Windows NT. I would like for that
script to find its own PID once it's started and store that as a value
within the script. Also, down the road I'd like to kill that process by
its PID. How is this done?
Thanks,
Harlin Seritt
 

--
http://mail.python.org/mailman/listinfo/python-list


Re: LD_LIBRARY_PATH - how to set?

2005-03-30 Thread John Abel
What OS?  Linux?  Solaris?
J
Roman Yakovenko wrote:
Hi. I have small problem. I need to load extension module that depends
on shared library. Before actually importing module I tried to edit
os.environ or to call directly to os.putenv without any success -
shared library was not found. I tried to search the Internet for the
answer. The only approach I saw was to set LD_LIBRARY_PATH before
invoking python script. I don't like this solution.
Roman
 

--
http://mail.python.org/mailman/listinfo/python-list


Re: Annoying Socket Problem

2005-02-19 Thread John Abel
Never mind, sorted now.
On 18 Feb 2005, at 15:10, John Abel wrote:
Read/tried that before posting.  Even with a flush, everything hangs  
until I kill the client.

Irmen de Jong wrote:
John Abel wrote:
I'm hoping this is something simple, and someone can point me in the  
right direction here.  I have a class based on SocketServer  
(ThreadingTCPServer), and I've used makefile on the socket so I use  
the for in  routine.  My client sends it a small amount of data.   
However, both programs appear to hang once the data has been sent,  
obviously something to do with flushing.

http://www.amk.ca/python/howto/sockets/ 
sockets.html#SECTION00040

--Irmen

--
*John Abel
Senior Unix Administrator*
PA News Limited
www.pa.press.net http://www.pa.press.net
E-Mail address: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Telephone Number : 01430 43
Fax Number : 0870 1240192
Mobile Number : 07971 611356
The Bishop's Manor, Market Place, Howden, DN14 7BL
PA News Limited, 292 Vauxhall Bridge Road, London SW1V 1AE. Registered  
in England No. 3891053.
--
http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list


Annoying Socket Problem

2005-02-18 Thread John Abel
I'm hoping this is something simple, and someone can point me in the 
right direction here.  I have a class based on SocketServer 
(ThreadingTCPServer), and I've used makefile on the socket so I use the 
for in  routine.  My client sends it a small amount of data.  However, 
both programs appear to hang once the data has been sent, obviously 
something to do with flushing.

I'd appreciate any pointers.
Regards
J
Server Class:
class _DBSocketHandler( SocketServer.BaseRequestHandler ):
  
   xmlStart = re.compile( XML-START )
   xmlEnd = re.compile( XML-END )
  
   def handle( self ):
   print Accepted Connection From, self.client_address
   socketIn = self.request.makefile( 'r' )
   socketOut = self.request.makefile( 'wb' )
   remoteDoc = None
   for dataIn in socketIn:
   if self.xmlEnd.match( dataIn ):
   remoteDoc.close()
   break
   if self.xmlStart.match( dataIn ):
   print Receiving XML
   remoteDoc = StringIO()
   continue
  
   if remoteDoc is not None:
   remoteDoc.write( dataIn )
  
   socketOut.write( Got Yer XML File, Thanks )

Client Code:
   def connect( self ):
   self.socketCon.connect( ( self.dbServer, self.dbPort ) )
   testFile = StringIO.StringIO( testXML )
   self.socketCon.send( XML-START )
   for xmlSQL in testFile:
   self.socketCon.send( xmlSQL )
   testFile.close()
   self.socketCon.send( XML-END )
   self.socketCon.send(  )
   time.sleep(10)
   while True:
   dataRec = self.socketCon.recv( 8192 )
   if not dataRec: break
   self.socketCon.close()
--
http://mail.python.org/mailman/listinfo/python-list


Re: Annoying Socket Problem

2005-02-18 Thread John Abel
Read/tried that before posting.  Even with a flush, everything hangs 
until I kill the client.

Irmen de Jong wrote:
John Abel wrote:
I'm hoping this is something simple, and someone can point me in the 
right direction here.  I have a class based on SocketServer 
(ThreadingTCPServer), and I've used makefile on the socket so I use 
the for in  routine.  My client sends it a small amount of data.  
However, both programs appear to hang once the data has been sent, 
obviously something to do with flushing.

http://www.amk.ca/python/howto/sockets/sockets.html#SECTION00040 

--Irmen

--
*John Abel
Senior Unix Administrator*
PA News Limited
www.pa.press.net http://www.pa.press.net
E-Mail address: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Telephone Number : 01430 43
Fax Number : 0870 1240192
Mobile Number : 07971 611356
The Bishop's Manor, Market Place, Howden, DN14 7BL
PA News Limited, 292 Vauxhall Bridge Road, London SW1V 1AE. Registered 
in England No. 3891053.
--
http://mail.python.org/mailman/listinfo/python-list


Re: FTP Server

2005-01-26 Thread John Abel
[EMAIL PROTECTED] wrote:
If you're after a simple FTP server, have a look at medusa.
   

Uhm ... Medusa does not seem actively maintained nowadays.
 M.S.
 

AFAIK, it's maintained to the extent, that if you find bugs/enhance it 
and let the medusa-dev list know, it more than likely will get fixed/added.

For what it's worth, I have a medusa-based FTP server running on Linux 
(daemon) and Win32 (service), without any problems at all.

John
--
http://mail.python.org/mailman/listinfo/python-list


Re: FTP Server

2005-01-26 Thread John Abel
If you're after a simple FTP server, have a look at medusa.
Regards
John
[EMAIL PROTECTED] wrote:
What's the simplest way to write an FTP Server in Python?
A short research on the newsgroup and on the Cookbook did not
bring out anything relevant (but I hear a little voice in the
back of my head saying Twisted, Twisted! ...)
Michele Simionato
 

--
http://mail.python.org/mailman/listinfo/python-list