pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PL/Python import _sre module error
7+ messages / 4 participants
[nested] [flat]

* PL/Python import _sre module error
@ 2003-06-16 20:34 Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 20:39 ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
  0 siblings, 1 reply; 7+ messages in thread

From: Glenn R Williams @ 2003-06-16 20:34 UTC (permalink / raw)
  To: pgsql-interfaces

Hi All,

Does anyone else have a problem with importing the re package 
I am using:

Redhat 9.0
PostgreSQL 7.3.3
Python 2.2.2.26

When I create a function:

import re
o = args[0]
b = re.match(r"^t.*",o)
if b:
   return "fits the bill"
return "failed the test"

PostgreSQL fails, and returns the error message:

exceptions.ImportError: No module named _sre

If I go into python, this is not a problem, so I suppose it is somehow
due to the restricted execution environment and/or PostgreSQL. But
that's as far as I get.

Any suggestions on how to pinpoint the problem? Surely someone else is
using re (sre), since the other modules (pcre, pre) don't handle
unicode.

TIA

Glenn

Glenn R Williams
Software for the International Community
----------------------------------------------------------------------
Mathematical theories are the part of science you could continue to do
if you woke up tomorrow and discovered the universe was gone.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
  2003-06-16 20:34 PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
@ 2003-06-16 20:39 ` Gerhard Häring <lists@ghaering.de>
  2003-06-16 22:45   ` Re: PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Gerhard Häring @ 2003-06-16 20:39 UTC (permalink / raw)
  To: pgsql-interfaces

Glenn R Williams wrote:
> Hi All,
> 
> Does anyone else have a problem with importing the re package 
> I am using:
> 
> Redhat 9.0
> PostgreSQL 7.3.3
> Python 2.2.2.26
> 
> When I create a function:
> 
> import re
> o = args[0]
> b = re.match(r"^t.*",o)
> if b:
>    return "fits the bill"
> return "failed the test"
> 
> PostgreSQL fails, and returns the error message:
> 
> exceptions.ImportError: No module named _sre
> 
> If I go into python, this is not a problem, so I suppose it is somehow
> due to the restricted execution environment and/or PostgreSQL. But
> that's as far as I get.

Correct. re is not enabled, because you can create arbitrary cpu (and 
perhaps also memory) utilization with it. Thus it's unsafe.

> Any suggestions on how to pinpoint the problem? [...]

Fork pl/python and create an unsafe version without any restrictions? 
That's what I once did just for fun. I think that'll be necessary 
anyway, because with Python >= 2.2.3, rexec and friends are disabled anyway.

-- Gerhard



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
  2003-06-16 20:34 PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 20:39 ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
@ 2003-06-16 22:45   ` Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 23:43     ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
  0 siblings, 1 reply; 7+ messages in thread

From: Glenn R Williams @ 2003-06-16 22:45 UTC (permalink / raw)
  To: pgsql-interfaces

Thanks, Gerhard.

Now that rexec and friends are disabled in Python > 2.2.3, what is the
future of PL/Python? Will it wither away? I don't know how many other
modules are impacted by the same problem, but will pursue the matter on
the Python list. Thanks for your help, though!

Best Regards,
Glenn

On Mon, 2003-06-16 at 16:39, Gerhard Häring wrote:
> Glenn R Williams wrote:
> > Hi All,
> > 
> > Does anyone else have a problem with importing the re package 
> > I am using:
> > 
> > Redhat 9.0
> > PostgreSQL 7.3.3
> > Python 2.2.2.26
> > 
> > When I create a function:
> > 
> > import re
> > o = args[0]
> > b = re.match(r"^t.*",o)
> > if b:
> >    return "fits the bill"
> > return "failed the test"
> > 
> > PostgreSQL fails, and returns the error message:
> > 
> > exceptions.ImportError: No module named _sre
> > 
> > If I go into python, this is not a problem, so I suppose it is somehow
> > due to the restricted execution environment and/or PostgreSQL. But
> > that's as far as I get.
> 
> Correct. re is not enabled, because you can create arbitrary cpu (and 
> perhaps also memory) utilization with it. Thus it's unsafe.
> 
> > Any suggestions on how to pinpoint the problem? [...]
> 
> Fork pl/python and create an unsafe version without any restrictions? 
> That's what I once did just for fun. I think that'll be necessary 
> anyway, because with Python >= 2.2.3, rexec and friends are disabled anyway.
> 
> -- Gerhard
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
-- 
Glenn R Williams
Software for the International Community
----------------------------------------------------------------------
Mathematical theories are the part of science you could continue to do
if you woke up tomorrow and discovered the universe was gone.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
  2003-06-16 20:34 PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 20:39 ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
  2003-06-16 22:45   ` Re: PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
@ 2003-06-16 23:43     ` Gerhard Häring <lists@ghaering.de>
  2003-06-17 00:12       ` Re: PL/Python import _sre module error Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Gerhard Häring @ 2003-06-16 23:43 UTC (permalink / raw)
  To: pgsql-interfaces

Glenn R Williams wrote:
> Thanks, Gerhard.
> 
> Now that rexec and friends are disabled in Python > 2.2.3, what is the
> future of PL/Python? Will it wither away? [...]

I'd like to have PL/Python as an 'unsafe' language. That's what I wanted 
it in the first place. Because I usually have full control over the 
servers I run PostgreSQL on. So a restricted environment would only 
restrict myself, which I don't like ;-)

-- Gerhard



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
  2003-06-16 20:34 PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 20:39 ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
  2003-06-16 22:45   ` Re: PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  2003-06-16 23:43     ` Re: PL/Python import _sre module error Gerhard Häring <lists@ghaering.de>
@ 2003-06-17 00:12       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2003-06-17 00:12 UTC (permalink / raw)
  To: Gerhard Häring <lists@ghaering.de>; +Cc: pgsql-interfaces

=?ISO-8859-1?Q?Gerhard_H=E4ring?= <lists@ghaering.de> writes:
> Glenn R Williams wrote:
>> Now that rexec and friends are disabled in Python > 2.2.3, what is the
>> future of PL/Python? Will it wither away? [...]

> I'd like to have PL/Python as an 'unsafe' language.

Send in a patch to make it so.  We have to do something with it, given
the loss of rexec, and none of the core developers have time for it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
@ 2003-06-18 22:36 email lists <lists@darrenmackay.com>
  2003-06-18 22:59 ` Re: PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
  0 siblings, 1 reply; 7+ messages in thread

From: email lists @ 2003-06-18 22:36 UTC (permalink / raw)
  To: pgsql-interfaces

Hi,

The PRE module can be used successfully for most regex ops, providing
that you do not need anything specific to RE (unicode, etc)

Darren



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PL/Python import _sre module error
  2003-06-18 22:36 Re: PL/Python import _sre module error email lists <lists@darrenmackay.com>
@ 2003-06-18 22:59 ` Glenn R Williams <gloonie@earthlink.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Glenn R Williams @ 2003-06-18 22:59 UTC (permalink / raw)
  To: pgsql-interfaces

Thanks Darren,

Unfortunately, I need the Unicode option, so I guess I'm out of luck for
the moment...

Glenn

On Wed, 2003-06-18 at 18:36, email lists wrote:
> Hi,
> 
> The PRE module can be used successfully for most regex ops, providing
> that you do not need anything specific to RE (unicode, etc)
> 
> Darren
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
-- 
Glenn R Williams
Software for the International Community
----------------------------------------------------------------------
Mathematical theories are the part of science you could continue to do
if you woke up tomorrow and discovered the universe was gone.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2003-06-18 22:59 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 20:34 PL/Python import _sre module error Glenn R Williams <gloonie@earthlink.net>
2003-06-16 20:39 ` Gerhard Häring <lists@ghaering.de>
2003-06-16 22:45   ` Glenn R Williams <gloonie@earthlink.net>
2003-06-16 23:43     ` Gerhard Häring <lists@ghaering.de>
2003-06-17 00:12       ` Tom Lane <tgl@sss.pgh.pa.us>
2003-06-18 22:36 Re: PL/Python import _sre module error email lists <lists@darrenmackay.com>
2003-06-18 22:59 ` Glenn R Williams <gloonie@earthlink.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox