kivy

2014-02-04 Thread bharath
i installed python 2.7 before and installed suitable kivy.. i have also 
included the .bat file in the send to option.. but my programs are not at all 
runnning and giving me error when i run it normally or with the .bat file.. it 
says that there's no module named kivy when i import it.. please help im just 
frustrated after writing a long code and seeing that it isn't working.. if 
anyone has suggestions on how to develop android 2d games with python their 
reply would be greatly appreciated. thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote:
> On 2014-02-04 19:55, bharath wrote:
> 
> > i installed python 2.7 before and installed suitable kivy.. i have
> 
> > also included the .bat file in the send to option.. but my programs
> 
> > are not at all runnning and giving me error when i run it normally or
> 
> > with the .bat file.. it says that there's no module named kivy when i
> 
> > import it.. please help im just frustrated after writing a long code
> 
> > and seeing that it isn't working.. if anyone has suggestions on how
> 
> > to develop android 2d games with python their reply would be greatly
> 
> > appreciated. thank you
> 
> >
> 
> Is kivy listed in the Python search paths (sys.path)?

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


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote:
> On 2014-02-04 19:55, bharath wrote:
> 
> > i installed python 2.7 before and installed suitable kivy.. i have
> 
> > also included the .bat file in the send to option.. but my programs
> 
> > are not at all runnning and giving me error when i run it normally or
> 
> > with the .bat file.. it says that there's no module named kivy when i
> 
> > import it.. please help im just frustrated after writing a long code
> 
> > and seeing that it isn't working.. if anyone has suggestions on how
> 
> > to develop android 2d games with python their reply would be greatly
> 
> > appreciated. thank you
> 
> >
> 
> Is kivy listed in the Python search paths (sys.path)?

yes
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 2:03:58 AM UTC+5:30, Nick Cash wrote:
> >> Is kivy listed in the Python search paths (sys.path)?
> 
> 
> 
> >yes
> 
> 
> 
> To be extra sure, you can start a python interpreter with the commandline 
> argument -vv, and when you try to import kivy (or any module) it will show 
> you every file/path it checks when trying to find it. This might help you 
> narrow down where the problem lies.
> 
> 
> 
> -Nick Cash

thanks nick that helped. i actually cant express this feeling of gratitude.. 
thank you very much.this is a wonderful group..
-- 
https://mail.python.org/mailman/listinfo/python-list


Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-22 Thread Bharath Kummar
Hello Sir/Mam,

Could you please help me with my current research ?  Am implementing the
concept in python language.
My doubts are :
1)  Is it possible to Retrieve the address of a variable in python ?
2)  Is it possible to Delete the Address of the Variable and create a new
dynamic address inside the compiler/interpreter itself ?
3)  Is it easy to find the Binary equivalence of a given Alphanumeric
String ?
4)  Is it possible to count the number of 1's in the Binary equivalence ?

Could you PLEASE provide me with the codes (codes only for the asked
queries) ?
Your reply counts a lot for me and my research !  I love to explore more in
python.

Awaiting for your Response (Please reply ASAP).

Best,
Bharath
(+91 9025338332)
-- 
https://mail.python.org/mailman/listinfo/python-list


threaded http server

2008-02-20 Thread bharath venkatesh
hi
   i want to create fast n efficient http server which serve multiple
client  concurrently .. so i thought of threading the http server  using

class HTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
  pass:

as this creates an  threaded version of  http server ... but i read in  one
of   the postings  in mailing list that it will create a deadlock . the
following postings can found at
http://mail.python.org/pipermail/python-list/2001-January/064088.html

as mentioned in that posting log_request must be redefined...  can any one
tell me how to redefine  it so that it creates a  threading behavior for   fast
n efficient http server. or will it be  ok just to pass the definition as
done in the posting mentioned above  and still create an efficient threading
behavior
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: threaded http server

2008-02-20 Thread bharath venkatesh
hi,
will this twisted,turbo gear etc help me to create a http server that can
serve multiple clients concurrently
and also the http server which i want to create in my project will not be
doing any IO (it is not like frontend  and backend ).. but it will act as a
image_proxy_server i.e when a client wants an image  it will do a http
request to my  http server if the image is present in cache it will fetch it
directly from cache  and return  it  to the  client as an http reponse
otherwise  it  fetch from  www  and  store  it cache and also return it to
the client as an http response so basically i want to serve many clients
concurrently in fast n efficient manner

On Feb 20, 2008 5:51 AM, Christian Heimes <[EMAIL PROTECTED]> wrote:

> bharath venkatesh wrote:
> > hi
> >i want to create fast n efficient http server which serve multiple
> > client  concurrently .. so i thought of threading the http server  using
>
> Threads ain't efficient for IO bound problems like a HTTP server. Most
> OSs have far better ways to deal with IO bound applications like
> select(), poll(), epoll(), kqueue() or IOCP.
>
> Use Twisted :)
>
> Christian
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: threaded http server

2008-02-20 Thread bharath venkatesh
oh .. thanks for  explaining   since this is my first ever project i
don't know much ... can u give me a basic idea of how it(image_proxy_server)
can be done efficiently .. like serving many clients concurrently

On Feb 20, 2008 9:01 AM, Christian Heimes <[EMAIL PROTECTED]> wrote:

> bharath venkatesh wrote:
> > hi,
> > will this twisted,turbo gear etc help me to create a http server that
> can
> > serve multiple clients concurrently
> > and also the http server which i want to create in my project will not
> be
> > doing any IO (it is not like frontend  and backend ).. but it will act
> as a
> > image_proxy_server i.e when a client wants an image  it will do a http
> > request to my  http server if the image is present in cache it will
> fetch it
> > directly from cache  and return  it  to the  client as an http reponse
> > otherwise  it  fetch from  www  and  store  it cache and also return it
> to
> > the client as an http response so basically i want to serve many clients
> > concurrently in fast n efficient manner
>
> You are reading data from a network socket (IO), you are serving images
> from a disk cache or memory cache (IO) or you are retrieving images from
> a remote site (IO).
>
> Your application is most certainly not using the CPU much. All you do is
> serving data or reading data - input and output - IO. :)
>
> Christian
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list

configuration and limitation of memcache..

2008-02-20 Thread bharath venkatesh
hi,
 In  my project i need to store lot n lots of images in my cache and
retrieve it very frequently.. currently i am using memcache to store and
retreive images from cache... i will be using 4 GB  ram as cache and each
image won't exceed 1 mb for sure ...and i came across  that memcache will be
assigned only certain amount of cache for caching ... so how to configure it
so that it can use the amount of cache as much as i want like 3 GB of ram
... and also i want to know whether memcache is the right way to go about my
project .. i have already implemented storing and retrieving images using
images ... it is working fine .. and i find it easy as images can be  stored
and retrieved using  a key and that is what i want ... but my project will
have many clients storing and retrieving images concurrently ... so i want
to know whether memcahe is the right way .. does it have any limitation
...if so pls suggest an alternative as i doing my project in python
suggest an alternative which can be  interfaced with python easily
-- 
http://mail.python.org/mailman/listinfo/python-list

running a daemon in python

2008-02-25 Thread bharath venkatesh
hi ..
   hi i want a program to start running as daemon in background .. my
program is server listen to a client ... so i want to make that program run
as daemon .. when i execute the program the program for ex server.py it
should automatically start running as daemon in the background even if i
close the terminal it shouldn't stop executing.. (right now if i close the
terminal the process exits) can any one tell how to do it  in python as i
have implemented the server  in python  ...
-- 
http://mail.python.org/mailman/listinfo/python-list

executing a python program by specifying only its name in terminal or command line

2008-02-26 Thread bharath venkatesh
hi,
   i wanna run a python program by specifying  only its  name ex prog with
the arguments in the terminal or command line instead of specifying python
prog in the terminal to run the program   not even specifying the it with
.py extension ..
for example i want to run the python program named prog by sepcifying
$prog -arguments
instead of
$python prog -arguments
or
$prog.py -arguments
can anyone tell me how to do it
-- 
http://mail.python.org/mailman/listinfo/python-list

macro in python

2008-02-27 Thread bharath venkatesh
hi ..
how to create macro in python for set of instruction that is done
frequently but too less in number to ignore the overhead of function call
...
-- 
http://mail.python.org/mailman/listinfo/python-list

refreshing the cache time of a key

2008-02-27 Thread bharath venkatesh
hi ..
   is it possible to refresh the cache time of a key with out having to
retrieving the cached data and storing it back in memcache .. for example if
a data is cached for
1 hour and  at the 50th minute from the time this data has been  cached i
want to   store it in the cache for  1  more  hour  ..is there a  function
to  refresh the cache time by knowing the key of data with out having to do
get and set
i.e
data=mc.get(key)
mc.set(key,data,3600) # 1 more  hour
-- 
http://mail.python.org/mailman/listinfo/python-list

http server performance

2008-03-04 Thread bharath venkatesh
hi,
   my project involves lot of  I/O  over the network.. one part of my
project involves a server(http) which is listening on the port for many
client . this sever fetches an image from the web and  and send it to
clients   and many clients will request the server concurrently .. to
implement concurrent serving to clients i used threaded http server
like this

class HTTPServer(SocketServer.ThreadingMixIn,BaseHTTPServer.HTTPServer):
 pass

class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  def do_GET(self):
 print "received connection from: ",self.client_address
 image=image_retreive()   #where image retreive is a function that
retrieves image from the web and works fine
 self.send_response(200)
 self.send_header("Content-type",format)
 self.send_header("Content-Length",len(image_data))
 self.end_headers()
 self.request.sendall(image_data)

httpd = HTTPServer(('',port_number), RequestHandler)
httpd.serve_forever()


this code worked fine but this performance was very bad ... it workes fine
if the clients requested for small n medium size images as the server sends
the response immediately and also workes fine if one client is requesting a
large image (obviously server takes time to send response  as  it takes time
to fetch the image from the web ) and other clients concurrently request for
small and medium images  these  clients will  be served immediately even if
the other client is waiting but problem crops up when 2 clients concurrently
request for an large image .. while these  two clients are waiting for the
response fromthe server . The server doesn't accept any other client request
... i can see this as i am printing the  address of the client that connects
with server   in the 1st line of get method  of the request handler if two
clients concurrently request for an large image and only two clients address
gets printed  that means only 2 clients receives connection to the server
even if  other clients  are requesting  the server at the same time and
other servers are served only after the  those 2 server releases the
connection or get the response . that means server servers only 2 clients at
a time .this is very undesirable as even if 3rd client is requesting for
very small image and 2 clients are waiting for large image .. 3rd client
won't receive the response until those 2 clients are  served . to make thing
worst my server should serve 10 to 15 clients concurrently

to solve this i did some searching and found about cherrypy and twisted also
implemented my server in cherrypy
like this

from cherrypy import wsgiserver
def image_httpserver_app(environ, start_response):
print >>sys.stdout,"received connection from: (%s : %s ) \nthe image url
is: %s " %
(environ["REMOTE_ADDR"],environ["REMOTE_PORT"],environ["QUERY_STRING"])
status = '200 OK'
response_headers = [('Content-type',format)]
 image=image_retreive()
 response_headers = [("Content-Length",`len(image_data)`)]
 start_response(status, response_headers)
 return [image_data]

mappings=[('/', image_httpserver_app)]
wsgi_apps = mappings
server = wsgiserver.CherryPyWSGIServer(('localhost', ), wsgi_apps,

server_name='localhost',numthreads=20)

if __name__ == '__main__':
  try:
  server.start()
  except KeyboardInterrupt:
  server.stop()

this didn't solve the problem at all .. same thing is happening only 2
clients is served at a time ..even if no of threads is assigned  to 20 ..
i have did lot of searching and reading .. and hoping to find a solution
..can anyone make it easier for me
i have heard of twisted deffered object .. will it solved the problem ? if
not pls suggest me alternative..
-- 
http://mail.python.org/mailman/listinfo/python-list

automatically doing some cleaning-up by the process when the systems shuts down

2008-03-18 Thread bharath venkatesh
hi ..
  my programs runs as daemon and it does some logging .. when system
shuts down .. which may be done manually . i  want my process  do some
cleaning up automatically such as writing in to the log file when  the
process terminats   before the system shuts down
 thanks
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: automatically doing some cleaning-up by the process when the systems shuts down

2008-03-19 Thread bharath venkatesh
hi ,
thanks Gabriel ... but  r u sure if it is SYSTERM ?or is it SIGTERM ? I
am not aware of any SYSTERM signal
.. if it is SYSTERM please tell me more about it .. as google search is not
helping ..

and also is there some way for my process which is running as a daemon to
know that system was not shut down properly previously eg a  power
failure .. so that my program can do necessary steps if cleaning up is not
done  during its last termination

On Wed, Mar 19, 2008 at 8:25 AM, Gabriel Genellina <[EMAIL PROTECTED]>
wrote:

> En Tue, 18 Mar 2008 09:51:03 -0300, bharath venkatesh
> <[EMAIL PROTECTED]> escribió:
>
> >   my programs runs as daemon and it does some logging .. when system
> > shuts down .. which may be done manually . i  want my process  do some
> > cleaning up automatically such as writing in to the log file when  the
> > process terminats   before the system shuts down
>
> handling the SYSTERM signal?
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: automatically doing some cleaning-up by the process when the systems shuts down

2008-03-19 Thread bharath venkatesh
handling SIGTERM allowed me to do cleaning up  while the system shuts down
but as i mentioned previously how can my  process know if the   system was
not shut down properly previously

On Wed, Mar 19, 2008 at 12:36 PM, bharath venkatesh <
[EMAIL PROTECTED]> wrote:

> hi ,
> thanks Gabriel ... but  r u sure if it is SYSTERM ?or is it SIGTERM ?
> I am not aware of any SYSTERM signal
> .. if it is SYSTERM please tell me more about it .. as google search is
> not helping ..
>
> and also is there some way for my process which is running as a daemon to
> know that system was not shut down properly previously eg a  power
> failure .. so that my program can do necessary steps if cleaning up is not
> done  during its last termination
>
> On Wed, Mar 19, 2008 at 8:25 AM, Gabriel Genellina <[EMAIL PROTECTED]>
> wrote:
>
> > En Tue, 18 Mar 2008 09:51:03 -0300, bharath venkatesh
> > <[EMAIL PROTECTED]> escribió:
> >
> > >   my programs runs as daemon and it does some logging .. when
> > system
> > > shuts down .. which may be done manually . i  want my process  do some
> > > cleaning up automatically such as writing in to the log file when  the
> > > process terminats   before the system shuts down
> >
> > handling the SYSTERM signal?
> >
> > --
> > Gabriel Genellina
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list

writing a message to the terminal in a daemon process

2008-03-23 Thread bharath venkatesh
hi,
   i created a daemon process   using the following code

import os
import sys
# Default daemon parameters.
# File mode creation mask of the daemon.
UMASK = 0
# Default working directory for the daemon.
WORKDIR = "/"
# Default maximum for the number of available file descriptors.
MAXFD = 1024
# The standard I/O file descriptors are redirected to /dev/null by default.
if (hasattr(os, "devnull")):
   REDIRECT_TO = os.devnull
else:
   REDIRECT_TO = "/dev/null"
def goDaemon():
   try:
  pid = os.fork()
   except OSError, e:
  raise Exception, "%s [%d]" % (e.strerror, e.errno)
   if (pid == 0):   # The first child.
  os.setsid()
  try:
 pid = os.fork()# Fork a second child.
  except OSError, e:
 raise Exception, "%s [%d]" % (e.strerror, e.errno)
  if (pid == 0):# The second child.
 #os.chdir(WORKDIR)
 os.umask(UMASK)
  else:
 os._exit(0)
   else:
  os._exit(0)   # Exit parent of the first child.
   import resource
   maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
   if (maxfd == resource.RLIM_INFINITY):
  maxfd = MAXFD
   for fd in range(0, maxfd):
  try:
 os.close(fd)
  except OSError:   # ERROR, fd wasn't open to begin with (ignored)
 pass
   os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)
   os.dup2(0, 1)# standard output (1)
   os.dup2(0, 2)# standard error (2)
   return(0)

it can be  seen that   the standard output and standard error are redirected
to null terminal now after the  process is made daemon  i.e  after closing
all the resources and redirecting the standard output and standard error to
null terminal now  I want to print some initial msg on the
console(terminal)  in which the program was started .
*NOTE*:I realize that initial msg can be printed before  closing  all the
resources and redirecting the standard output and standard error to null
terminal but it necessary to print the msg  after the process is made daemon
i.e when the process actually starts  doing some processing.

I tried with following code:
fd=os.open("/dev/tty",os.O_WRONLY)
os.write(fd,msg)
os.close(fd)

but this worked fine  before  closing  all the resources and redirecting the
standard output and standard error to null terminal and after doing all
these even it didn't help it didn't print any thing on the terminal

pls can anyone how this can be done
-- 
http://mail.python.org/mailman/listinfo/python-list