Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread Jaroslav Lukesh

ANd SQL database is the same type and version or not?

- Original Message - 
From: "garry saddington" <[EMAIL PROTECTED]>




On Sat, 2006-12-23 at 23:39 +0100, Jaroslav Lukesh wrote:

Does run your multiple INSERT queries at Database Adapter Test tab?


None of them run (and I have many) from the test tab as I collect 


the data from a web form using the :records structure.
Regards
Garry


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread Marco Bizzarri

I suspect it could have something to do with psycopg2. I remember
while I was checking my application (which runs using psycopg1) that I
could get a repeated segmentation fault while I run a test which used
sql_delimiter.

You could try to check on the psycopg2 ml.

Regards
Marco

On 12/24/06, garry saddington <[EMAIL PROTECTED]> wrote:

On Sun, 2006-12-24 at 16:10 +0100, Andreas Jung wrote:
> -BEGIN PGP SIGNED MESSAGE-
OK, sorry for the lack of info. What happens is that Zope stops
responding when I fire off a ZSQL method containing a 'sql_delimiter'
and then I get the standard Windows message:
python.exe has encountered a problem and needs to closeetc.
All I can say is that it has something to do with msvcr71.dll which is
in the detail of the above error message. There is no other hint in any
logs as to what is happening and when I close the above dialogue, Zope
comes back to life and the offending ZSQL has not run.
Only ZSQL methods which rely on sql_delimiter are affected. I have
repeated the error on XP pro sp2 and XP home SP2 with Zope versions
2.8,.2.9 and 2.10 using the Pythons that ship with these versions (ie
standard Windows installs). DA is psycopg2 and database is Postgresql.
Any Ideas, can I provide any further information?
Regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )




--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: Fw: [Zope] problem with the shapelib module.. help

2006-12-24 Thread Dieter Maurer
Allen Huang wrote at 2006-12-23 22:27 -0800:
>I've being trying different things for the pass day
> 
>1. I put the shapefile directly in the Extensions with the external method and 
>it work fine
>import shapelib, dbflib
>def readshp():
>shp = shapelib.ShapeFile('taiwan1.shp')

This means, that "ShapeFile" is Zope unaware and will
interpret its argument as a filepath (maybe relative to the current working
directory).

The above will work when there is a 'taiwan1.shp' file in the
directory of the so called "INSTANCE_HOME" (which is Zope's usual
current working directory).


In an "External Method" (or other trusted code), you can use
Python's file operations to write files. E.g. you can create
'taivan1.shp' as follows:

 f = open('taiwan1.shp', 'wb')
 f.write(file_content)
 f.close()

Be warned however, that Zope is a multithread application. Therefore,
it is dangerous to use fixed file names (one thread may overwrite
the file created in a different thread). You probably would want to
have the files created with functions you find in Python's "tempfile"
module.


In case the file you want to precess it a Zope "File" object "f"
(a file in the ZODB), then, you can access its data via
"str(f.data)" (and write this to a file on the file system).


In case, the file you want to precess is updated via a POST request,
it will be turned into a "ZPublisher.HTTPRequest.FileUpload" objects
which behaves like a Python file object (with some additional methods
and attributes). Especially, you can use "f.read()" to read its content.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread Dieter Maurer
garry saddington wrote at 2006-12-23 22:26 +:
>I have a Zope application that runs perfectly on Linux. However, my
>target audience is likely to use Windows so I am trying to port my app.
>to that platform.
>Whenever I use a multiple insert Zsql method that includes
>sql_delimiter, python.exe crashes.

There is no issue with "sql_delimiter" on Windows.

In fact, "sql_delimiter" is extremely harmless: it just inserts a delimiter
(usually the "\0" character) used to break the complete generated SQL 
into a sequence of SQL commands sent to the database. This happens
in "...db.DB.query". It is completely platform independent.

>eg.
>
>

You Windows database client library may not like empty SQL commands (while
the Linux library might be more resilient).

Try to suppress the first "sql_delimiter" (as it creates an empty SQL command).



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread Maciej Wisniowski
> Only ZSQL methods which rely on sql_delimiter are affected. I have
> repeated the error on XP pro sp2 and XP home SP2 with Zope versions
> 2.8,.2.9 and 2.10 using the Pythons that ship with these versions (ie
> standard Windows installs). DA is psycopg2 and database is Postgresql.
> Any Ideas, can I provide any further information?
Try to execute failing statement directly from python code (without
Zope). You should find examples on psycopg pages/docs etc.

Looks for me that this may be a psycopg problem that is not connected
with Zope.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread garry saddington
On Sun, 2006-12-24 at 16:10 +0100, Andreas Jung wrote:
> -BEGIN PGP SIGNED MESSAGE-
OK, sorry for the lack of info. What happens is that Zope stops
responding when I fire off a ZSQL method containing a 'sql_delimiter'
and then I get the standard Windows message:
python.exe has encountered a problem and needs to closeetc.
All I can say is that it has something to do with msvcr71.dll which is
in the detail of the above error message. There is no other hint in any
logs as to what is happening and when I close the above dialogue, Zope
comes back to life and the offending ZSQL has not run.
Only ZSQL methods which rely on sql_delimiter are affected. I have
repeated the error on XP pro sp2 and XP home SP2 with Zope versions
2.8,.2.9 and 2.10 using the Pythons that ship with these versions (ie
standard Windows installs). DA is psycopg2 and database is Postgresql.
Any Ideas, can I provide any further information?
Regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] processing data problem

2006-12-24 Thread Allen Huang
Hi Andreas Jung 

I'm sure you have seen my earlier post about shapefiles.

the files that i'm working with are .shp, .shx, .dbf
and I'm aware that zodb is not the place to store big files. I just need to 
translate individual entries in the data set into individual object in zodb.
I already have the tools to do it but I just don't know where to do it. Is it 
to bring the program to the user and process it on the user's computer or bring 
the data to my server and do it.

If its on the user's computer, I could save the time from transfering files, 
which could be a really problem if the file is over 500mb, let alone 1GB. but 
the user's computer might not have the libraries needed to translate the set 
data. If I where to bring the file over to my computer I have to wait for the 
file to transfers to my computer but I wouldn't have to worry about the program 
not working.

I would really like to work on the first case, since I think it is the most 
effeicient way, but I don't know how to do it (bring the program to a computer 
that probably won't have python or the required libraries). Do you know how to 
accomplish this? Could you help me?



- Original Message 
From: Andreas Jung <[EMAIL PROTECTED]>
To: Andreas Jung <[EMAIL PROTECTED]>; Allen Huang <[EMAIL PROTECTED]>; Zope 

Sent: Sunday, December 24, 2006 11:31:09 PM
Subject: Re: [Zope] processing data problem


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1




> - --On 24. Dezember 2006 07:10:21 -0800 Allen Huang <[EMAIL PROTECTED]>
> wrote:

>>
>> Anyways, since I have encounter some initial problem, I was wondering if
>> I should do this 1. have the user upload the set data or transfer the
>> set data to my computer 2. process and record the data into zodb
>> 3. delete the set data(since I really don't need a copy of it, but I
>> don't see how I could do that)
>> or is there any way that I could just process the data right on the
>> user's computer without transfer it to my computer, like bring the
>> programming to them instead of bring the set data to us since set data's
>> could be quite large (over 1GB).

In addition: what is an "online system"? Keep in mind that the ZODB
not a data bog for temporary or large files. There are possibly better 
solutions for your purpose but you did not tell us exactly what you are 
trying to do and what kind of data you have and how often you update them.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjp09CJIWIbr9KYwRAvQfAKCRnqdIrVxizT829VSJxdXwBhtpHQCgiZ0p
uw11mrYAk6y/czpZKKnr7i8=
=tI7S
-END PGP SIGNATURE-

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] processing data problem

2006-12-24 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1




> - --On 24. Dezember 2006 07:10:21 -0800 Allen Huang <[EMAIL PROTECTED]>
> wrote:

>>
>> Anyways, since I have encounter some initial problem, I was wondering if
>> I should do this 1. have the user upload the set data or transfer the
>> set data to my computer 2. process and record the data into zodb
>> 3. delete the set data(since I really don't need a copy of it, but I
>> don't see how I could do that)
>> or is there any way that I could just process the data right on the
>> user's computer without transfer it to my computer, like bring the
>> programming to them instead of bring the set data to us since set data's
>> could be quite large (over 1GB).

In addition: what is an "online system"? Keep in mind that the ZODB
not a data bog for temporary or large files. There are possibly better 
solutions for your purpose but you did not tell us exactly what you are 
trying to do and what kind of data you have and how often you update them.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjp09CJIWIbr9KYwRAvQfAKCRnqdIrVxizT829VSJxdXwBhtpHQCgiZ0p
uw11mrYAk6y/czpZKKnr7i8=
=tI7S
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] processing data problem

2006-12-24 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 24. Dezember 2006 07:10:21 -0800 Allen Huang <[EMAIL PROTECTED]> wrote:

> I'm new at data processing using zope and I could need some advice
>
> I want to make a online system that can processing a set data of three
> files and record them info zodb. I have running into some problem where I
> could process the set data if it was on my computer in the same extension
> directory as my python program but couldn't when I store the set data
> into some directory on zodb. I heard from some mail-list users telling me
> that it is not the same even though in concept it is similar but I still
> don't understand why it doesn't work even though I direct my program into
> the same directory.
>
> Anyways, since I have encounter some initial problem, I was wondering if
> I should do this 1. have the user upload the set data or transfer the
> set data to my computer 2. process and record the data into zodb
> 3. delete the set data(since I really don't need a copy of it, but I
> don't see how I could do that)
> or is there any way that I could just process the data right on the
> user's computer without transfer it to my computer, like bring the
> programming to them instead of bring the set data to us since set data's
> could be quite large (over 1GB).
>

How about using ZEO?



- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjpsLCJIWIbr9KYwRAqcMAKDZ9SqBZEEdAXRAUeU4e9LMuMNHWQCgsxFl
EWIYF9TQ5m4saDls1HmbYUE=
=X9TZ
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 24. Dezember 2006 11:55:41 + garry saddington 
<[EMAIL PROTECTED]> wrote:

>
>
> Andreas Jung
>  wrote:
>> Please read this:
>>
>> > e-postings-or-how-to-use-a-mailinglist/view>
>
> If there had been anything else to send I would have. I thought the
> question was quite clear: Is there an issue with sql_delimiter on
> windows?

When you mention a "crash" without given an explanation what "crash" means 
then it is legitimate to ask for a detailed explanation. A "crash" can mean 
all and nothing. You must be specific.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjphkCJIWIbr9KYwRAnRuAJ0e3q0m06dkdNO48T8xM11ENvrp/ACePpMg
gD1luXkHkYVuOQQyoEtaoIc=
=QsF9
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] processing data problem

2006-12-24 Thread Allen Huang
I'm new at data processing using zope and I could need some advice

I want to make a online system that can processing a set data of three files 
and record them info zodb. I have running into some problem where I could 
process the set data if it was on my computer in the same extension directory 
as my python program but couldn't when I store the set data into some directory 
on zodb. I heard from some mail-list users telling me that it is not the same 
even though in concept it is similar but I still don't understand why it 
doesn't work even though I direct my program into the same directory. 

Anyways, since I have encounter some initial problem, I was wondering if I 
should do this
1. have the user upload the set data or transfer the set data to my computer
2. process and record the data into zodb
3. delete the set data(since I really don't need a copy of it, but I don't 
see how I could do that)

or is there any way that I could just process the data right on the user's 
computer without transfer it to my computer, like bring the programming to them 
instead of bring the set data to us since set data's could be quite large (over 
1GB).

I appreciate any input... as soon as possible. Thanks

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread garry saddington


Andreas Jung
 wrote:
> Please read this:
> 
> 

If there had been anything else to send I would have. I thought the
question was quite clear: Is there an issue with sql_delimiter on
windows?
There is nothing in the error log.
There is nothing in the Event log.
There is nothing in the Z2 log.
Windows event log just says that Python.exe exited abnormally.

I was quite clear on which versions of Zope had been tested. I gave the
code which caused the crash. I have searched Google and I have searched
the mailing list. My last resort is always to ask on this list simply
because of the sort of answer you have just given.
Regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope sql_delimiter windows

2006-12-24 Thread garry saddington
On Sat, 2006-12-23 at 23:39 +0100, Jaroslav Lukesh wrote:
> Does run your multiple INSERT queries at Database Adapter Test tab?

None of them run (and I have many) from the test tab as I collect 

the data from a web form using the :records structure.
Regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: Fw: [Zope] problem with the shapelib module.. help

2006-12-24 Thread Allen Huang
Thanks a lot for replying... I still a newbie at this ... 
in order for shapelib to read shapefile, you need a set of three files(.shp, 
.shx, .dbf).

so, if I have to download this to a temp location into my computer filesystem, 
could you show me how this is done? 


- Original Message 
From: Andreas Jung <[EMAIL PROTECTED]>
To: Allen Huang <[EMAIL PROTECTED]>; Zope 
Sent: Sunday, December 24, 2006 2:47:52 PM
Subject: Re: Fw: [Zope] problem with the shapelib module.. help


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 23. Dezember 2006 22:27:29 -0800 Allen Huang <[EMAIL PROTECTED]> wrote:


>
> 2. but when I save the shapefiles (taiwan1.shp, taiwan1.shx, taiwan1.dbf)
> into zope and call it using dtml it return the same error message.
> import shapelib, dbflib
> def readshp(filename):
> shp = shapelib.ShapeFile(filename)
> return shp.info()
>
> and in zope
> 
> or
> http://localhost/pytest/taiwan1.shp')";>

No idea what shapelib is doing but reading a file from the locale 
filesystem as it seems to work from an external method is *different* from 
a accessing
content that is stored within the ZODB. I really wonder why you think it 
would work the same way? The hierarchical object storage of Zope looks 
similar to a filesystem but it is not a filesystem and the Python APIs for 
accessing filesystems don't apply. We have no idea what the ShapeFile 
constructors expects as data. If it expects a filename of a file within the 
filesystem then you must obtain the content of your data stored within the 
ZODB, create a temporary file and call the constructor as you did within
your external method. Possibly the constructor accepts the data directly
as *string*..in this case this would make things a bit easier. But it is up 
to *you* to check the Shapelib API and take appropriate action.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFjiKYCJIWIbr9KYwRAk0oAKCSyEo5ykswElgi9jFGWf89NthzmwCfRvEM
nSMyeIu/cK7NpecUlof2BR8=
=B0Mw
-END PGP SIGNATURE-

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )