Re: twenty years ago Guido created Python

2010-01-01 Thread Krishnakant
On Fri, 2010-01-01 at 03:25 -0800, J Peyret wrote:
 On Dec 31 2009, 2:06 pm, Steve Howell showel...@yahoo.com wrote:
  FYI:
 
  http://twitter.com/gvanrossum
 
  Python is a truly awesome programming language.  Not only is Guido a
  genius language designer, but he is also a great project leader.  What
  an accomplishment.  Congratulations to everybody who has contributed
  to Python in the last two decades!
 
 Notwithstanding all of the above, which are all true, having met
 Guido, I say he is a genuinely nice human being.  Go BSD derivatives.

Indeed,
python is a great programming language.
May be it was not marketted as much as languages like java or not as
much as platforms like rails.
But who cares?  I must mention here that I am totally blind and the
talking software (screen reader ) I use on GNU/Linux called Orca is also
programmed using python.

And I make web applications and off late started to use pylons (  again
centered around python).
I see that python is for 2 kind of programmers.
one which are absolute beginners to programming itself who want to learn
the scientific art of programming and the second is the extreme experts
who need the power and performance nicely balanced.

Great work!

happy hfacking.
Krishnakant.


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


Re: Help in wxpython

2009-12-02 Thread Krishnakant
On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote:
 Hi
 
 I am trying to write an  PAINT like application where on the mouse
 click a circle is drawn on canvas. I am new to python and using
 wxpython to create this.
 
 here is the code:
 
 import wx
 
 class SketchWindow(wx.Window):
 
 def __init__ (self, parent,ID):
 
 wx.Window.__init__(self, parent, ID)
 
 self.panel =wx.Panel(self, size= (350,350))
 self.pen=wx.Pen( 'blue',4)
 self.pos=(0,0)
 self.InitBuffer()
 self.Bind(wx.EVT_LEFT_DOWN,self.OnLeftDown)
 
 def InitBuffer(self):
 
 size=self.GetClientSize()
 self.Buffer=wx.EmptyBitmap(size.width,size.height)
 dc=wx.BufferedDC(None,self.buffer)
 dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
 dc.Clear()
 self.Drawcircle(dc)
 self.reInitBuffer=False
 
 def OnLeftDown(self,event):
 self.pos=event.GetPositionTuple()
 self.CaptureMouse()
 
 def Drawcircle(self,dc):
 pen=wx.Pen(colour,thickness,wx.SOLID)
 dc.SetPen(pen)
 dc.DrawCircle(self.pos.x,self.pos.y,r)
 
 class SketchFrame(wx.Frame):
 def __init__(self, parent):
 
 wx.Frame.__init__(self, parent, -1, Sketch Frame,size=(800,600))
 self.sketch = SketchWindow(self, -1)
 
 if __name__=='__main__':
 app=wx.PySimpleApp()
 frame=SketchFrame(None)
 frame.Show(True)
 app.MainLoop()
 
 I am getting the following error:
 
 Traceback (most recent call last):
   File C:/Python26/circle.py, line 42, in module
 frame=SketchFrame(None)
   File C:/Python26/circle.py, line 38, in __init__
 self.sketch = SketchWindow(self, -1)
   File C:/Python26/circle.py, line 12, in __init__
 self.InitBuffer()
   File C:/Python26/circle.py, line 19, in InitBuffer
 dc=wx.BufferedDC(None,self.buffer)
 AttributeError: 'SketchWindow' object has no attribute 'buffer'
 
 Please tell me what I am doing wrong.
 
 Thanks
Madhura, Sorry to be a bit off-topic, but, I would really recommend you
to use pygtk instead of wx.
For one thing, the developers at pygtk are very active (they have their
mailing list as well ) and it comes by default with python on almost all
linux distros.  You can also easily install it on windows.

Most important, the api for pygtk is closely similar to wx.
Not to mention the quick responses you will get with pygtk related
problems.

Happy hacking.
Krishnakant.

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


Re: python and Postgresq

2009-11-23 Thread Krishnakant
On Mon, 2009-11-23 at 11:22 +0100, Diez B. Roggisch wrote:
 Andy dixon wrote:
 
  Hi,
  
  Does anyone have a link to, or can provide an example script for using
  python-pgsql (http://pypi.python.org/pypi/python-pgsql/) or if someone can
  recommend an alternative, that would be fantastic.
 
 I'd recommend psycopg2. 
 
 This is an introduction:
 
  http://www.devx.com/opensource/Article/29071
 
 But google yields tons more. And make sure you read the python db api 2.0
 spec, this should give you the general idea on how to work with Python 
 RDBMS, which is nicely abstracted away from the actual database.

Python-pgsql is a much better choice when it comes to big applications,
specially if you are going to deal with xml-rpc.  I have found that
python-pgsql handles integers and other such postgresql datatypes
better.

Happy hacking.
Krishnakant.


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


Re: Python OpenOffice Spreadsheets

2009-11-23 Thread Krishnakant
On Mon, 2009-11-23 at 11:12 +, Paul Rudin wrote:
 Gerhard Häring g...@ghaering.de writes:
 
  Is there a *simple* way to read OpenOffice spreadsheets?
 
  Bonus: write them, too?
 
  I mean something like:
 
  doc.cells[0][0] = foo
  doc.save(xyz.ods)
 
 From a quick look, pyodf offers little more than just using a XML parser
  directly.
 
 
 Depends on exactly what you mean by simple - but pyuno allows you to
 read and write openoffice spreadsheets.


Odfpy is a good module and is easy too.
http://kk.hipatia.net/public/gnukhata/gnukhata-client/ has a deb package
I built for ubuntu 9.04.
I can even provide you the distutils tarball off the list (because I
can't recall the url from I downloaded it, may be sourceforge ).
Happy hacking.
Krishnakant

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


Re: Python book

2009-09-30 Thread Krishnakant
On Wed, 2009-09-30 at 17:38 +0530, Parikshat Dubey wrote:
 Learning Python and Python in a nutshell from O'Reilly
  
 Regards
 Parikshat Dubey
 

How to think like a computer scientist in python is a good book to go
from beginner to intermediate level.
another good book is dive into python.
 
Mail me off the list if you want the soft book in compressed format.

Happy hacking.
Krishnakant.

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


Re: Business issues regarding adapting Python

2009-09-27 Thread Krishnakant
On Sun, 2009-09-27 at 00:13 -0700, Nash wrote:
 Hello everyone,
 Salam Valicum.
I am Krishnakant from Mumbai India and in our country case was exactly
the same but now pritty different in just a matter of few years.
I have answered your queries inline with your questions so read on. 
 I'm a big time python fan and it has helped me write code fast and
 push it out quickly. We have a medium sized telecom product written
 90% in Python and 10% in Java. The problem is, in the place where we
 work (Pakistan), we can't find Python developers. I asked HR to send
 me figures on how many people do we have available who have worked
 with C++, Java, PHP and Python with 2-3 years of experience. They did
 a search on available candidates on Pakistan's biggest jobsite and
 this is what they sent:
 snip
 Almost no-one shows up with Python experience when we put out a job
 opening and now it is becoming a real hurdle. Despite our liking and
 cost savings with the language, we are thinking about shifting to
 Java.

Well, As I said this was a case in India just a few years back.
But now we pritty well find programmers in languages like python or ruby
or php.  The main reason for such growth in the number of python
programmers is the awareness people like myself create amongst the
masses of new computer programmres.
Moreover the industry itself is slowly realising the time and resulting
cost saving by making use of python.


 1. Have any of you faced a similar issue? How did you resolve it?
I currently lead the development of an accounting software called
GNUKhata ( http://gnukhata.gnulinux.in ) which is totally developed in
python.
Let me tell you that none of the developers working on this project were
python programmers.
It took me about 15 days to train them till intermediate level.  The
trick here is to take good programmers who have good logical sence and
have the fundamental idea of programming in some other language.  For
example the coordinator of this project knew .net pritty well and today
she is a much better python programmer than me.
 2. Do you think it makes sense to hire good programmers and train them
 on Python?
Exactly.  Look at my anser to your question number 1.
 3. If we do train people in Python for say a month; are we just
 creating a team of mediocre programmers? Someone who has worked with
 Python for over an year is much different than someone who has worked
 with Python for only a month.
Firstly, that's true with all programming languages.  Whether you will
create good efficient programmers in python depends on how well you use
my trick of taking good programmers proficient in any other language,
and yes they should be open to learning new languages.
May I repeat, including GNUKhata, the accounting software I lead, all
the projects I worked on, we hardly had python programmres.  But we
trained them by making them do porting work and also do some bug fixing.
So the other hack is that you make the new python programmres port the
code from let's say some module in Java.  Now if you hire java
programmers and decide to train them in python for example, then this
trick works very well because they alredy know the language of the
source module and now portint it to python.

Now due to many such projects being done in huge companies in India, we
have a good repository of python programmers.
Remember that popularity of a programming language directly depends on
how much you involve the programmers.

 4. Any suggestions or idea? Related posts, articles etc would
 certainly help!
 I think you can find that your self.

 I know that going Java will probably mean a 3x increase in the number
 of people that we have and require time for Python component
 replacement with Java ones. But for Business Continuity sake,
 management doesn't mind.
 

Well, If you take my words as coming from an experienced person, I
highly recommend you to believe in what your inner feelings say about
this decision.
If you feel python will svae cost and time then just go ahead and train
programmers in python.  From your own experience you might have realised
that trainning people in python for a month will be not as bad as
trainning new programmers in java for a month.
I mean the learning curve is very very narrow in python.

Khuda Hafiz.
Krishnakant.


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


Re: Business issues regarding adapting Python

2009-09-27 Thread Krishnakant
On Sun, 2009-09-27 at 10:57 -0400, Simon Forman wrote:
 On Sun, Sep 27, 2009 at 10:48 AM, Nash nasrul...@gmail.com wrote:
  On Sep 27, 4:13 pm, Martin P. Hellwig martin.hell...@dcuktec.org
  wrote:
  Nash wrote:
 
  cut can't get enough Python Developers
  I think normal market rules will apply to Pakistan too, if your desired
  trade has not the quantity you wish, the price per item should get
  higher. Net result should be that more quantity will be available due to
  increased interest.
 
  --
  MPHhttp://blog.dcuktec.com
  'If consumed, best digested with added seasoning to own preference.'
 
  If I rephrase the question: In an absense of steady Python Developers;
  can there be a viable strategy involving training? Or will it be much
  safer going with an already common developer pool.
 
  Please note that my goal is not to promote python but to make a sound
  business decision. Using Python is not an absolute requirement.
 
  I appreciate all the feedback thus far, please keep it coming in,
  thanks everyone!
  --
  http://mail.python.org/mailman/listinfo/python-list
 
 
 Hire good programmers, they can pick up python rapidly.
 Bingo!  That's the point even I mentioned to Nash in my last email.
When I take interviews of programmres aspiring for a job, I never ask
them which programming language they know and never take them on the
basis of how good they are in comparison to that language for my
projects (in python for example ).

 It's widely acknowledged that hiring good people is a (the?) crucial
 factor in the success of programming endeavors.  Good programmers,
 almost by definition, will be able to handle learning python without
 problems.

+ the easy and power of python.
Happy hacking.
Krishnakant.


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


Re: Building / making an application

2009-08-02 Thread Krishnakant
On Sun, 2009-08-02 at 20:21 +0100, Peter Chant wrote:
 What is a good way to do this?  There are instructions on making modules at:
 
 http://docs.python.org/distutils/setupscript.html
 
 however, what do you do if you don't want a module?  I'm thinking of where
 I'd like to split the code into several files and have a build / setup
 script put it together and install it somewhere such as /usr/local/bin. 
 I'm interested in what the standard way of doing this is.
 
Have you considered creating a deb or rpm package for your application?
Most of the documentation for deb or rpm will talk about make files.
But even a distutil based python package (with a setup.py) can be made
into a deb package.
Then the your requirement will be satisfied at least for most gnu/linux
based distros.

happy hacking.
Krishnakant.



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


Re: challenging problem for changing to a dedicated non-privileged user within a script.

2009-07-23 Thread Krishnakant
On Thu, 2009-07-23 at 00:17 +0200, Piet van Oostrum wrote:
 Being a sudoer is not a privilege to issue the os.setuid system call. It
 is only a permission to use the sudo command.
 
Yes, So I would like to know if python can change the user to some other
non-privileged user during the script execution?

 K I tryed using subprocess but that did not help me either.  I tryed sudo
 K su into the Popen command but it throws me into the terminal (shell)
 K with postgres as the user.
 
 You could execute the command:
 sudo -u postgres required_command
 with subprocess.
 
Ok, but the problem is much more complex.
What if I want to do the following.
1, change the user for a particular script to the postgres user.
2. now execute the python code for connecting to the postgresql
database.
In the second point I actually want to execute python code not shell
level command so will the sudo -u in the subprocess.Popen change the
user in the script?
In short I would just like to have the script run under another user
let's say postgres as long as a certain action is going on, for example
connecting to the postgresql database.

 
 You have another problem then: your password must be supplied unless the
 NOPASSWD flag is set in the sudoers file.
 
That is clear, the only problem is that I want the script to run as
postgres user although it was started by the user kk.


happy hacking.
Krishnakant.


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


Re: challenging problem for changing to a dedicated non-privileged user within a script.

2009-07-23 Thread Krishnakant
On Thu, 2009-07-23 at 13:50 +0200, paul wrote:

 If the user running python program is allowed to call setuid() then yes.
 
NO, i don't think i can do that.  I am getting opperation not permitted.

Any ways I think probably subprocess will have to sort it out.

 Did you try running sudo -u postgres blabla with subprocess?
 
Yes, but still not got the intended result which is now obvious.
  2. now execute the python code for connecting to the postgresql
  database.
  In the second point I actually want to execute python code not shell
  level command so will the sudo -u in the subprocess.Popen change the
  user in the script?
 No, as the name subprocess suggests you are spawning a new process 
 which gets another uid through sudo. This does not affect the parent 
 process.
 
Ok then here is the work-around which I am thinking to try, Plese tell
me if it is correct.
I will let that subprocess start python inthe background and execute the
connecting code to postgresql including importing the pygresql library.
Then I will create the connection and cursor objcts in that subprocess.
But my concern is, will the connection object in the child process
(subprocess) be available to the parrent process?


happy hacking.
Krishnakant.


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


challenging problem for changing to a dedicated non-privileged user within a script.

2009-07-22 Thread Krishnakant
hello all,
This is a real challenge and I don't know if a solution even exists for
this or not.

I am writing an application which I run as my usual user on ubuntu.
the usernake is let's say kk and it has sudo permission (meaning the
user is in the sudoers list ).


now when i do python myscript.py, the script has to change to another
non-privileged user for some tasks.
let's say for example switch to the postgres user which is dedicated for
postgres and has no other privileges.

I have tryed doing os.setuid(112) where 112 could be the uid of the user
I want the script to swith over.


but I got opperation not permitted.

I tryed using subprocess but that did not help me either.  I tryed sudo
su into the Popen command but it throws me into the terminal (shell)
with postgres as the user.

But that's now my desired result.
what I exactly want is that the script now continues to execute under
postgres user till the end.

I don't know how to achieve this iffect.

Infact I will need this during a serious deployment because i would have
my application run as a demon as a dedicated user.

I am finding some code for deamonising a python application but don't
know how to tell the script to change user.

happy hacking.
Krishnakant.


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


Re: select lines in python

2009-07-15 Thread Krishnakant
On Tue, 2009-07-14 at 23:03 +0530, amr...@iisermohali.ac.in wrote:
 Dear all,
 
 Can anyone tell me that suppose i have a file having content like:
 
 _Atom_name
   _Atom_type
   _Chem_shift_value
   _Chem_shift_value_error
   _Chem_shift_ambiguity_code
  1 1   PHE   H H  8.49 0.02 1
  2 1   PHE   HAH  4.60 0.02 1
  3 1   PHE   CAC 57.83  0.3 1
  4 2   LEU   H H  8.23 0.02 1
  5 2   LEU   HAH  4.25 0.02 1
  6 2   LEU   HB2   H  1.54 0.02 1
  7 3   ASP   H H  8.10 0.02 1
  8 3   ASP   HAH  4.52 0.02 1
  9 3   ASP   HB2   H  2.65 0.02 1
 stop
 
 
 now what i want that instead of copying all the lines it will just write
 the information about PHE and ASP then how i acn do that using python
 programming.Kindly tell me the command for that.

Dear Amrita,
No one will tell you commands for your program.
We can give you logic and the way to implement it.
It is recommended that you write the code your self.
For our problem you keep a list and do a readlines() function and get
the content in your list variable.
then start looping through that list like for line in lines: where the
lines variable is your list.
Now keep comparing each line against your expected phrase and the moment
you find one, do the actions you need such as writing to a file.

happy hacking.
Krishnakant.
 

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


Re: copy a file

2009-07-14 Thread Krishnakant
On Tue, 2009-07-14 at 12:27 +0530, amr...@iisermohali.ac.in wrote:
 Dear all,
 
 Can anyone tell me that suppose i want to copy few lines from one text
 file to another then how can i do that.Looking forward for soon reply.
 

very simple.  open one file and open the source file.
seek till to the point where u want to start copying and loop till the
end with readline function.
then write it to the destination file.

To find the starting point, keep looping through the content and come
out of that loop when you find a match to the word you are looking for.
happy hacking.
Krishnakant.

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


Re: Are Python-based web frameworks reliable enough?

2009-05-25 Thread Krishnakant
On Mon, 2009-05-25 at 20:49 +0200, Gilles Ganault wrote:
 Hello
 
   Until now, the modest web apps I wrote were all in PHP because it's
 available on just about any hosted server.
 
 I now have a couple of ideas for applications where I would deploy my
 own servers, so that I'd rather write them in Python because I find
 the language more pleasant to write with.
 Certainly, You will be much much more productive if you use python provided 
 you are not going to do it the old cgi  way.

 I read that the traction for the mod_python module isn't as strong as
 mod_php, so I guess I should consider the alternative, which is
 writing a long-running process with some framework like TurboGears or
 Django.
 
Why not give a try to pylons?  While turbogears is great and very
powerful, it any ways uses most of pylons and pylons is not just rock
solid and robust, it also has very very good documentation.
Not to mention the fact that heavy production applications are today
running pylons.

 To make an informed choice, I'd like your feedback on this:
 
 1. Is mod_python a bad choice today? If yes, are there other PHP-like
 modules available, ie. the Python code is hosted in pages that are
 loaded every time a user calls them?
 Even if it was a good choice, cgi method of programming is no more suitable 
 in today's www, because the requirements of a web developer today are much 
 beyond just oepning a connection to a database and sending some processed 
 response in plain old html.
Today's web applications do much more than that so a web framework is
almost always a better choice.

   
 2. If you think I should consider long-running processes, are the
 frameworks reliable enough so that I shouldn't fear crashes every so
 often?
 
No not really, although it is always a better idea to run your
production web app behind apache.  This will keep the server up on very
heavy loads and you will not have to worry about http requests and
responses.  let that be taken care by the best tool (apache ) and let
your application handle how to manage the logic and send out views.

 3. What about performance as compared to equivalent PHP/MySQL apps?
 
Performance is very good if you use the right tool in the right place.
This is the biggest advantage of some web frameworks like pylons or tg
over other.
happy hacking.
Krishnakant.



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


Re: issue: Permissions in odfpy

2009-05-19 Thread Krishnakant
Through the python code,
chmod 400 filename.ods
happy hacking.
Krishnakant.

On Tue, 2009-05-19 at 12:21 +0530, shruti surve wrote:
 hey,
 i am using odfpy and  generating spreadsheet in open office..but
 nobody should modify the file..so can anybody tell me how can we give
 permissions (read only) to spreadsheet in odfpy??..i have change the
 properties of my normal open office spreadsheet file and made it read
 only..n also extracted it..but in conteny.xml also i am not finding
 any property which can be used in odfpy...so please give me some
 solution..
 
 
 regards
 shruti surve

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


Re: Performance java vs. python

2009-05-19 Thread Krishnakant
On Tue, 2009-05-19 at 10:42 -0700, Daniel Fetchinson wrote:
 Benchmarks always test for a given feature. The available benchmarks
 will most likely not test the feature relevant for your particular
 application simply because there are about a gazillion different ways
 of using a web framework. So the best you can do is simply test the
 bottleneck part of your application and see for yourself, snip
Bingo! there will be hundreds of threads on this mailing list and many
others which exactly do that.  And it also serves as a great food for
those bashing birds who just need a spart to start a flamewar.

Till date I have worked with both languages into their core as will as
with many libraries for different tasks.

Fortunately I have some assessment for web frameworks which is based
mostly on my personal experience and partially on some obvious facts.

At the outset, I have seen that python's syntax is pritty clean and as
some previous mail said on this thread, it needs just a few hours and
the language is compact enough to fit in your head.
Readers might ask, so how is this associated with performance boosting
etc?  
Quite a good question.  You see, the scope for making quick and suttle
changes in the code should be wide enough and easy to do as wel.

Since python has such easy and clean syntax and with the idea of
battries included , it is much more quicker and easier to tune the
application for many things including performance.

Since I feel comfortable with the language I am confident enough that my
code won't break too much when I try to do some serious alteration to
the code.  This alteration might now be to change the logic but to
improve performance.  This is the challenge and python is such a
language that manipulating to this level is pritty doable in short
period of time.

Secondly, Java it seems comes with a lot of bagage which might be the
case with python as well.  But some how I don't know, python seems to be
much light weight then java.
May be there are many technical reasons for this and at the web
application side it seems to be compact zippi and fast.  Again this
might be my personal assessment,and specially with database driven
application, no language can be absolutely better than the other and as
rightly suggested, test it on the bottleneck issues and fine tune that
particular part.  I have seen many apps migrating from ejb based
framework to python, particularly one I remember in pylons and the
feedback has been positive.
 
Another thing is that I personally like to use OOP *only* when needed.
Java would force me to write classes (add the over doing with static
functions ) for every thing I do including a small function just for
returning a connection object.

This again is a major reason for me to stick to python.

In addition python also can do the kind of work, j2ME can do and so I
don't think there is any serious reason for choosing java over python.
I am currently developing a major application and it is currently using
the twisted library for xmlrpc and there is a thin client in pygtk.
Right now we are in the process of moving it to turbogears2 and so far
performance on both the ends have been good.

happy hacking.
Krishnakant.

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


Re: How can i use Spread Sheet as Data Store

2009-05-18 Thread Krishnakant
Hi Kaliyan,
It is very simple.
There is a library called odfpy which you can use to read and write odf
documents.  I highly recommend using open formats so that the API is
clear and you can ask help if needed.
The odfpy library has modules to create spreadsheets and read or write
by row or sell etc.

happy hacking.
Krishnakant.
 
On Mon, 2009-05-18 at 16:31 +0530, Kalyan Chakravarthy wrote:
 Hi All,
  I have data in Spread Sheet ( First Name and Last Name),
 how can i see  this data  in Python code ( how can i use Spread Sheet
 as Data Store ) . 
 
 -- 
 Regards
 Kalyan
 

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


Re: Which python version do I use with virtualenv?

2009-05-07 Thread Krishnakant
I have another question in this same context.
I have python 2.6 and want to set up a vertualenv
in /opt/turbogears/python2.5.
Then use this for all the things a turbogears based application would
need for project execution.

so I have decided that I will download python 2.5 and compile it
with ./configure --prefix=/opt/turbogears/python2.5 and then install
turbogears.  Is this possible?  will this kind of python compilation
help me to create a vertualenv in the place where I have python2.5?

or is there any other way to do this?  I really need vertualenv and
would want to use python2.5 because I feel easy install won't work with
python2.6

happy hacking.
Krishnakant.




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


Re: Which python version do I use with virtualenv?

2009-05-07 Thread Krishnakant

 You are confusing virtualenv with a custom-build python. You can of course
 use VE with a custom-build python, but then there isn't as much use for it,
 as you then have a distinct python-instance already - unless you are going
 to share it amongst projects, which then leads to the question why you
 don't use VE *without* the custom-build python.
Well, Turbogears works perfectly with python2.5, although there are
people who use it with 2.6 as well.
I have to keep 2.6 because my screen reader orca giave me some problem
with 2.5.

So I have no option but to keep a seperate python2.5 in some different
directory and have ve use it.

would just like to know how I can get ve to use that installation and
not the one on my system by default.

happy hacking.
Krishnakant.
  



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


Re: problem with money datatype based calculations in python

2009-05-03 Thread Krishnakant
On Sun, 2009-05-03 at 03:20 +, D'Arcy J.M. Cain wrote:
 Sorry, I should have mentioned my bias.  :-)
 No problems at all.  It is a very good library.  I get an impression that it 
 is realy a mature module and a very powerful set of API. 

  I would like to know if it has been tested with postgresql 8.3 and are
 
 The current version of PyGreSQL has been tested with Python 2.5 and
 PostGreSQL 8.3. Older version should work as well, but you will need
 at least Python 2.3 and PostgreSQL 7.4.
 
Ah, I am using python 2.6 and postgresql 8.3

I am really impressed with the library.  I want some manual or tutorial
for the same and if possible can you write me off the list with a small
tutorial for things like connecting to the database, sending queries,
and working with the resultset at the client site.

I will be really happy if this library also supports calling a stored
procedurs directly.  Psycopg2 does not have such a feature and I had to
create one small module which does that work.

What it does is that you just give the name of the procuedure procedure
as the first parameter and a list of arguements as the second parameter.
That's all, you will get the result because the query  for the call is
created inside the module and the programmer need not worry about what
the sored procedure looks like.

Never the less I am expecting that pygresql has some infrastructure for
making calls to the stored procedures.  Please send me some tutorial off
the list.

happy hacking.
Krishnakant.


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


problem with money datatype based calculations in python

2009-05-02 Thread Krishnakant
hello all,
I am using postgresql as a database server for my db application.

The database is related to accounts and point of sales and many
calculations involve money datatype.

The application logic is totally done in python.  Now the problem is
that there is a situation where we calculate tax on % of the total
amount on the invoice.  The  percentage is in terms of float but the
eventual amount has to be in a money datatype.

The product cost comes in money datatype from postgresql and the tax %
comes in float.  So I would like to know if python supports some thing
similar to money datatype so that I can cast my total amount (in money )
divided by tax% (in float ) so money divided by float should be the
result and that result should be in money datatype.
For example a product x has the cost Rs. 100 which is stored in the
tabel as money type.  and in the tax table for that product the VAT is
5% and this 5% is stored in float datatype.  So after using both these
values the resulting total 105Rs. should be in money type and not float.
I awaite some reply,
Thanks in advice.
happy hacking.
Krishnakant.

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


interesting float to money conversion problem

2009-05-02 Thread Krishnakant
hello all,
  I am using postgresql as a database server for my db application.
  
  The database is related to accounts and point of sales and many
  calculations involve money datatype.
  
  The application logic is totally done in python.  Now the problem is
  that there is a situation where we calculate tax on % of the total
  amount on the invoice.  The  percentage is in terms of float but the
  eventual amount has to be in a money datatype.
  
  The product cost comes in money datatype from postgresql and the tax %
  comes in float.  So I would like to know if python supports some thing
  similar to money datatype so that I can cast my total amount (in money )
  divided by tax% (in float ) so money divided by float should be the
  result and that result should be in money datatype.
  For example a product x has the cost Rs. 100 which is stored in the
  tabel as money type.  and in the tax table for that product the VAT is
  5% and this 5% is stored in float datatype.  So after using both these
  values the resulting total 105Rs. should be in money type and not float.
  I awaite some reply,
  Thanks in advice.
  happy hacking.
  Krishnakant.
  
  --
  http://mail.python.org/mailman/listinfo/python-list

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


Re: problem with money datatype based calculations in python

2009-05-02 Thread Krishnakant
On Sat, 2009-05-02 at 11:57 -0400, D'Arcy J.M. Cain wrote:
 And if you use PyGreSQL (http://www.PyGreSQL.org/) to connect to
 the database then the money type is already converted to Decimal.
 d'arcy, I visited the home page for pygresql and discovered that you wrote 
 the library.
I am happy that you also included a non-dbapi (postgresql classic
interface ) along with the standard DBAPI module.

I would like to know if it has been tested with postgresql 8.3 and are
there any known bottlenecks while using this driver module on large
scale database opperations?
Is this actively maintained?
Perhaps this might be off topic but may I ask, how is pypgsql, 
  
Has any one used pgsql for any postgresql based software?
and between pygresql and pypgsql which one is more maintained?

the system I am developing is a mission critical financial application
and I must be pritty sure about any module I am using.

happy hacking.
Krishnakant.



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


Re: Connecting/talking to OpenOffice Base files

2009-04-28 Thread Krishnakant
hi,
On Tue, 2009-04-28 at 05:24 -0700, deostroll wrote:
 Hi,
 
 I was wondering if the python interpretor can talk to files with
 extension *.odb (OpenOffice Base files). They are like flat database
 files, similar to Microsoft Access files. I want to store data into
 them as well as extract data out of them.
 
This is done either  using ooolib if you want to do some simple read and
write tasks or then use odfpy which is a complete library.

I had asked the same question a few months back and come from the same
path you are coming.

But odfpy was initially difficult for me and would take a while to
understand.
It is a kind of wrapper around the xml structure of an odf document.

happy hacking.
Krishnakant.

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

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


Re: confused with so many python package locations for imports

2009-04-25 Thread Krishnakant
On Sat, 2009-04-25 at 14:16 +0900, David Cournapeau wrote:
 Some of those locations are OS specific - pyshare is specific to
 debian I think, for example.
 
My Basic question is that, what package directory is Standard as far as
all gnu/linux distros are concerned?
In other words I would like to know if there is some package   directory
which is searched by default  for installed packages?  I believed it
was /usr/local/lib/python2.6/site-packages.  
In the case of python 2.5 it must be the same, but correct me if I am
wrong.  I want my distutils setup.py to setup the package so that an
import statement can import the package no matter what distro of
gnu/linux we are running.

happy hacking.
Krishnakant.



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


Re: confused with so many python package locations for imports

2009-04-25 Thread Krishnakant
On Sat, 2009-04-25 at 18:31 +1000, Ben Finney wrote:
 Python has a habit of generating, and expecting to find,
 platform-specific files (‘foo.pyo’ extension modules), compiled bytecode
 files (‘foo.pyc’), and module source files (‘foo.py’) necessarily in the
 same directory for purpose of locating them at import time.
 
Thanks a lot for this information.
So now if I say for example choose ubuntu and debian for my testing
purpose, should I put all the packages I make
into /usr/local/lib/python2.6/site-packages?  Will this be a safe choice
for at least debian and Ubuntu?

I will later on think of fedora etc.

happy hacking.
Krishnakant.
 


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


confused with so many python package locations for imports

2009-04-24 Thread Krishnakant

hello all,
I was doing my first complete python packaging for my software and I am
totally confused.
I see, /usr/local/lib/python-2.6/site-packages and also dist-packages.
Then I also see a directory called pyshare, then again site-packages in
usr/lib/python (I am not even remembering correct paths for many such
locations ).

Now my question is, which the perfect place?  I would like to know if I
write a distutils based setup.py for my application, then which is the
place which I should choose?

happy hacking.
Krishnakant.


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


Re: Python interpreter speed

2009-04-20 Thread Krishnakant
On Mon, 2009-04-20 at 20:12 +0100, Tim Wintle wrote:

 
 I can't remember Java properly, but...
 
 Firstly, speed will depend on what you're writing. I dont' actually know
 how much slower python is, but I'm sure there are some things that run
 faster in python.
 
I know many instences which eventually show that python is faster.

Compare eclipse and glade.  I am not a hard core hacker on compiles or
interpriters but as an end-user, I see almost all java programs r pritty
heavy on memory and python is pritty fast and zippy.


I for example use a screen reader called orca, because I am totally
blind.

Guess what, the screen reader moniters every event that happens in the
OS (gnu) and also extracts all the information of every widget and keeps
track of the location of the focus and many more things and also
constantly streems output to a speech synthesizer as it take the
information from the desktop.

All this should happen at run-time without any latency.  This software
is in python and it delivers what it is supposed to at great speed.

Further, I have an accounting software which was previously in java, but
now in python and the performance gain is ausom.

Yes it depends on how we write the code but comparing the 2 at least at
the middle layer and front-end (pygtk) python is faster than java.
Infact I am most certain that swing is not even 50% as fast as pygtk or
pyqt.

These are my personal observations and should not be taken as
generalisations.

happy hacking.
Krishnakant.


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


can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
Hello all,
Right now I am a bit confused on a final stage of my project.

I need to create an installer and an executable file for my python
program for gnu/linux.

The install script has to put the package into site-packages folder
where all other libraries reside.  Then put the executable file
into /usr/bin as other files.

The installer must also do the basic task of creating the database and
setting up password for on postgresql.
now here comes the main problem.
I believe putting files into proper places is pritty easy (may be some
one will instantly reply to the issue of putting the executable file and
libraries in place ).  But to do the database based activities, I need
python-psycopg2 module for postgresql in the first place.  So is it
possible for python to self download and install all the necessary
modules on to the client machine?

What further complicates the system is the fact that I want in future to
create 2 deb files, one for installing the gtk based client application
and the other to install the server side app made in python-twisted for
rpc.  Now the obvious problem is that first my python installation
(either 2.5 or 2.4) must check for itself if the modules are present or
not and if they are not present, my install utility must either download
it from net or if that's not the recommended approach then compile the
module from the source.

how do I achieve all this in python?
I know bash could be used to do such things but I don't want to use bash
because it is to clunky and won't run easily on windows.
Moreover I want to create a deb file as I said before so I want to keep
it as simple as possible.

Even regarding the executable, I am confused on using bash as the script
for writing the executable which can then do some thing like python -c
and call the modules, or write this executable code in a main.py and put
that file into the executable path i.e /usr/bin.

Please clear this mater so that I can go ahead.

I know the python list is pritty busy and I must thank all the members
who keep the spirit of the community and the professional organisations
alive so may be I will get a solution to my problem soon.

happy hacking.
Krishnakant.


  







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


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant

sorry, but I was not replying to another thread.

My mistake.

happy hacking.
Krishnakant.



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


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
hi very sorry for that 

On Sun, 2009-04-19 at 14:50 +0200, News123 wrote:
 Hi,
 
 I think you got lost in the wrong thread.
 Though your subject line is correct your post threads under Is there a
 programming language, that . . . 
 
 Perhaps you 'replied' to above thread and changed 'just' the subject line.
 
 Chances to get an answer might be higher if you repost your question
 without replying to an existing thread.
 I did not mean to do so, may be just missed out on removing the lines of the 
 previous thread.

sorry again.
I hope this becomes a new thread now and I get some productive reply.
happy hacking.
Krishnakant.




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


Re: Python interpreter speed

2009-04-19 Thread Krishnakant
I don't mean to start a flame war, but a productive debate will be
wonderful.  I have been writing heavy applications in java for a few
years untill recent past.
My experience is that python is not just fast but also zippy and smooth
when it comes to running the applications.

Infact I have a couple of softwares which were re coded in python for
this very reason.  So I would like to know real facts on this arguement.

Let me mention that out of these 2 apps one is a distributed application
with an rpc layer and other is a normal back and front end database
driven software.  both have heavy load on them and do a lot of number
crunching and complex calculations.

happy hacking.
Krishnakant.

On Sun, 2009-04-19 at 18:11 +0200, Ryniek90 wrote:
 Hi.
 
 Standard Python interpreter's implementation is written in C language. C 
 code while compilation, is compilled into machine code (the fastest 
 code). Python code is compiled into into byte-code which is also some 
 sort of fast machine code. So why Python interpreter is slower than Java 
 VM? Being written in C and compilled into machine code, it should be as 
 fast as C/Asm code.
 What's wrong with that?
 
 Greets and thank you.
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
On Sun, 2009-04-19 at 14:55 -0300, Gabriel Genellina wrote:

 Write a setup.py script using the distutils package:
 http://docs.python.org/distutils/index.html
 
So that can distutil do the work of setting up the database and can it
find for itself if psycopg2 and other related libraries are installed?
I am going to create a deb file, so is it a good idea to some how have
the deb rules execute the setup.py file of the distutils?

Besides, I will also like to create a single file containing all the
modules i need as dependencies so even if a user does not have internet,
we can still install the package on that machine.

So will it be a good idea to let distutils do every thing I had
described about putting files in the place and having the script copyed
to /usr/bin etc?

happy hacking.
Krishnakant.
 


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


Re: need to start a new project , can python do all that ?

2009-04-15 Thread Krishnakant
On Wed, 2009-04-15 at 05:22 -0700, Deep_Feelings wrote:
 I want to start programming a new program (electronic health care
 center) in python and before start learning python i wanna make sure
 that python does have all the features i need to accomplish this
 project so i wanna ask you does python able to support these
 features :
 
Python of course fits such projects and due to the fact that it is fast
and zippi, it becomes the bes choice.
 1- cross platform (windows + linux)
Very much.
 2- mysql database access
The python-mysql module complies with the python db api and talks to
mysql.
As a side note, postgresql is a really scalable, robust and powerful
database and python has a very matured library for talking to it as
well. 
 3- 2D graphs (curves)
Possible with many libraries.
 4- support of international languages
 5- can access a scanner and input pictures from it.
 
Internationalisation is there in almost every language these days and
python is no exception.

happy hacking.
Krishnakant.


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


Re: Can someone explain about the usage of unittest.TestSuite?

2009-04-09 Thread Krishnakant

On Thu, 2009-04-09 at 12:35 +0530, srinivasan srinivas wrote:
 Hi,
 I would like to know about the unittest.TestSuite clearly like at what 
 situations i can use this TestSuite? I am not getting the clear difference 
 between this and unittest.TestCase.
 
 Thanks,
 Srini
 
Isn't that pritty simple and streight?
test suite is used when you want to combine the different test cases.


you can find more insight into this at
http://www.eecho.info/Echo/python/test-driven-development-in-python/
happy hacking.
Krishnakant
 

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


confused with creating doctest in xmlrpc server

2009-04-03 Thread Krishnakant
hello all,
I am thinking of using the doctest module for my unit testing code in
python.
I have no problems doing this in usual classes but I am a bit confused
with my twisted based rpc classes.

given that I directly take the output of running functions on a python
prompt for the dockstrings, how do I get them for my twisted class which
has a published object?

What I mean is that in normal classes I would just start the python
prompt, import the module, create the object and run the methods to get
the output.

Then I take the output and put it into a file and then use those
dockstrings for my tests.
As you all know an rpc server app can't be run like this.  To my
knowledge an rpc server is a service that listens on a port on the given
ip address.

So how do I extract the dockstrings from the functions inside my xmlrpc
class?
obviously it is not run on a python prompt, so what is the solution?

happy hacking.
Krishnakant.




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


Re: finally successful in ods with python, just one help needed.

2009-03-17 Thread Krishnakant
Hi David and John.
Thanks a lot, the problem is solved.

David, your idea was the key to solve the problem.
Actually John in his code and the explanation made it clear that the
wrong attributes were being used on wrong elements.

david's code confirmed the fact.  The center style which david had in
his code solved the problem for me because we don't need paragraph
alignment styles but the merged cells to be having center alignment for
the text contained in those cells.

This implied that the centering aught to happen in the cells when they
are created. So that style was applied to the cells in david's code.

The other mistake was that after merging 4 cells I had to actually add 3
cells to be used by the merged (spanned ) cells.  after those cells I
could start my next set of merged cells.
Initially the mistake I was doing was adding a cell which could span 4
cells and try to add another cell just after the code that created that
merged set of cells.

But later on I realised that once cells are merged we have to physically
add the blank cells to fill up the merged space else the next few cells
won't show up with the other text.

Now the code works fine and if any one would ever need this, please do
write to me.

Thanks to all again, specially David and John.

happy hacking.
Krishnakant.



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


Re: Python + PostgreSQL

2009-03-17 Thread Krishnakant
hello,

On Tue, 2009-03-17 at 09:46 -0700, Lobo wrote:
 Hi,
 
 I am new to this newsgroup (and new to Python and PostgreSQL). My
 experience (17+ years) has been with Smalltalk (e.g. VAST) and Object
 databases (e.g. Versant, OmniBase).
 
Welcome to the world of monty pythons,
/\/\/\:

 I now have a new project to develop web applications using the latest/
 best possible versions of Python (3.x?) with PostgreSQL (8.x?, with
 pgAdmin 1.10?).
 
It is still a better option to go with python 2.x latest releases IMHO.

 I hope to get some hints as of what frameworks/modules to use for this
 specific combination (Python + PostgreSQL)?, should I use django,
 zope, web2py, psycopg module, others?, what are their pros/cons?.
 
With regards the web apps, zope is the best server I ever saw in my 10
years of II.T curier.

Python-psycopg2 is the most commonly used DBAPI implementations for
postgresql.

happy hacking.
Krishnakant.


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


Re: finally successful in ods with python, just one help needed.

2009-03-14 Thread Krishnakant
On Thu, 2009-03-12 at 14:49 -0700, John Machin wrote:

 I see that you haven't had the evil spirits exorcised from your mail/
 news client ... it's hijacked a thread again :-(
 don't worry, won't happen this time.

It seams I did some thing wrong with the settings and it drops out
mails.
Now the problem is sorted out.

 
  The cell merging is happening but no text centering in those merged
  cells.
 
  If any one is interested I can send my part of code snippid.
  to just tell in short, it just has the sudo code as
  create document
 
  create a style to set centered text
 
  create table and add rows to which cells are added.
  the cell has a p (paragraph ) element with the style of centered text
  applied.
 
  cells are merged
 
  but no centering happens.
 
  Please let me know if any one wanted me to send the code off the list.
 
  Even better, if some one has a code snippid which can just do that.
 
 You might like to try:
 (a) checking that you can get text centred in an UNmerged cell
Tryed, it works perfectly.  The text gets centered in an unmerged cell.

 (b) using Calc, creating a small ods file with your desired
 formatting, then comparing the XML in that ods file with the one your
 script has created
This is the first thing I tryed and even got some insight into the xml.
However when I apply the same elements and attributes to the one I am
creating with odfpy, I get attribute not allowed  errors.
If some one is interested to look at the code, please let me know, I can
send an attachment off the list so that others are not forced to
download some thing they are not concerned about.

 (c) contacting the author/maintainer of the odfpy package

Done and awaiting the reply for last 4 days.

It was then that I came to this thread.

happy hacking.
Krishnakant.


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


Re: finally successful in ods with python, just one help needed.

2009-03-14 Thread Krishnakant

Hi David,
based on your code snippid I added a couple of lines to actually center
align text in the merged cell in first row.

Please note in the following code that I have added ParagraphProperties
in the imports and created one style with textalign=center as an
attribute.

*** code follows ***

import sys

from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableColumnProperties, ParagraphProperties
from odf.table import Table, TableRow, TableColumn, TableCell,
CoveredTableCell
from odf.text import P
class makeods:
def make_ods(self):
ods = OpenDocumentSpreadsheet()

col = Style(name='col', family='table-column')
col.addElement(TableColumnProperties(columnwidth='1in'))
tablecontents = Style(name=Table Contents, family=paragraph)

tablecontents.addElement(ParagraphProperties(textalign=center))

table = Table()
table.addElement(TableColumn(numbercolumnsrepeated=3,
stylename=col))
ods.spreadsheet.addElement(table)

# Add first row with cell spanning columns A-C
tr = TableRow()
table.addElement(tr)
tc = TableCell(numbercolumnsspanned=3)
tc.addElement(P(stylename=tablecontents, text=ABC1))
tr.addElement(tc)
# Uncomment this to more accurately match native file
##tc = CoveredTableCell(numbercolumnsrepeated=2)
##tr.addElement(tc)

# Add two more rows with non-spanning cells
for r in (2,3):
tr = TableRow()
table.addElement(tr)
for c in ('A','B','C'):
tc = TableCell()
tc.addElement(P(text='%s%d' % (c, r)))
tr.addElement(tc)

ods.save(ods-test.ods)
m = makeods()

m.make_ods()


Still the text in the cell is not centered.

happy hacking.
Krishnakant.


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


finally successful in ods with python, just one help needed.

2009-03-12 Thread Krishnakant
Hello all specially John and Terry.

I finally got my way around odfpy and could manage the spreadsheet to
some extent.

However I now have a small but unexpected problem.

I would be very happy if some one could help me understand why is the
text not getting centered in the spreadsheet I create.

The cell merging is happening but no text centering in those merged
cells.

If any one is interested I can send my part of code snippid.
to just tell in short, it just has the sudo code as 
create document

create a style to set centered text 

create table and add rows to which cells are added.
the cell has a p (paragraph ) element with the style of centered text
applied.

cells are merged 

but no centering happens.

Please let me know if any one wanted me to send the code off the list.

Even better, if some one has a code snippid which can just do that.

happy hacking.
Krishnakant.




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


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
On Mon, 2009-03-09 at 15:55 -0400, Terry Reedy wrote:
 I think you are confusing process and result.  The result is a cell that 
 spans more than one column or row *when displayed*, thus hiding the 
 cells that would otherwise be displayed. This is, I am 99.9% sure, 
 controlled by an attribute of the visually expanded cell.
 
That might be the case imho, But I tried increasing the width of the
column using python-ooolib and i could not get the effect of a merged
cells.

I am now trying odfpy and hope it will do what I want.


 In OOCalc, the process is to mark a block of cells and select Format / 
 Merge Cells.  But still, the result will be a change in the upper left 
 attribute.  Thus I suggested you make a .ods file with expanded cells 
 and then read the xml to see what cell element attribute is set thereby. 
 Any decent odf library will be able to set element attributes.
 What did you mean by the upper left attribute, are you asuming that the 
 merged cells are in the top row? In my case that's actually the case beacuse  
 because I want my python script to generate an ods file with the cells in the 
 top row merged from let's say a1 to d1.
Talking about the xml, which file should I look at to see the effect of
merging cells?




 If the about-to-be hidden cells are not empty, OOCcalc gives you the 
 option of converting all cell contents to strings and joining them into 
 one string in the expanded cell.  If you create .ods from scratch, you 
 should never need to do this.  If you edit an existing .ods, something like
' '.join(str(cell.contents for cell in merge_group))
 possibly in a function that also sets the attribute, should be easy 
 enough to write.  And, of course, you will be able to do things other 
 than the one option OOCalc gives you.
 
This is exactly what I was trying to achieve with the python-ooolib
module but could not do it.
The library did have a cet_cell_property function but did not allow for
merging.

 In other words, I do not think you *need* an existing cell-merge function.
 
But the library I use does not allow me to try the method you suggested.
Seems that I will have to look at the xml and write my own module.

  Do you know how I can work around this?
 
 See above.
 
  I tryed searching for py2odf but did ont find any results.
 
 Whoops. odfpy at
 http://opendocumentfellowship.com/development/projects/odfpy
 
 but I strongly suspect you can do what you want with python-ooolib.
 
No buddy, I tryed with ooolib but now given up unless some one points
out what I am missing.
happy hacking.
Krishnakant.



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


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
On Tue, 2009-03-10 at 00:27 -0400, Terry Reedy wrote:

 In any case, api-for-odfpy.odt has
 
I am going through the documentation for odfpy but finding it pritty
complex right now.
 5.17.12 table.CoveredTableCell
 Requires the following attributes: No attribute is required.
 Allows the following attributes: booleanvalue, contentvalidationname, 
 currency, datevalue, formula, numbercolumnsrepeated, protect, 
 stringvalue, stylename, timevalue, value, valuetype.
 These elements contain table.CoveredTableCell: table.TableRow.
 The following elements occur in table.CoveredTableCell: dr3d.Scene, 
 draw.A, draw.Caption, ...
 
So merged cells are refered to as covered cells is it?
 so odfpy, at least, can create such elements.
 
Do you have any code sample done in odfpy which I can browse throu and
run it to see the results.

  
  Here's an example of 2 merged ranges: A1:C2 contains the text foo
  and D1:D2 contains bar
  
  table:table-row table:style-name=ro1
  - table:table-cell table:style-name=ce1 office:value-type=string
  table:number-columns-spanned=3 table:number-rows-spanned=2
text:pfoo/text:p
/table:table-cell
table:covered-table-cell table:number-columns-repeated=2 /
  - table:table-cell table:style-name=ce1 office:value-type=string
  table:number-columns-spanned=1 table:number-rows-spanned=2
text:pbar/text:p
/table:table-cell
/table:table-row
  - table:table-row table:style-name=ro1
table:covered-table-cell table:number-columns-repeated=4 /
/table:table-row
  
  Aside: If you are wondering where the cell addresses (D1 etc) are,
  they're in the reader's current_row and current_col variables :-)
  Perhaps this was intended to save space, but what of table:number-
  columns-repeated=4 ??
 

I guess I got the point, but still can't figure out how I could actually
implement this because I find the documentation of odfpy pritty complex
and does not have the kind of example which shows what you explained in
the above code.

And the problem is that I got a bit confused in the above code because
my merging happens only in the top row and spanns columns not rows.

I would be very happy if I could get the code wich creates a set of
merged cells in a single row with some data in it.

I managed to do the odt part in the odfpy because the examples were
there and well documented.

happy hacking.
Krishnakant.
 

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


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant

  any ways thanks for your reply,
  Right now I am stuck very badly.
 
  The problem is that I am trying python-ooolib and did find the library
  pritty good.
 
 There's another one called ooolib-python; have you had a look at that?
 
Can you provide the url?  Actually I think I saw this library but it
seems it is not well maintained and the author is no more active.

I think it is supporting old formats if I am talking about the same
library.  So please send me the link so that I confirm my doubts.

  But the problem is that library is missing a major feature from my
  requirement context.
  I need to merge cells in a spreadsheet and this library won't do that.
 
  Do you know how I can work around this?
 
 Here's a radical suggestion: Ask the author directly, or pop a note in
 the suggestion box on the sourceforge tracker [hint: don't use your
 mail client for this].
 
I did send him a message but did not get any reply for the email.

I will put this request on sourceforge.net as per your suggestion any
how.

 
  I tryed searching for py2odf but did ont find any results.
 
  Do you want me to continue on the previous thread (I will try and dig
  that out ).
 
 Nah, just hijack a third thread :-)
 
Thanks for that suggestion, I am not that multi threaded *smile*.
I have fixt my mail problem now so every things seems to be fine (untill
i hyjak another thread by accident LOL!).

happy hacking.
Krishnakant.


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


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
Hi John,

I tryed this same library to begin with.

python-ooolib is very good except that it misses a major feature of cell
merging (spanning ).

That is the point from which I started the thread.
I even thought the author of that library will respond back but did not
happen.

Seams it is a very old library and no development happens on it.

happy hacking.
Krishnakant.


On Tue, 2009-03-10 at 23:44 +1100, John Machin wrote:
 On 10/03/2009 10:35 PM, Krishnakant wrote:
  any ways thanks for your reply,
  Right now I am stuck very badly.
 
  The problem is that I am trying python-ooolib and did find the library
  pritty good.
  There's another one called ooolib-python; have you had a look at that?
 
  Can you provide the url?  Actually I think I saw this library but it
  seems it is not well maintained and the author is no more active.
  
  I think it is supporting old formats if I am talking about the same
  library.  So please send me the link so that I confirm my doubts.
 
 http://ooolib.sourceforge.net/ calls it ooolib-python, but in 
 topsy-turvy land 
 (http://packages.debian.org/unstable/python/python-ooolib) it's called 
 python-ooolib but all you need in the end is import ooolib.
 
 Three are one and one is three :-)
 
 

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


Re: last and final attempt to search for python ods library.

2009-03-09 Thread Krishnakant
Hi Terry,

Well, You did reply i know, but seems i lost that mail some where,
My mail client must have messed up the mail.

any ways thanks for your reply,
Right now I am stuck very badly.

The problem is that I am trying python-ooolib and did find the library
pritty good.
But the problem is that library is missing a major feature from my
requirement context.
I need to merge cells in a spreadsheet and this library won't do that.

Do you know how I can work around this?

I tryed searching for py2odf but did ont find any results.

Do you want me to continue on the previous thread (I will try and dig
that out ).


happy hacking.
Krishnakant.

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


last and final attempt to search for python ods library.

2009-03-08 Thread Krishnakant
hello all,  Sorry for the frustrated mail.

This is my last attempt to search for a nice python library for creating
open document spreadsheet.

I tryed python-ooolib but did not find a few features like merging cells
(may be I am missing out some thing stupid ).

I have asked for some help before on this topic but seems there is no
such library in python.

Pritty strange that python can't do this much.

So please tell me if any one knows of a good solution for my problem
else I am forced to give up python for my task.

happy hacking/
Krishnakant.



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


searching for an easy library to create OpenOffice spreadsheets

2009-03-06 Thread Krishnakant
Hello all,
I am looking out for a python library which does the followingg.
1, create and manipulate openoffice spreadsheets.
2, allow for cell formatting including merging cells.
3, allow for colouring cells and formatting data as bold italics etc.
4, alignment of data should be possible.
I looked at ooolib but did not find a method for merging cells.

any ideas?

happy hacking.
Krishnakant.
 

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


Re: Python interface to ODF documents?

2009-02-15 Thread Krishnakant
hello
look at python-ooolib
it can do what ever is needed and more.
happy hacking.
Krishnakant.
 
On Sun, 2009-02-15 at 21:10 +0100, Tino Wildenhain wrote:
 Hi,
 
 Dotan Cohen wrote:
  Is there a Python interface to ODF documents? I'm thinking of
  something that will import, for example, an ADS spreadsheet into a
  multidimensional array (including formulas and formatting) and let me
  manipulate it, then save it back.
 
 Yes, you have zipfile and a host of xml parsers included in the
 standard lib. This works very well to my experience.
 
 Not sure if an abstraction layer on top of that exists.
 
 Regards
 Tino
 
 
 --
 http://mail.python.org/mailman/listinfo/python-list

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


need help from some one who uses python-ooolib

2009-02-12 Thread Krishnakant
hello all,
Has any one used python-ooolib to create open office spreadsheets?
I want to know the method of merging cells using the library's calc
class.
happy hacking.
Krishnakant.


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


confused about publishing more than one class in twisted server.

2009-01-16 Thread Krishnakant
hello,
I am writing a twisted based rpc service where I am implementing a
complete application as a service.
I have many modules which make a package.  Now when we publish a service
in twisted, we have to create one instance of a certain class and then
publish it with the help of reactor.
but in my application, there are more than one class in different .py
files.  Now I want to know how do i create a package where all the
classes in different modules get published so that the entire package
can be used as the rpc server application and the client can be used to
query any module.

for example I have classes to get and set vendor, product, bills etc.
now all this has to be   accessed through the xml rpc service.
Can some one tell me how to manage the entire twisted package as a
service.
happy hacking.
Krishnakant.


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


Re: initialising a class by name

2009-01-14 Thread Krishnakant
Hi, 
So should I not use getattr()?
If I have one class in one module, then should I use global?
I found getattr() very easy to use, my only dowbt is that if there is
going to be one class per module then will it be a good idea?
some thing like module, class_name 
happy hacking.
Krishnakantt.
On Tue, 2009-01-13 at 23:55 -0800, Chris Rebert wrote:

 On Tue, Jan 13, 2009 at 11:49 PM, Krishnakant krm...@gmail.com wrote:
  On Tue, 2009-01-13 at 21:51 -0800, Chris Rebert wrote:
  Assuming all the classes are in the same module as the main program:
 
  instance = vars()[class_name](args, to, init)
 
  The classes are not in the same module.
  Every glade window is coupled with one py file (module) containing one
  class that has the events for the glade file.
  Inshort, there is one class in one module and they are all seperate.
  Assuming the classes are all in the same module mod, which is
  separate from the main program:
 
  instance = getattr(mod, class_name)(args, to, init)
 
  Can you explain the difference between getattr and var()?
 
 getattr(x, 'y') == x.y
 
 vars() gives a dict representing the current accessible variable
 bindings (I should have instead recommended the related globals()
 function)
 globals() gives a dict representing the global variable bindings
 For example:
 #foo.py
 class Foo(object):
 #code here
 
 Foo()
 #same as
 globals()['Foo']()
 #end of file
 
 Cheers,
 Chris
 

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


Re: initialising a class by name

2009-01-14 Thread Krishnakant

Hi steevan,
I liked this idea of dispatchTable.
is it possible to say some thing like 
inst = dispatchTable{ham}
according to me, inst will become the instance of class ham.
Another thing to note is that all the classes are in different modules.
So where do I create the dict of classes mapped with the name?
happy hacking.
Krishnakant. 
On Wed, 2009-01-14 at 07:50 +, Steven D'Aprano wrote:
 On Wed, 14 Jan 2009 11:16:58 +0530, Krishnakant wrote:
 
  hello all,
  I have a strange situation where I have to load initiate an instance of
  a class at run-time with the name given by the user from a dropdown
  list.
 
 Not strange at all.
 
  Is this possible in python and how?
 
 Of course. Just use a dispatch table. Use a dict to map user strings to 
 classes:
 
 
  class Spam(object): pass
 ...
  class Ham(object): pass
 ...
  dispatch_table = {Spam: Spam, Ham: Ham}
  dispatch_table[Ham]()
 __main__.Ham object at 0xb7ea2f8c
 
 
 The keys don't even have to be the name of the class, they can be 
 whatever input your users can give:
 
  dispatch_table[Yummy meat-like product] = Spam
  dispatch_table[Yummy meat-like product]()
 __main__.Spam object at 0xb7ea2f6c
 
 
 You can even automate it:
 
  dispatch_table = {}
  for name in dir():
 ... obj = globals()[name]
 ... if type(obj) == type:
 ... dispatch_table[name] = obj
 ...
  dispatch_table
 {'Ham': class '__main__.Ham', 'Spam': class '__main__.Spam'}
 
 
 

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


Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 00:20 -0800, Chris Rebert wrote:
 Aside from Steven's excellent idea, to use the getattr() technique
 with your module scheme you'd probably also need to use __import__()
 to dynamically import the right module.
 
I would generally import all the modules I would need at the top of the
main module.
then would use getattr(module,class_name) will that work?
or do I need to import in some other way?
happy hacking.
Krishnakant.

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


Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 04:09 -0500, Steve Holden wrote:
  
 You don't need to have the names of the classes related to anything in
 the interface. Just use a list of classes, and have the user interface
 return the correct index for each class. Then (supposing the selection
 by the user is seln) use
 
   Books = classes[seln]()
 
 If the classes are all in different modules, import them before creating
 the list of classes.
 
Is there a way to get the list of all the classes in the package?
I mean is there a way to build a list of modules  from some global
variable which can be accessed and then looped through.
happy hacking.
Krishnakant.

 regards
  Steve

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


Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 00:39 -0800, Chris Rebert wrote:
 On Wed, Jan 14, 2009 at 12:36 AM, Krishnakant krm...@gmail.com wrote:
  On Wed, 2009-01-14 at 00:20 -0800, Chris Rebert wrote:
  Aside from Steven's excellent idea, to use the getattr() technique
  with your module scheme you'd probably also need to use __import__()
  to dynamically import the right module.
 
  I would generally import all the modules I would need at the top of the
  main module.
  then would use getattr(module,class_name) will that work?
 
 Yes, that is how you'd do it in that case.
 
By the way, is there a kind of global list of modules/classes which are
maintained in a package once the program is loaded into memory?
happy hacking.
Krishnakant.

 Cheers,
 Chris
 --
 Follow the path of the Iguana...
 http://rebertia.com

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


initialising a class by name

2009-01-13 Thread Krishnakant
hello all,
I have a strange situation where I have to load initiate an instance of
a class at run-time with the name given by the user from a dropdown
list.
Is this possible in python and how?
To make things clear, let me give the real example.
there is an inventory management system and products belong to different
categories.
There are predefined categories in the database and for each category
there is a module which contains a class made out of pygtk.
This means what class gets instantiated and displayed in the gui depends
on the choice a user makes in the dropdown.
Now, I could have created a list of if conditions for all the categories
as in 
if categorySelection == books:
Books = BookForm()

However this is a problem because when there will be more than 100
categories there will be that many if conditions and this will make the
code uggly.
so my idea is to name the class exactly after the name of the category
so that when the user selects a category that name is used to initialise
the instance of that class.
So is it possible to initialise an instance of a class given its name
from a variable?
thanks and 
Happy hacking.
Krishnakant. 

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


Re: initialising a class by name

2009-01-13 Thread Krishnakant
On Tue, 2009-01-13 at 21:51 -0800, Chris Rebert wrote:
 Assuming all the classes are in the same module as the main program:
 
 instance = vars()[class_name](args, to, init)
 
The classes are not in the same module.
Every glade window is coupled with one py file (module) containing one
class that has the events for the glade file.
Inshort, there is one class in one module and they are all seperate.
 Assuming the classes are all in the same module mod, which is
 separate from the main program:
 
 instance = getattr(mod, class_name)(args, to, init)
 
Can you explain the difference between getattr and var()?

 Cheers,
 Chris
 
happy hacking.
Krishnakant.

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


Re: Python's popularity

2008-12-22 Thread Krishnakant
hello hackers.
Python is best at high level calculations and as an indication, Please
note that I am leading a team on developing an accounting software which
will be modular and would suit the economic conditions of developed and
almost developed countries like India.
I find that number crunching and heavy calculations is shear programming
bliss in python.
At the front end we are using pygtk and find it very light and zippy.
And we are going to use twisted for middle layer and reportlab for
reporting.
And the development so far is pritty smooth and our programmres who
learned python for the first time are just amaised about the fact that
how easily python can do a certain thing.
So i don't know what others think but python is not just a good
scripting language (not that being a good scripting language is some
thing bad ) but also a complete enterprise ready language with given
frameworks like twisted.
happy hacking.
Krishnakant.
On Mon, 2008-12-22 at 12:59 -0500, Tommy Grav wrote:
 On Dec 22, 2008, at 12:48 PM, walterbyrd wrote:
  Now since Python *is not* the only language on it's block, we have to
  compete with our main nemesis(Ruby) for survival
 
  I think both python and ruby will survive. I think python is also
  competing with perl in the sysadmin space - although I see perl as
  being much more popular there.
 
 Python is making great headway in the physical sciences. Especially
 in astronomy Python has become a real player as not only a tool for
 quick and dirty calculations, but more serious number crunching using
 the great numpy and scipy libraries. With Cython, I, think it will  
 even start
 taking over some of the speed critical niche from C and Fortran.
 
 Cheers
Tommy
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Python is slow

2008-12-21 Thread Krishnakant
With my current experience with java, python and perl, I can only
suggest one thing to who ever feels that python or any language is slow.
By the way there is only one language with is fastest and that is
assembly.
And with regards to python, I am writing pritty heavy duty applications
right now.
Just to mention I am totally blind and I use a screen reader called orca
on the gnome desktop.  I hope readers here can understand that a screen
reader has to do a lot of real-time information processing and respond
with lightenning speed.
And Orca the scree reader is coded totally in python.
So that is one example.
So conclusion is is how you enhance your program by utilising the best
aspects of python.
happy hacking.
Krishnakant.
On Sun, 2008-12-21 at 16:33 +, MRAB wrote:
 Marc 'BlackJack' Rintsch wrote:
  On Sat, 20 Dec 2008 14:18:40 -0800, cm_gui wrote:
  
  Seriously cm_gui, you're a fool.
  Python is not slow.
  haha, getting hostile?
  python fans sure are a nasty crowd.
 
  Python is SLOW.
 
  when i have the time, i will elaborate on this.
  
  You are not fast enough to elaborate on Python's slowness!?  :-)
  
  cm_gui is slow!
  
  Ciao,
  Marc 'BlackJack' Rintsch
  
 Correction:
 
 cm_gui is SLOW! :-)
 --
 http://mail.python.org/mailman/listinfo/python-list

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


%s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread Krishnakant
hello all hackers.
This is some kind of an interesting situation although many of you must
have already gone through it.
I am facing a situation where I have to use psycopg2 and insert rows in
a postgresql table.
That's pritty easy and no need to say that it works well.  But there are
some entries which have an ' in the value.
I have a venders table in my database and one of the values tryed was
His Master's Voice  
now the master's word has the ' which is used for starting and ending a
varchar value for postgresql or almost any standard RDBMS.
Does any one know what is the way out of this?
how do you let the ' go as a part of the string?
I have used %s as placeholder as in 
queryString = insert into venders values ('%s,%s,%s %
(field1,field2,field3 ) ...
This is not working for the ' values.
can any one suggest a suitable solution?
happy hacking.
Krishnakant.

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


Re: %s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread Krishnakant
hello all,
thanks for all of your very quick responses.
The problem is that I am using python 2.5 so the 2.6 syntax does not
apply in my case.
secondly, My problem is very unique.
I have created a function called executeProcedure in python which calls
stored procedures in postgresql.
The fun part of this function is that it has just got 3 standard
parameters namely the name of the sp to be called, whether it returns 1
or more records as a result and the list containing the input parameters
which that sp will need for execution.
So no matter what your sp does as in insert update delete or select, no
matter there is one param or 10 all you have to do is pass one string
containing the function name, one boolean and one list of params.
The rest is taken care by this python function.
So now all hackers will understand that the query to call the stored
procedure namely cursor.execute(select * from functname ) will be built
dynamically.
So now in this situation I have to build the querystring and then pass
it to execute of the cursor.
in this case, I get a problem when there is ' in any of the values
during insert or update.
If any one wants this code, Please let me know.  You all can get a lot
of utility out of the function.
This only becomes a problem when an ' comes in the value.
So I need help to fix the problem with the given context.
happy hacking.
Krishnakant.
On Mon, 2008-12-15 at 07:21 -0600, Lamonte Harris wrote:
 sorry about that
 
 queryString = insert into venders
 values('{0}','{1}','{2}').format(field1,field2,field3)
 
 On Mon, Dec 15, 2008 at 7:21 AM, Lamonte Harris
 pyth0nc0...@gmail.com wrote:
 I had this problem too.  If you've upgraded to python 2.6 you
 need to use the new sytnax format
 
 queryString = insert into venders
 values('{0}','{1}','{2}'.format(field1,field2,field3)
 
 
 
 On Mon, Dec 15, 2008 at 6:46 AM, Krishnakant
 hackin...@gmail.com wrote:
 hello all hackers.
 This is some kind of an interesting situation although
 many of you must
 have already gone through it.
 I am facing a situation where I have to use psycopg2
 and insert rows in
 a postgresql table.
 That's pritty easy and no need to say that it works
 well.  But there are
 some entries which have an ' in the value.
 I have a venders table in my database and one of the
 values tryed was
 His Master's Voice 
 now the master's word has the ' which is used for
 starting and ending a
 varchar value for postgresql or almost any standard
 RDBMS.
 Does any one know what is the way out of this?
 how do you let the ' go as a part of the string?
 I have used %s as placeholder as in
 queryString = insert into venders values ('%s,%s,%s
 %
 (field1,field2,field3 ) ...
 This is not working for the ' values.
 can any one suggest a suitable solution?
 happy hacking.
 Krishnakant.
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 
 

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


Re: %s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread Krishnakant
Hi steve.
you are right.
Thanks for all you who helped to understand how to and *not* to pass
queries through psycopg2 which is a module based on python dbapi.
the following query worked.
cursor.execute(insert into vendors values(%s,%s), lstParams)
lstParams contained all the values and yes one had an ' in it.
thanks again for all the help.
happy hacking.
Krishnakant.
On Mon, 2008-12-15 at 12:35 -0500, Steve Holden wrote:
 Lamonte Harris wrote:
  I had this problem too.  If you've upgraded to python 2.6 you need to
  use the new sytnax format
  
  queryString = insert into venders
  values('{0}','{1}','{2}'.format(field1,field2,field3)
  
 Will all readers of this thread kindly regard this as an example of how
 *not* to generate and execute SQL queries in Python. Study the
 cursor.execute() method, and provide parameterized queries and a data
 tuple instead.
 
 Please also note that the above technique explicitly continues to
 generate SQL syntax errors in Krishnakan's case where the data values
 themselves contain apostrophes.
 
 regards
  Steve

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


Re: programming toolbox

2008-08-22 Thread Krishnakant Mane
hi william,
I am slightly more experienced in python than you (2 years to be presise).
Before this I handled pritty heavy as in coding and as in usage
projects in java.
Untill I came into the wonderful and powerful world of free software,
I programmed in c++ using borlands c++ compiler and IDE.
But having all this experience (I still use c for some system
programming), python has hooked me.
I am so hooked up to python that I have explored all things that is
possible in python to the extent of zope and python cgi.
If you find that wxpython is any harder then try java swing.
By the way have you looked at pygtk.  It is not just rich with widgets
from gtk but also has great power and flexibility.
And since you know wxpython, learning pygtk would be a snap.
But as the saying goes, one shoo does not fit all .
Obviously if you are thinking about system programming like writing
device drivers etc, you will have to keep c in your programming
thinkbox.
And I find php much better comfortable and powerfull enough for web
server programming/ scripting.
I can only say one thing.
If vb facinated you on windows then, python is a cross platform vb
with power of c in many aspects.
although as fellow hackers rightly said on this thread previously,
there is no harm learning some languages like java which have long
life.
Keep away from rubbish like c# and similar .net based language.
They are very short lived and lak many powerfull features.
Happy hacking.
Krishnakant.

On 22/08/2008, Derek Martin [EMAIL PROTECTED] wrote:
 On Fri, Aug 22, 2008 at 08:17:27AM -0500, William Purcell wrote:
 I am still wondering if C++ would be worth learning and I think it could
 be
 answered by these three questions...

 1. Are programs written in C++ better (in any form of the word) than
 programs written in python or vise versa or equal?
 2. Is compiled better than interpreted?
 3. Is it necessary to know any more languages than python to be a
 respectable programmer, i.e. to be able to take care of most programming
 problems (text manipulation, gui programming, scientific computation, web
 stuff)?

 I think the answer depends on what your goals are.  If you want to be
 a well-rounded programmer, it's good to experience a number of
 different languages, so you can see different approaches to different
 problems.  Languages like Python tend to obscure to some degree how
 things actually work inside the machine, whereas languages like C/C++
 encourage that a bit more (though assembler much more so).

 I think it's also a good idea to have more languages under your belt
 if you want to be a professional programmer.  The more tools you have
 in your toolbox, the more marketable you are...

 If you only want to learn to program to solve your own problems, then
 it doesn't really matter.  The only reason to learn additional
 languages is if you find a case where what you've learned doesn't
 solve your problem, or the solution is a lot harder than it should be.


 --
 Derek D. Martin
 http://www.pizzashack.org/
 GPG Key ID: 0x81CFE75D


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


Re: Python Written in C?

2008-07-21 Thread Krishnakant Mane
On 21/07/2008, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I'm just learning about Python now and it sounds interesting. But I
 just read (on the Wiki page) that mainstream Python was written in C.
 That's what I was searching for: Python was written in what other
 language?

Are you a PH.d researcher
In the first place why do you want to make an issue of what an x
language is compiled in 
and if that' is what you are researching in, then sorry to say you
don't seam to have a mindset needed for researcher.
 See, my concern was something like: OK, if Python is so hot, then,
 hopefully someone is writing it in assembly language for each MPU chip
 out there. Otherwise, if, say, they've written it in C#, then it looks
 like the REAL, generally useful language to learn is C# and Python is
 akin to Visual Basic or something: a specialty languagewhereas
 REAL WORLD programmers who want to be generally useful go and learn
 C#.

First off all c# is absolute rubbish waist of time.  if I need to
learn it then I better lern java or pythonfor that matter.  and by the
way what is a real programmer?
I never knew that there are robots who program vertually and a real
programmer .
What do you think I am a spam bot who is writing a vertual program 
every day?  first give me your defination for real programmer.
 So I was suspecting the Python compiler or interpreter is written in a
 REAL language like C#. So, Wiki says it's written in C! It's almost as
 if it were an intentional trick...write your own, new language in an
 OLD, real world language that is passe. Compile it into executable
 modules of course, so it is a real, working compiler, alright. But the
 SOURCE is some old, high level language which no one wants to use
 anymore! So now you've got a hot new language package and no one can
 say well, it is written in, the SOURCE code is written in, a REAL
 language. No, it's not! The source is some outdated language and
 compiler and no one is going to prefer learning THAT to learning your
 hot new language!

what! no one is using c?  I want to know what people use to write
device drivers?  I am such a fool I really never new that people use
c# to create device drivers for hardware and for creating firmware.  I
admit my stupidity that I never knew that c# is real programming
language .
and what is your programming language?python is a free and open
source programming language and does not belong to one person.

 I'm not dissing Python, here. Just noting that, if it is written in C,
 that throws a curve at me in trying to balance the value of learning
 Python vs. some other major language.
My request and strong recommendation to you is don't learn python,
because you don't deserve to.  I am not saying for dissing you, i
know you are real programmer .  but you seam to have a typical
mindset which the rubbish microsoft has inculcated in many
programmers, aa sorry real programmers  line you.
I don't think there is any point saying vvb kind of  some thing is
great and python is rubbish.  every language has its value and vb is
not a language in the first place.  python is made with a view that it
is usefull for all purposes and it has been so far successful and I
don't really care why it is done in c as long as it does the work.
happy hacking.
Krishnakant.
 --
 http://mail.python.org/mailman/listinfo/python-list

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


question relateding to parsing dbf files.

2008-06-18 Thread Krishnakant Mane
hello all.
I need to parse some dbf files through python.
the reason being that I have to migrate some old data from dbf files
to postgresql.
all that I need to know is if some one has got a working code sample
using dbfpy.
I found this module suitable for my work but can't figure out how to use it.
else, if there is any other module, please recommend so.
happy hacking.
Krishnakant.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie to python --- why should i learn !

2008-05-08 Thread Krishnakant Mane
hello,
I have programmed co insidentally in all the 3 languages.
so out of my experience of 10 + years, I got my personal share of
reasons to prefer python over the other 2 namely c++ and java.
firstly as every one has already explained, python is easy, fun to
learn and can do many things much productively for programmers
compared to c++ and java.
and c# is no better in that.
besides, now a days python has become much much faster in some cases
faster than java.
compare pygtk vs java swing.
python has huge amount of libraries/ modules which are as easy to use
as the language itself.
the syntax difference mentioned in the first email on this thread
makes a huge difference when the code becomes complex and the number
of lines increase.
so there are a lot of reasons to prefer python over java.
for the question what can I do in python easier than other languages
 is not a question to be answered because it all depends on how one
associates the problem space with the language space in which the
programmer wishes to express the solution.
there will be people who will say java is much better choice for
large scale programmes  but people like myself will always question
that.
happy hacking.
Krishnakant.
--
http://mail.python.org/mailman/listinfo/python-list


Re: difflib confusion

2008-01-23 Thread krishnakant Mane
On 23/01/2008, Paul Hankin [EMAIL PROTECTED] wrote:
 On Jan 22, 6:57 pm, krishnakant Mane [EMAIL PROTECTED] wrote:
  hello all,
  I have a bit of a confusing question.
  firstly I wanted a library which can do an svn like diff with two files.
  let's say I have file1 and file2 where file2 contains some thing which
  file1 does not have.  now if I do readlines() on both the files, I
  have a list of all the lines.
  I now want to do a diff and find out which word is added or deleted or
 changed.
  and that too on which character, if not at least want to know the word
  that has the change.
  any ideas please?

 Have a look at difflib in the standard library.

I am aware of the difflib library but still can't figure out.
I know that differences in two lines can be got but how to get it between words?
regards,
Krishna
 --
 Paul Hankin
 --
 http://mail.python.org/mailman/listinfo/python-list

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


difflib confusion

2008-01-22 Thread krishnakant Mane
hello all,
I have a bit of a confusing question.
firstly I wanted a library which can do an svn like diff with two files.
let's say I have file1 and file2 where file2 contains some thing which
file1 does not have.  now if I do readlines() on both the files, I
have a list of all the lines.
I now want to do a diff and find out which word is added or deleted or changed.
and that too on which character, if not at least want to know the word
that has the change.
any ideas please?
kk
-- 
http://mail.python.org/mailman/listinfo/python-list


webbrowser.open still gives problem with file://

2007-11-12 Thread krishnakant Mane
hello,
some days bac I posted a problem about webbrowser.open() not opening
the file on the local machine.
I get a few responses and I tryed working it out.
I also refered to the cookbook example posted on that thread.
I still can't figure out why
webbrowser.open(file:///home/krishna/documents/tut.html) does not
open the file.
as I mentioned earlier the url in the addressbar of mozilla firefox 3
alpha is file:///home/krishna//home/krishna/documents/tut.html
which is indeed wrong.
I have only got a hint so far that I can use a module called
BaseHTTPServer but I have not yet understood how it will help me to
solve the problem.
is it going to give the correct file:/// to the webbrowser.open()?
if yes then how?
can some one post a simple example?
I don't need to create any class for this because some other code in
python is actually creating an html file and I just need to display it
in the browser.
so please help on this one.
with regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


attaching someconfusing results in webbrowser.open on gnulinux

2007-11-01 Thread krishnakant Mane
hello all,
I had mentioned previously that I can't open html files in python.
I have my username as krishna and there is a documents folder.
so when I give webbrowser.open(file:///home/krishna/documents/tut.html)
on python prompt I get true as return value but web browser (firefox )
opens with page not found.
and the address bar shows the following address which indeed is wrong.
file:///home/krishna/file:///home/krishna/documents/tut.html
I can't understand what is happening.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


problem opening html file with webbrowser.open

2007-10-29 Thread krishnakant Mane
hello all,
as I posted in my previous thread, I am generating html reports for my
client software.
I am yet to find a satisfactory module which can help me actually
create headings, bold and italics etc without merging html with data
variables.
any ways I am right now doing the hamd coding myself.  may be I have
overlooked some module.
right now I am in the process of trying templayer.
but my main issue is that when I use the
webbrowser.open(file:///home/myname/report.html), webbroser opens
but the page does not come up.
there is certainly some thing wrong in what I am giving to the open function.
can some one correct me?
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


how to creating html files with python

2007-10-27 Thread krishnakant Mane
hello,
I have one strange requirement,
I need to create html files through python and add some data from the database.
it is a GUI based application developed in WX python.
and the reports need to come out in html for some strange reason which
is off topic to discuss here.
but the point is that how do I do it?
should I create a normal file object and write the html with the data
into it or are there some modules to do it?
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to creating html files with python

2007-10-27 Thread krishnakant Mane
hi George,

On 27/10/2007, George Sakkis [EMAIL PROTECTED] wrote:
 On Oct 27, 12:12 pm, krishnakant Mane [EMAIL PROTECTED]
 wrote:

  I have one strange requirement,
  I need to create html files through python and add some data from the
 database.

 The only strange thing here is that you think this is a strange
 requirement :) This is quite typical, and practically required for web
 development. As Diez pointed out, your main problem will be which of
 the dozen or so template packages to pick. Depending on your criteria
I am finding it difficult to choose.
my only requirement is to create an htmo file with normal html taggs
but the values come from a database connection.
so I want to get rid of doing the entire concatination right from
start till end.  I don't mind opening a file and doing file.write()
but it will be nice of some module to help me get the data
concatinated with taggs and rather even better if I can do complex
things like creating an html table whos rows contain data coming from
a result set.
here I would like to have the tagging more like functions, some thing
like report.bold(this must be bold ) and this function to return a
line with the bolded html which looks in the file as b this must be
bold /b
so instead of I doing the concatination myself, python makes it easy.
and I will have lot of complex tables etc to do like this.
so please help me choose one.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello,
I am strangely confused with a date calculation problem.
the point is that I want to calculate difference in two dates in days.
there are two aspects to this problem.
firstly, I can't get a way to convert a string like 1/2/2005 in a
genuan date object which is needed for calculation.
now once this is done I will create a another date object with
today = datetime.datetime.now()
and then see the difference between this today and the string that I
converted to date.
now in the first place I can't recall how I can convert a string to a date.
then now I don't know how to calculate difference in days between
today and the string converted date.
any help will be appreciated.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello,
thanks all of you for providing valuable help.
right now I am confused about the delta object.
how can I extract the difference between two dates in terms of day
using the delta object?
I tried reading the python docs but did not understand the concept of
delta object and how can I measure the difference in terms of days
between two dates.
I expect that the days would be integers.
secondly the format of my date is actually 16/10/2007, and this is
all in varchar field inside a postgresql database.
I understand that datetime.datetime.strptime would convert this string
16/10/2007 into a date object which I can then compare with the
current date created by datetime.now().
is that right?
if yes then please explain me how I can get the delta object to give
me results in days.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


problems playing with dates from any month.

2007-08-02 Thread krishnakant Mane
hello,
I have a very strange problem and I can't find any solution for that.
I am working on an accounting package which I wish to develop in python.
the simple problem is that I want to knoe how I can know if the given
date is the nth day of a month.
for example if a customer is supposed to pay his installment on every
5th of all months,
I want to know if today is the fifth day (jan the fifth, feb the fifth
etc) for any given month.
I have not found any such function.
if I have looked (or over looked ) in the wrong places I am really sorry.
secondly I also want to know the way in which I can convert a given
string to a date object.
for example if I have a string 29/09/2005, I know it is a valid date
although it is in a string form.
now I want to convert the above string into a real date object.
how can I cast it this way?
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problems playing with dates from any month.

2007-08-02 Thread krishnakant Mane
On 02/08/07, Ian Clark [EMAIL PROTECTED] wrote:


 http://docs.python.org/lib/node85.html

I looked there even before.
but could not figure out what the code did.
I know in that variable called s there was a string in a valid date format.
but when datetime.strptime was used, I did not understand the place
where a date object say d was created.
I would expect some thing like d = and the function.  but I did not fine that.
only reference was the datetime module and the documentation is not as good.
another question I am getting is that where is the list of all
formatting characters.  like for example Y is 4 digit year M is month
MM is month in 2 digits etc.
I am trying to locate a list of all these denoters.
can you provide me the place?


 Then it's just:

 if date_obj.day == 5:
  print 'It's the fifth day of the month'

this was much better than the documentation, thanks,
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


how good does PyGTK work on windows?

2007-07-16 Thread krishnakant Mane
hello,
I will be writing some code in PyGTK to run on linux.  but I want to
know if there are any installers or distutils available for PyGTK on
windows?
I have heard that installing gimp or even pygtk is next to impossible
and is very tedious if at all one gets success.
can any one share their experiences with installing and running pygtk on windos?
any links for downloading proper packages will be highly appreciated.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


inspite of proper package structure, no module named xyz error.

2007-07-12 Thread krishnakant Mane
hello all,
can some one suggest me the best solution for a package?
I have a package folder called idm and there are the following files in there.
__init__.py which is right now empty.
mainwindow.py which has a single class called MainWindow which is an
MDI Parent frame from wxpython.
student.py which is a child frame which gets called from the main menu.
exam.py, another child frame.
now when I try to run mainwindow.py file with the import
idmstatement, I get the following error.
no module named idm.
what could be the problem?
I have imported all the necessary modules in mainwindow.
kindly help.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


which is the comprehencive module for postgresql?

2007-05-18 Thread krishnakant Mane
hello all,
some times having many choices often confuses the users.
can some one plese tell me which is the most comprehencive, well
documented and widely used and tested module to connect from python to
postgresql database?  I looked around PYPgsql but there seams to be
very little documentation.
and seams that PyGreSql is non-free?
please suggest a suitable driver.  by the way I will also be using
bynary large objects.
so that support must be included.
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with quoted strings while inserting into varchar field of database.

2007-05-07 Thread krishnakant Mane
On 6 May 2007 11:22:52 -0700, Daniele Varrazzo [EMAIL PROTECTED] 
 Every serious database driver has a complete and solid SQL escaping
 mechanism. This mechanism tipically involves putting placeholders in
 your SQL strings and passing python data in a separate tuple or
 dictionary. Kinda

 cur.execute(INSERT INTO datatable (data) VALUES (%s);,
 (pickled_data,))

I will try doing that once I get back to the lab.
mean while I forgot to mention in my previous email that I use MySQLdb
for python-mysql connection.
I did not find any such reference to storing pickled objects in the API.

any Idea what could be done with the mysql python module I am using?
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Latest errors on pickled objects and blob datatypes in mysql

2007-05-07 Thread krishnakant Mane
hello,
finally the errors for my sql query have changed so I have even
changed the thread subject because I feel now that this is not doable
in mysql and this seams to be a bug, ither in python or the MySQLdb
module or perhaps both.
my table is called testobj and the blob field is called obj.
now following is my query with the cursor named CSRInsert.
CSRInsert.execute(insert into testobj (obj) values (?);,(pickled_object))
the error is,
type error, not all arguments formatted during string formatting .

can some one now figure out what could be the problem?
-- 
http://mail.python.org/mailman/listinfo/python-list


problem with quoted strings while inserting into varchar field of database.

2007-05-06 Thread krishnakant Mane
hello,
I finally got some code to push a pickled list into a database table.
but now the problem is technically complex although possible to solve.
the problem is that I can nicely pickle and store lists in a blob
field with the help of dumps() for picklling into a string and then
passing the string to the blob.
I am also able to get back the string safely and do a loads() to
unpickle the object.
but this only works when list contains numbers.
if there is a list such als
lst = [a,b,c] then after a dumpls I get a pickled object into a
string but when I try to insert this into the blob field it refuses to
get into the table.
there is an sql syntax error.
I further discovered that the string variable that contains the
pickled object contains a lot of single quots ' and this is what is
probably preventing the sql insert from succedding.  can some one
suggest how to work around this problem?
regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


is there a module to work with pickled objects storage in database?

2007-05-04 Thread krishnakant Mane
hello all,
I am trying a very complex kind of a task in a project.
I have a knowledge management system where I need to store a lot of
objects (pickled).  I have to store mostly lists and dictionaries into
a rdbms.
mostly I will be using mysql.  I want to know if there is any module
that can help me store a pickled object inside a blob field instead of
a file.  I know that pickle.dump() can store an object into a file but
I can't find a way to transfer pickled objects into a database.
I so far tried to read a dumpped file for pickled object and directly
right the contents of the file to the blob field in my database.
but that does not seam to give the right result.
I first dump the object into the file through pickle.dump and then
open the file in read mode.
then I read the contents of the file and then store what ever comes
out into the blob field.
I know this is not right and there should be ways of storing a pickled
object other than file.
Please guide me on this issue.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


how to pickle objects for database storage?

2007-04-11 Thread krishnakant Mane
hello,
I have a strange but very interesting requirement?
provided that a database can provide for an object data type like
binary large object (blob), can I store a pickeled python object in
it?
I know oracle has blob and clob and believe that mysql/ postgre sql
has some thing similar to store direct objects?
if not then should a pickeled object wrapped inside a file and then
stored in a database?
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


newbi question on python rpc server, how it works?

2007-03-28 Thread krishnakant Mane
hello,
searched a lot of places including google search but can't find
answers to python-rpc.  I am also very new to rpc.  I am very clear
about its meaning and where it is to be used, but not about how it is
done.
I have a need where I need to create a layer of business logic that
will connect to mysql database at one end and a wxpython based thin
client at the other end.
can some one give me basic idea as to how I can use simple xml rpc
server class of python and build an xml rpc server and then a client
which I can embed in my wxpython based thin client?
as I said I am not aware of how xml rpc works in details.
I want to creat the wxpython client app in such a way that it only
does the work of validation and display and only sending the data as
is to the xml rpc server for logic and then xml rpc server will
inturn talk to mysql.
my business logic consists of many classes which I want to put in a
package directory with __init__.py and all the other modules.
do I need to create all of them as xml rpc server instances or can I
use them into one single xml rpc server class?
at the other end I am not really understanding how the xml rpc client
can be used to get data in to my wx based gui?
for example I want to fill up a list box with data that came from the
rpc server to the client and then some how looping through the
elements sent over and putting into a list.

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


Re: newbi question on python rpc server, how it works?

2007-03-28 Thread krishnakant Mane
hello all,
I have downloaded the entire twisted library.
I am also trying to read the documentation but I have a couple of
problems right now.
firstly, I did not find any thing in twisted documentation that
specifically talks about xml rpc.  am I missing some thing?
secondly, if I am writing an entire application with its logic in an
xml rpc server, do I have to create all my classes as instences of xml
rpc server (just like I create a java servlet or a php script)?  or is
it that I just create one xml rpc server class which is like the entri
point for all other classes in the package?
can you provide a couple of links to howtos or tutorials on creating
xml rpc servers and clients  with twisted python?  I am also confused
as to how will I mix the functionality of MySQLDB with twisted python?
I am asking this because I felt twisted much cleaner to use than the
modules coming with python itself.  again I may be wrong and some one
might point me to the possible problems with this aproach in the long
run.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help developing an editor to view openoffice files.

2007-03-14 Thread krishnakant Mane
On 14/03/07, Paul Hummer [EMAIL PROTECTED] wrote:

 I actually just read this in the O'Reilly book Python Cookbook, so I
 know this answer off the top of my head.  OpenOffice files are merely
 zip files with well documented XML inside.  Use the builtin zip module
 to open them, and then it's just XML parsing.  As far as the editor,
 you'll have to familiarize yourself with the XML data from the
 documentation, and it sounds like that's quite a project.

it is indeed a huge project but I need to get started.
I know that it is xml inside a zipped archive.  but reading the
documents is one thing and rendering them is another.
just in case we can convert it to html and then render it in some kind
of a html browser or html text area and then when user makes changes
to the document, we can save it back to odt.  but for that we need
both way conversion.


 Just out of curiosity, why not just download OpenOffice?

I wished I could use it out of the box.
but the problem is that open office does not provide any accessibility
on windows and on linux the work is going on.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


help developing an editor to view openoffice files.

2007-03-13 Thread krishnakant Mane
hello,
right now I am involved on doing a very important accessibility work.
as many people may or may not know that I am a visually handicap
person and work a lot on accessibility.  the main issue at hand is to
create an accessible editor for open office.
there are a lot of things remaining on that front.
so right now I am trying to find out a temporary work around by
creating a simple accessible editor (with wxpython) for viewing and
editing open office files.
I know there must be python libraries that can open/ save .odt files
because it is an open standard any ways.
but I am trying to work out a kind of a program where those files can
also be displayed in a text area with all the formatting.
probably one way of doing it is to use some thing like a rich text
editor and allow the file to be converted to rtf from odt for viewing
and back again to odt when the user wishes to save it.
another way I find is to actually find out if there is a odt text box
that can display these files as they are.
viewing the contents of the files in an editable way is most important.
any suggestions?
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python in a desktop environment

2007-03-13 Thread krishnakant Mane
I have coded some complex programs in python in the recent past.
I find it very robust and also not very slow (as is depicted by the
starter of this thread )  I use wxpython on the gui side and testify
that it is indeed very suitable for huge gui apps.
may be pyqt is good enough too and I believe so.
I don't find there is any reason to go stay in a hut when you have a
banglo to stay.
may be c++ gives you more control on pointers etc but what if you just
forgot to use that control properly?  afterall we are all humans.
so python is really good for speed as well as robustness if you can
understand the meaning of it.  and I wont want to again give the
meaning of the word because some one has already done it.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help developing an editor to view openoffice files.

2007-03-13 Thread krishnakant Mane
hello,
well what I exactly need to do is firstly have a way to read .odt and
.ods files.
I have a lot of information in open office format which I need to access.
The most important thing is that I completely want to avoid the use of
microsoft office.
so I need to firstly get access to open office documents through a
python module that can read and parse those documents and may be
convert it to html and display in some kind of an html/ text area may
be wxpython can help?
secondly I want to edit those documents may be in html format and then
when I say sayve it should save the changes back to .odt with the
formatting information.
can this be made possible?
thanks and regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't find a way to display and print pdf through python.

2007-02-12 Thread krishnakant Mane
os.start does not work..  attribute error.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't find a way to display and print pdf through python.

2007-02-11 Thread krishnakant Mane
well yes,
I need to view reports on line and also print them from within my app.
so yes I need to display the pdf in my app and print it as well.
regards.
Krishnakant
-- 
http://mail.python.org/mailman/listinfo/python-list


can't find a way to display and print pdf through python.

2007-02-10 Thread krishnakant Mane
hello all,
I am stuck with a strange requirement.
I need a library that can help me display a pdf file as a report and
also want a way to print the same pdf file in a platform independent
way.
if that's not possible then I at least need the code for useing some
library for connecting to acrobat reader and giving the print command
on windows and some thing similar on ubuntu linux.
the problem is that I want to display reports in my application.  the
user should be able to view the formatted report on screen and at his
choice click the print button on the screen to send it to the printer.
I have reportlab installed and that is sufficient to generate pdf reports.
but I still can't fine the way to display it directly and print it directly.
Please help me.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't find a way to display and print pdf through python.

2007-02-10 Thread krishnakant Mane
On 11/02/07, Vishal Bhargava [EMAIL PROTECTED] wrote:
 Use Report Lab...
I mentioned in my first email that I am already using reportlab.
but I can only generate pdf out of that.
I want to display it on screen and I also will be giving a print
button which should do the printing job.
by the way I use wxpython for gui.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't find a way to display and print pdf through python.

2007-02-10 Thread krishnakant Mane
On 11/02/07, Vishal Bhargava [EMAIL PROTECTED] wrote:
 Are you trying to do real time or post real time.
 -Vishal

post real time.
I want to first display the report on screen by default and the user
at his choice will click the print button and the report will be
printed.
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


strange problem using modules from my own package.

2007-02-08 Thread krishnakant Mane
hello all,
I found a very strange kind of behaviour in python with my own package.
I created a package in which there were 4 modules and one __init__.py file
I created the entire project in eclipse (pydev).
it works fine there with the ide.
but now when I try running the code without eclipse, that is when I
run the individual .py file from a command promt it gives me error.
for example I have mainwindow.py, customer.py,  stock.py and of course
__init__p.py in my package
the app is in wxpython which is not important in the context of this problem.
never the less I go in the directory called pbcf which is the name of
my package
there I have all the above mentioned files and the mainwindow.py file
is the one I run for testing all the menus.
but here the moment I run the file, it starts giving me an error
saying pbcf is not a module.
I find that the same code runs without any problem in eclipse.
in mainwindow.py I have from pbcf import * and in __init__.py I have
of course included MySQLdb and wx
and in __init__.py I have a connection object called CONCSS.
now when I have all the imports in mainwindow, it does work in eclipse
but does not on a normal command prompt.
why is this?
regards.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange problem using modules from my own package.

2007-02-08 Thread krishnakant Mane
On 09/02/07, Gabriel Genellina [EMAIL PROTECTED] wrote:
 At Friday 9/2/2007 02:10, you wrote:

 Please keep posting on the list - you'll reach a whole lot of people
 there...
sorry, I had just hit the reply button and did not notice that
python-list was not there.
my crystal ball I can see this statement: import pbcf
 or perhaps: from pbcf import something (it's not so clear...)
 written inside any module in your package. So, your package must be
 installed in any directory listed in sys.path, for python to be able
 to actually find it; perhaps in site-packages.
can I have package in a folder and then a main.py in the same folder
but out side the package?
 Also, if you try to execute a module inside your package, it does
 not even *know* that it lives inside a package.

but all this is working in eclipse with pydev.
and I looked in the console but there were no errors.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: confused on python rpc with apache, is it possible?

2007-01-20 Thread krishnakant Mane
 Use mod_python with some xmlrpc handler. There is more than one around.
 Google for them. That way you can keep Apache for both Python and PHP.

I am confused.
I have some documents on xml-rpc but none of them mentioned apache.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >