<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>hi all</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>i m very new to python.. but i m very much interested in learnin this laguage.. i have worked only on C.. so kindly suggest from where should i start learnin.. i want to do some small projects using python.. please help me with this..<BR><BR>--- On <B>Thu, 6/11/08, Praveen Kumar <I>&lt;praveen@mahiti.org&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">From: Praveen Kumar &lt;praveen@mahiti.org&gt;<BR>Subject: [BangPypers] file save from python script<BR>To: "Python Community" &lt;bangpypers@python.org&gt;<BR>Date: Thursday, 6 November, 2008, 4:50 PM<BR><BR>
<DIV id=yiv1660907544>Dear all,<BR>I want to save the file on filebased system. i am using urllib<BR><BR>here i tried with this code<BR><BR><B>import urllib<BR><BR># fill these in<BR>user='admin'<BR>password='admin1'<BR>addfileurl='<A  href="http://localhost:8080/starinstance/bin/manage_addFile" target=_blank rel=nofollow>http://localhost:8080/starinstance/bin/manage_addFile</A>'<BR>useragent="upload.py/0.1"<BR>filename='/home/praveen/Desktop/text.jpeg'<BR>filetitle='a nice test picture'<BR><BR>class <SPAN style="COLOR: rgb(0,102,0)">MyUrlOpener</SPAN>(<SPAN style="COLOR: rgb(0,0,153)">urllib.FancyURLopener</SPAN>):<BR>&nbsp; &nbsp;def prompt_user_passwd(self, host, realm):<BR>&nbsp; &nbsp; &nbsp; &nbsp; return (user,password)<BR>&nbsp; &nbsp;def __init__(self, *args):<BR>&nbsp; &nbsp; &nbsp; self.version = useragent<BR>&nbsp; &nbsp; &nbsp; <SPAN style="COLOR: rgb(0,102,0)">urllib.FancyURLopener.__init__(self, *args)</SPAN><BR><BR>def main():<BR>&nbsp;
 &nbsp; &nbsp; &nbsp;# use authentication and set the user agent<BR>&nbsp; &nbsp; &nbsp; &nbsp;urllib._urlopener = MyUrlOpener()<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;# read the contents of filename into filebody<BR>&nbsp; &nbsp; &nbsp; &nbsp;f=open(filename)<BR>&nbsp; &nbsp; &nbsp; &nbsp;filebody=f.read()<BR>&nbsp; &nbsp; &nbsp; &nbsp;f.close<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;# urlencode the id, title and file<BR>&nbsp; &nbsp; &nbsp; &nbsp;params = urllib.urlencode({'id': filename,<BR>&nbsp; &nbsp; &nbsp; &nbsp;'title':filetitle,<BR>&nbsp; &nbsp; &nbsp; &nbsp;'file':filebody})<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;# send the file to zope<BR>&nbsp; &nbsp; &nbsp; &nbsp;f=urllib.urlopen(addfileurl, params)<BR><BR>if __name__ == '__main__':<BR>&nbsp; &nbsp;main()</B><BR><BR>when i compile this file with simple python demo.py it gives me error<BR>Traceback (most recent call last):<BR>&nbsp; File "demo.py", line 36, in ?<BR>&nbsp;&nbsp;&nbsp; main()<BR>&nbsp; File
 "demo.py", line 33, in main<BR>&nbsp;&nbsp;&nbsp; f=urllib.urlopen(addfileurl, params)<BR>&nbsp; File "/usr/lib/python2.4/urllib.py", line 84, in urlopen<BR>&nbsp;&nbsp;&nbsp; return opener.open(url, data)<BR>&nbsp; File "/usr/lib/python2.4/urllib.py", line 192, in open<BR>&nbsp;&nbsp;&nbsp; return getattr(self, name)(url, data)<BR>&nbsp; File "/usr/lib/python2.4/urllib..py", line 272, in open_http<BR>&nbsp;&nbsp;&nbsp; import httplib<BR>&nbsp; File "/usr/lib/python2.4/httplib.py", line 70, in ?<BR>&nbsp;&nbsp;&nbsp; import mimetools<BR>&nbsp; File "/usr/lib/python2.4/mimetools.py", line 6, in ?<BR>&nbsp;&nbsp;&nbsp; import tempfile<BR>&nbsp; File "/usr/lib/python2..4/tempfile.py", line 33, in ?<BR>&nbsp;&nbsp;&nbsp; from random import Random as _Random<BR>&nbsp; File "/usr/lib/python2.4/random.py", line 43, in ?<BR>&nbsp;&nbsp;&nbsp; from math import log as _log, exp as _exp, pi as _pi, e as _e<BR>ImportError: /usr/lib/python2.4/lib-dynload/math.so:
 undefined symbol: PyFPE_jbuf<BR><BR>so i compiled with this command <B style="COLOR: rgb(153,0,0)">python2.4 demo.py</B> it does not give any error<BR>but it does not give me output to when i check my directory where i am trying to save my jpeg file <B><A  href="http://localhost:8080/starinstance/bin/manage_addFile" target=_blank rel=nofollow>http://localhost:8080/starinstance/bin/manage_addFile</A> </B>there i do not find that file it means it is not able to store that file.<BR><BR>i do not know what i am trying to do..could any one please give me idea how may i store the file on file system.<BR>i created a html page<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;form name="demo" method="post" ENCTYPE="multipart/form-data" ACTION=""&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;fieldset style="width:20%"&gt;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Id:&lt;input type="text" name="title" id="title"/&gt;&lt;br&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Name:&lt;input type="text" name="name" id="name"/&gt;&lt;br&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Keywords:&lt;input type="text" name="keywords" id="keywords"/&gt;&lt;br&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="file" name="upload" id="upload"/&gt;&lt;br&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" name="submit" value="Save" id="submit"/&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/fieldset&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/form&gt;<BR>once if user select any file it should store to specific location <B><A  href="http://localhost:8080/starinstance/bin/manage_addFile" target=_blank rel=nofollow>http://localhost:8080/starinstance/bin/manage_addFile</A><BR><BR></B>Any suggestion will be appreciable<BR><BR>Thanks.<BR>-- <BR>Praveen Kumar<BR>Software Engineer<BR>Mahiti Infotech Pvt. Ltd.<BR># 33-34, Hennur Cross<BR>Hennur Main Road<BR>Bangalore, India -
 560043<BR>Mobile: &nbsp;+91 9343297314<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +91 9739854134<BR><A href="http://www.mahiti.org/" target=_blank rel=nofollow>http://www.mahiti.org</A><BR><BR></DIV><PRE>_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
</PRE></BLOCKQUOTE></td></tr></table><br>
      <!--6--><hr size=1></hr> Add more friends to your messenger and enjoy! <a href="http://in.rd.yahoo.com/tagline_messenger_6/*http://messenger.yahoo.com/invite/"> Invite them now.</a>