Where does Python look for libraries?

2006-03-27 Thread ACB
I have been trying to get the gdmodule installed and have run into an issue.
When I import gd I get the following error.

>>> import gd
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/local/lib/python2.3/site-packages/gd.py", line 10, in ?
import _gd
ImportError: /usr/local/lib/libgd.so.2: Undefined symbol "libiconv_open"

But, when I run
nm libiconv.so
in the directory with the iconv library I get an entry like this
00011fe0 T libiconv_open

so I know the functionality is there.  So, my question.  Does python have a 
way to add search directories for locating libraries?

Thanks. 


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


Saving files from post data via sys.stdin

2006-04-10 Thread ACB
I am rewriting an existing PERL script I wrote several months ago.  It is a 
script that is used as the action for a form containing several type="file" 
inputs.  The script is run unbuffered and writes the data from sys.stdin to 
a file which is stat'ed by another script called asyncornously from 
javascript.  In the end I am able to make a progress bar for file uploads 
via http.

Anyway, I have printed sys.stdin to a file and looked at it afterward.  This 
is what is looks like
-126591649570
Content-Disposition: form-data; name="userid"

myUserid
-126591649570
Content-Disposition: form-data; name="ulimage"; filename="bc12.jpg"
Content-Type: image/jpeg

binary data of jpeg
-126591649570
Content-Disposition: form-data; name="ulimage"; filename=""
Content-Type: image/jpeg

-126591649570
Content-Disposition: form-data; name="ulimage"; filename=""
Content-Type: image/jpeg


-126591649570
Content-Disposition: form-data; name="sessionid"

mySessionid

Normally, I use cgi.FieldStorage() and access the values via calls like
form = cgi.FieldStorage()
sessionid = form["sessionid"].value

What is the best method for accessing the various variables and their 
respective values so I can save the files one at a time?  Is there some 
class that can take this input and make it easier to deal with?  I need to 
save each of the ulimage values as individual images and gain access to the 
values of sessionid and userid.

Thanks
Amy


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


Re: Saving files from post data via sys.stdin

2006-04-10 Thread ACB

> form = cgi.FieldStorage()
>
> for k in form.keys():
>   do_something_with(form, k)
>
>> Is there some class that can take this input and make it easier to deal 
>> with?
>
> A dictionary.
>
> I need to
>> save each of the ulimage values as individual images and gain access to 
>> the values of sessionid and userid.
>>


James,

Thanks for the reply, however... the problem I am having is that I need to 
use the data via sys.stdin and not the cgi.FormStorage object because cgi 
only takes the data after it has all been received.

So, I need a good way to parse the data in sys.stdin unless their is some 
built-in way to do it.

Thanks 


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


Re: Saving files from post data via sys.stdin

2006-04-11 Thread ACB

"ACB" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am rewriting an existing PERL script I wrote several months ago.  It is a 
>script that is used as the action for a form containing several type="file" 
>inputs.  The script is run unbuffered and writes the data from sys.stdin to 
>a file which is stat'ed by another script called asyncornously from 
>javascript.  In the end I am able to make a progress bar for file uploads 
>via http.
>
> Anyway, I have printed sys.stdin to a file and looked at it afterward. 
> This is what is looks like
> -126591649570
> Content-Disposition: form-data; name="userid"
>
> myUserid
> -126591649570
> Content-Disposition: form-data; name="ulimage"; filename="bc12.jpg"
> Content-Type: image/jpeg
>
> binary data of jpeg
> -126591649570
> Content-Disposition: form-data; name="ulimage"; filename=""
> Content-Type: image/jpeg
>
> -126591649570
> Content-Disposition: form-data; name="ulimage"; filename=""
> Content-Type: image/jpeg
>
>
> -126591649570
> Content-Disposition: form-data; name="sessionid"
>
> mySessionid
>
> Normally, I use cgi.FieldStorage() and access the values via calls like
> form = cgi.FieldStorage()
> sessionid = form["sessionid"].value
>
> What is the best method for accessing the various variables and their 
> respective values so I can save the files one at a time?  Is there some 
> class that can take this input and make it easier to deal with?  I need to 
> save each of the ulimage values as individual images and gain access to 
> the values of sessionid and userid.
>
> Thanks
> Amy
>
>

Any further help is appreciated.   : )


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


Re: Saving files from post data via sys.stdin

2006-04-11 Thread ACB

> Any further help is appreciated.   : )
>
>

I figured it out.  I just used
sys.stdin = file("path/to/file", "r")
and I was again able to read the data from stdin.



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