[Tutor] about import statement
Hi Friends, I'm Arun Kumar from India, Just a month ago i started learning programming .learned some basics of python. I'm really enjoying programming in python. I have some doubts in python. When we write programs,we write some import statements at the beginning of the code. how to know that we should import something. How do we know that certain classes are in particular module? Thanks Arun Kumar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] about import statement
I'm trying to program with google api i downloaded the libraries provided by the google. http://code.google.com/apis/gdata/docs/client-libraries.html In oder to write program with google api, i need to write some import statements. But i'm unable to understand the hierarchy of the modules,packages,which classes are in which package. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Importing packages
Hi, I'm trying to program with gdata (http://code.google.com/p/gdata-python-client/) using python library.I'm having problem in writing import statements. The source directory content is like this: atom(folder): this folder contains some files with the .py extension gdata (folder):this folder contains some folders and as well as some files with the .py extension. Also each of the folders contain a __init__.py file. I want to use the classes and functions of the gdata and its inner folders' classes and functions. please tell me how write the import statements -- Thank you Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Importing packages
hi, I am not understanding what you are saying. I included those modules in the sys.path. i want to know how to write the import statement for the modules and packages. I downloaded the gdata client library and extracted it. It contained a scr directory which contained two directories: 1)atom 2)gdata gdata again has some 31 directories and some .py files.These 31 directories contains files with .py extension. Where as the atom directory no further dirrectories. It contained only files with .py extension I want to write the import statementt for the files in gdata directory and also for the files in the 31 directories of the gdata. On 1/21/11, Pacific Morrowind wrote: > Hi; > > On 21/01/2011 1:10 AM, arun kumar wrote: >> Hi, >> >> I'm trying to program with gdata >> (http://code.google.com/p/gdata-python-client/) using python >> library.I'm having problem in writing import statements. >> >> The source directory content is like this: >> >> atom(folder): this folder contains some files with the .py extension >> gdata (folder):this folder contains some folders and as well as some >> files with the .py extension. Also each of the folders contain a >> __init__.py file. >> >> I want to use the classes and functions of the gdata and its inner >> folders' classes and functions. >> >> please tell me how write the import statements > Without knowing the exact names/format of those folders can't be 100% > exact but you'd want to say something along the lines of > > import gdata.example.funky > to import the module gdata/example/funky.py > or > import gdata.example2 > to import the package gdata/example2 (__init__.py) - just a quick method > to say the same thing as import gdata.example2.__init__ basically and > logically is clear that that is the base fuctions/info etc. for that > package (example2). > Pacific > _______ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Thank you Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] html files to pdf document
HI, i have a some 100 plus html individual files.I want to convert them to a single pdf document programatically. How to convert them in python. Are there any functions,modules or libraries for python to achieve this. -- Thank you Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 88, Issue 83
On Tue, Jun 21, 2011 at 12:46 PM, wrote: > Send Tutor mailing list submissions to >tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to >tutor-requ...@python.org > > You can reach the person managing the list at >tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: html files to pdf document (Timo) > 2. Re: html files to pdf document (Michiel Overtoom) > 3. Re: html files to pdf document (Walter Prins) > 4. Re: html files to pdf document (Michiel Overtoom) > 5. Socket Programming issue (aditya) > 6. Re: Socket Programming issue (Alan Gauld) > > > -- > > Message: 1 > Date: Mon, 20 Jun 2011 18:58:56 +0200 > From: Timo > To: tutor@python.org > Subject: Re: [Tutor] html files to pdf document > Message-ID: <4dff7c50.3000...@gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 20-06-11 17:34, arun kumar wrote: > > HI, i have a some 100 plus html individual files.I want to convert > > them to a single pdf document programatically. How to convert them in > > python. Are there any functions,modules or libraries for python to > > achieve this. > Just a question, but did you use Google before asking here? Because the > first hit when searching for "python html to pdf" looks like it should > do what you want. > Cheers, > Timo > > > > > -- > > Thank you > > > > Arun Kumar > > http://clicknscroll.blogspot.com > > > > > > > > > > ___ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > yes i did a Google search but did find anything useful. The xhtml2pdf is > buggy in i'm unable to install it. Also mailed the community of xhtml2pdf > but didn't receive any reply from them. > Thanks Arun Kumar > -- > > Message: 2 > Date: Mon, 20 Jun 2011 19:11:13 +0200 > From: Michiel Overtoom > To: tutor@python.org > Subject: Re: [Tutor] html files to pdf document > Message-ID: <00e86b69-6d07-46ed-b4ca-4f740509b...@xs4all.nl> > Content-Type: text/plain; charset=us-ascii > > > On Jun 20, 2011, at 18:58, Timo wrote: > > > On 20-06-11 17:34, arun kumar wrote: > >> HI, i have a some 100 plus html individual files.I want to convert them > to a single pdf document programatically. How to convert them in python. > Are there any functions,modules or libraries for python to achieve this. > > > Just a question, but did you use Google before asking here? Because the > first hit when searching for "python html to pdf" looks like it should do > what you want. > > Maybe for you, but not for the OP. Google will give different search > results depending on your location, nationality, IP address and previous > searches from that address. > > Please post the URL of the first hit you got? > > Greetings, > > -- > "Freedom: To ask nothing. To expect nothing. To depend on nothing." - Ayn > Rand > > > > -- > > Message: 3 > Date: Mon, 20 Jun 2011 23:19:52 +0100 > From: Walter Prins > To: tutor@python.org > Subject: Re: [Tutor] html files to pdf document > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Hello, > > On 20 June 2011 18:11, Michiel Overtoom wrote: > > > > > On Jun 20, 2011, at 18:58, Timo wrote: > > > > > On 20-06-11 17:34, arun kumar wrote: > > >> HI, i have a some 100 plus html individual files.I want to convert > them > > to a single pdf document programatically. How to convert them in python. > > Are there any functions,modules or libraries for python to achieve this. > > > > > Just a question, but did you use Google before asking here? Because the > > first hit when searching for "python html to pdf" looks like it should do > > what you want. > > > > Maybe for you, but not for the OP. Google will give different search > > results depending on your location, nationality, IP address and previous > > searches from that address. > > > > At the risk of belaboring the point, I think what Timo was gentlying tryin
[Tutor] splitting the large file into small pieces and download
Hi all, I want to build a small download accelerator program. I want to know how to split the file to be downloaded into small pieces and assign the each small piece to a thread for downloading. -- Thanks & Regards, Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 95, Issue 80
that works for both, > -- next part -- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20120130/a5996b2a/attachment-0001.html > > > > -- > > Message: 6 > Date: Mon, 30 Jan 2012 11:55:12 +0530 > From: Ganesh Kumar > To: tutor@python.org > Subject: [Tutor] Help Glade Tutorial. > Message-ID: > > > Content-Type: text/plain; charset="utf-8" > > Hi Guys, > > I am searching for a Glade tutorial, on how to create simple projects Glade > with python > > 1) design a simple interface in glade > 2) use the glade interface to write some really simple application with > python. > > I search in goggled i didn't get good tutorials, guide me guys How to start > with Glade. > > -Ganesh > > Did I learn something today? If not, I wasted it. > -- next part -- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20120130/fec2e0a2/attachment-0001.html > > > > -- > > Message: 7 > Date: Mon, 30 Jan 2012 00:51:58 -0600 > From: Chris Fuller > To: tutor@python.org > Subject: Re: [Tutor] Help Glade Tutorial. > Message-ID: <201201300051.58828.cfuller...@thinkingplanet.net> > Content-Type: Text/Plain; charset="utf-8" > > > Which ones did you look at, and why did you not like them? Keep in mind > that > Glade is an interface builder, and hasn't got anything much to do with the > target language, other than requiring there be a libglade library to read > the > XML files. > > I actually got started with some articles in Linux Journal, which don't > appear > high on the google search unless you include those terms. Search for > "glade > tutorial" or "glade linux journal". Leave Python or pyGTK out of your > search > for now. > > You might need a little help with using the XML files glade produces, but > that's covered in the pyGTK documentation. It's also in the Linux Journal > articles. You can google "pygtk glade" if you need more. > > Cheers > > On Monday 30 January 2012, Ganesh Kumar wrote: > > Hi Guys, > > > > I am searching for a Glade tutorial, on how to create simple projects > Glade > > with python > > > > 1) design a simple interface in glade > > 2) use the glade interface to write some really simple application with > > python. > > > > I search in goggled i didn't get good tutorials, guide me guys How to > start > > with Glade. > > > > -Ganesh > > > > Did I learn something today? If not, I wasted it. > > > > -- > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest, Vol 95, Issue 80 > * > -- Thanks & Regards, Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] I need a good resource for python Django
Hi, Can anyone suggest me a good resource for python Django. I've gone through the official website of Django but it is of limited use to me. Any help on this would be highly appreciated. Regards, Arun Kumar http://clicknscroll.blogspot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] time.mktime(time.gmtime(time tuple from any timezone)) always will be the same ?
Guys, May be a dumb question but I am a bit confused (may be coz working over 24 hours for the last couple days:)). so the question is: No matter which timezone I am in if i say time.gmtime(time.mktime(( datetime.date().timetuple( I will always get the same value. - right ? thx for answering this dumbo question but i need a break! -- Cheers, - A ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Suggestions required on Gaming
Hi All Python lovers!I want to develop a Car racing game using Python. I was looking for the libraries which I should use for the same. Some of the options are below and I want you suggestions about the best set of tools and APIs as per your experiences: - PyGame- Panda3D- Pixie for rendering- RenderMan- What else ?I will really appreciate if you guys could please let me know the right set of tools and APIs as per your experience.Thanks, - Arun ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Suggestions required on Gaming
Thanks Luke.I want to make a 3-D car race game between two players. And yes its gonna be a networked game where each user will be using his/her own PC and playing.- Arun On 10/4/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Arun Kumar PG wrote:> Hi All Python lovers!>>> I want to develop a Car racing game using Python. I was looking for> the libraries which I should use for the same. Some of the options are > below and I want you suggestions about the best set of tools and APIs> as per your experiences:>> - PyGame> - Panda3D> - Pixie for rendering> - RenderMan> - What else ? >> I will really appreciate if you guys could please let me know the> right set of tools and APIs as per your experience.Need more info.There are many types of car-racing games.Do you want it to be 3d, 2d? first-person, third-person, top-down, etc. The correct tool is the one which does the specific job best.We don't know what the job is so we can't help you choose a tool.-Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Suggestions required on Gaming
Also, my idea is to have a centralised Python server which acts as a dispachter to send the coordinate and other information to the gaming clients.On 10/4/06, Arun Kumar PG <[EMAIL PROTECTED]> wrote: Thanks Luke.I want to make a 3-D car race game between two players. And yes its gonna be a networked game where each user will be using his/her own PC and playing.- Arun On 10/4/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Arun Kumar PG wrote:> Hi All Python lovers!>>> I want to develop a Car racing game using Python. I was looking for> the libraries which I should use for the same. Some of the options are > below and I want you suggestions about the best set of tools and APIs> as per your experiences:>> - PyGame> - Panda3D> - Pixie for rendering> - RenderMan> - What else ? >> I will really appreciate if you guys could please let me know the> right set of tools and APIs as per your experience.Need more info.There are many types of car-racing games.Do you want it to be 3d, 2d? first-person, third-person, top-down, etc. The correct tool is the one which does the specific job best.We don't know what the job is so we can't help you choose a tool.-Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Suggestions required on Gaming
Thanks Luke! This is helpful :)- ArunOn 10/4/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Arun Kumar PG wrote:> Thanks Luke.>> I want to make a 3-D car race game between two players. And yes its > gonna be a networked game where each user will be using his/her own> PC and playing.If you want it to be 3d, you have a couple'o choices...Pygame with the PyopenGL interface,Panda3d,Soya, PyOgre,and perhaps others.The only one I've used was Panda3d, and I didn't get very far, so Ican't comment on that. I can say, though,I've played Disney's Toontown game, which is a 3d mmorpg made with Panda3d, so yes, it's possible to make 3d networked games in Python :) >Also, my idea is to have a centralised Python server which acts as adispachter to send the coordinate and other information to the gaming clients.For your networking, you'll probably want to use Twisted.HTH,-Luke>> - Arun>>> On 10/4/06, *Luke Paireepinart* < [EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote:>> Arun Kumar PG wrote:> > Hi All Python lovers!> > > >> > I want to develop a Car racing game using Python. I was looking for> > the libraries which I should use for the same. Some of the> options are> > below and I want you suggestions about the best set of tools and > APIs> > as per your experiences:> >> > - PyGame> > - Panda3D> > - Pixie for rendering> > - RenderMan> > - What else ? > >> > I will really appreciate if you guys could please let me know the> > right set of tools and APIs as per your experience.> Need more info.> There are many types of car-racing games. > Do you want it to be 3d, 2d? first-person, third-person, top-down,> etc.> The correct tool is the one which does the specific job best.> We don't know what the job is so we can't help you choose a tool. > -Luke>> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter and python
Hi,You can try:>> import sys>> sys.path.append('')>> import Or else you can append the path to global PYTHONPATH environment variable and whenever you will type: python on the command prompt/bash shell the script gets executed.Hope that helps.Thanks,- Arun On 10/8/06, max . <[EMAIL PROTECTED]> wrote: first off i just started looking for Tkinter tutorials but havent found muchand what i have found was not very good if anyone knows og any Tkintertutorials pleas let me knowsecond is thair anyway to change the path that python looks for a program in ex: if i enter python hello into the command line then i get this error/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python:can't open file 'hello1': [Errno 2] No such file or directory can i chage that search path?if so how?thx^_^" s33 y4_Search—Your way, your world, right now! http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG___Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter and python
> python on the command prompt/bash shell the script gets> executed.Hey Dave,Thanks for correcting me. I should read what I am writing before I hit the send button :). It was a stupid mistake.. Appending path to PYTHONPATH will allow us to import the module in some other Python script without requiring us to do sys.path.apend(). To execute the script from bash what Dave suggests is correct.Also, if you don't want to append path to PYTHONPATH you can also place the module under site-packages directory under Python home directory. Thanks,- AOn 10/8/06, Dave Kuhlman <[EMAIL PROTECTED]> wrote: On Sun, Oct 08, 2006 at 08:36:31PM +0530, Arun Kumar PG wrote:> Hi,>> You can try:>> >>import sys> >>sys.path.append('')> >>import < module.py>>> Or else you can append the path to global PYTHONPATH environment variable> and whenever you will type:>> python on the command prompt/bash shell the script gets > executed.>Not true, if I understand you correctly. PYTHONPATH affects wherePython looks for modules to be imported. But if I type thefollowing at the command line:$ python mymodule.py it is the shell (in my case bash) that looks for mymodule.py, notPython. It analogous to my typing:$ vi mymodule.pyor (trying to avoid a fight between vi and emacs fanatics):$ emacs mymodule.pyNeither vi nor emacs try to find mymodule.py; the (bash or other)shell does.So perhaps a solution to the problem is to make mymodule.pyexecutable and put it somewhere on your path. Then execute it by typing at the command line:$ mymodule.pyNow the shell will run it just like any other executable script andit will use Python as the interpreter for that script.How you make the script executable probably depends on which shell you are using. For bash, you could do the following:1. Insert the following line as the first line of your script: #!/usr/bin/env python2. Change the priveleges of the script to make it executable. Example: $ chmod u+x mymodule.py3. Put mymodule.py on your path, that is, in a directory that is in your PATH environment variable. Alternatively, add the path to the directory containing mymodule.py to your PATH environment variable.Dave--Dave Kuhlmanhttp://www.rexx.com/~dkuhlman___ Tutor maillist - Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Writing serialized objects from BaseHTTPServer
Hi Guys,I wrote a simple server using sockets ,the traditional whille True: scoket.accept() approach. This server reads some pickled parameters sent by the client using the cPickle module -> do some processing -> and finally writes a list of tuples, objects using cPickle back to the client output stream ( cPickle.dump).Now I want to replace this server with an HTTP server. Python's BaseHTTPServer basically. I was wondering when using BaseHTTPServer if I want to read/write a serialized object to meet the above behavior how could I achive this using HTTP server ? We need a content-type to specify before writing back to the client -- whats the content-type for serialised objects which I want to write back to the client using cPickle ? Thanks.Arun ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Writing serialized objects from BaseHTTPServer
any replies for the below ? On 10/19/06, Arun Kumar PG <[EMAIL PROTECTED]> wrote: Hi Guys,I wrote a simple server using sockets ,the traditional whille True: scoket.accept() approach. This server reads some pickled parameters sent by the client using the cPickle module -> do some processing -> and finally writes a list of tuples, objects using cPickle back to the client output stream ( cPickle.dump).Now I want to replace this server with an HTTP server. Python's BaseHTTPServer basically. I was wondering when using BaseHTTPServer if I want to read/write a serialized object to meet the above behavior how could I achive this using HTTP server ? We need a content-type to specify before writing back to the client -- whats the content-type for serialised objects which I want to write back to the client using cPickle ? Thanks.Arun ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Any Good book for python
"Python in a nutshell" is a good one. Also Python docs are the all time favorite. On 1/4/07, deepak shingan <[EMAIL PROTECTED]> wrote: Hi Folks, I am new in Python area and want to know Python concepts with more deatils. Please suggest some good books on python. Thanks in Advance -Deepak ** __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] threading.currentThread() always same across request ?
Guys, I have a web application and I want to store an object per request so thta that is available across all classes till end of request. I am planning to write the below code in my entry program which is executed as soon as a request comes: entry.py import threading th = threading.currentThread() th.service = somemod.Service() then in other parts of program whereever I want to use service: th = threading.currentThread() if hasattr(th, 'service'): th.service.call_whatever() I am wondering if I will ever face a problem in this case ? I want to make sure that since the request till the end the same "service" object is available and it should not collide with any other request. Since it's a web application multilple request may come simutaneously. Is this approach correct ? ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] threading.currentThread() always same across request ?
Thx guys. now quick question on the usage of thread local storage. In my case I have the below object model: class Base(object):' def __init__(self): self.__service = None def _GetService(): if not hasattr(threading.currentThread(), 'service'): threading.currentThread().service = Service() self.__service = threading.currentThread().service return self.__service class Child1(Base):' def DoSomething(): service = self._GetService() # use service class Child2(Base):' def DoSomething(): service = self._GetService() # use service The above Child classes are used by a controller: class Controller(object): def process(self): c1 = Child1() c1.DoSomething() ... c2 = Child2() c2.DoSomething() Using the above technique the "service" is instantiated only one time i.e. as soon as I create the first instance of the Child class abd associated with the current thread for future instantiation of any Child class. Now in this scenario how can I use thread local ? Where do I keep the thread local object as in my case I am instantiating the Child classes ? Using currentThread() always gives me the same thread instance for a given request and I can bypass instantiating the Service class by simply returning the "service" attribute already attached to the current thread. Any suggestion appreciated! - A On 4/15/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Andreas Kostyrka wrote: > * Kent Johnson <[EMAIL PROTECTED]> [070414 19:53]: >> That's a good point. Does anyone know when to prefer threading.local() >> vs thread attributes? > It's design question, I guess: > > *) if you have thread subclasses, then use thread attributes. > *) if you have standard threads, then use thread.local(). > > The idea is, that it's "rude" to stick attributes on an object that is > not owned by you. > > Rationale: > *) Somebody might decide to make threading.Thread be a new style > object with __slots__ => your code breaks. > > I know, it's unprobably, but if you derive a subclass, you can be at > least sure that the object will have a __dict__ ;) If you use threading.local() you can be sure the names you use don't conflict with any attributes of the thread. Kent ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor