Re: [BangPypers] python for management studies
On Fri, Jun 4, 2010 at 10:16 AM, Senthil Kumaran orsent...@gmail.com wrote: On Thu, Jun 03, 2010 at 10:49:59PM +0530, Kenneth Gonsalves wrote: I have been commissioned to create and implement a course (compulsory with 2 credits for first semester) on computer programming for business managers for MBA's in a new B school that is starting up. I envisage something like the Here is my suggestion: 1. Introduce the basics and standard library. This cannot be overlooked. 2. Introduce how to install external packages and how to it works along with the interpreter. 3. Choose Problems in their Domain and solve it using python. 4. Repeat 3. :) I understand the difficult and the challenging part for you will be point 3. Putting effort on the same will definitely be beneficial in the long run (IMHO). If the exercises are needed, putting it up on bitbucket or github would be nice. There are lots of domain experts here who'll have *something* to contribute to parts of the course. You (ie. Kenneth) can do the overall editing and structuring and it should be ready quite quickly. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] 2D plotting libraries.
Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. -- shiv ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
I would recommend starting with http://alpha.djangogenerator.com/ to get a feel of an 'application'. -V- http://twitter.com/venkasub ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Friday 04 June 2010 12:13:42 Shiv Shankar wrote: Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. just started the same thing yesterday! -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 12:13 PM, Shiv Shankar fsla...@gmail.com wrote: Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. PyGame is better if you want to animate rather than to plot. It has an animation loop inside which you can update sprites and things. If you want to see your object move as per your equations, it's pretty easy to do. I have an example program here which you can customise. http://github.com/nibrahim/Devious-machinations/blob/master/tutorials/positioning_sprites.py You'll have to change the update method of the Ball to set the x and y based on your equations rather than just x+=2, y+=0.5 which I've done. Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. If I wanted to plot, I'd write the program to dump out the X and Y coordinates in plain text and pipe that through Gnuplot after some massaging to do the plot. If you want to stuff the whole thing in Python, you simply use a Tkinter canvas. It has some simple primitives to draw points at x and y positions. Should be doable in 10 or 15 lines of code. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
2010/6/4 Shiv Shankar fsla...@gmail.com: Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. If that is not an animation, you can use Python Imaging Library to render the graph as an image. Here is a sample code for rendering sparklines. http://github.com/aaronsw/watchdog/blob/master/utils/simplegraphs.py Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
On Fri, Jun 4, 2010 at 12:32 PM, Venkatraman S venka...@gmail.com wrote: I would recommend starting with http://alpha.djangogenerator.com/ to get a feel of an 'application'. It might be just me but I think this is an *extremely* bad idea. I just tried the site and it looks like a nice point and click wizard to create an application template which people can customise into an application. The world has enough people who consider programming mostly a matter of point and click who don't know what's going on. I would be completely against using any of these tools for an introductory programming course. I'd teach language basics, the standard library (like Senthil pointed out) so that they don't reinvent the wheel poorly and then have them solve *hard* problems which are relevant to their area of work. Getting an application up and running with a few clicks of a mouse has the same effect as eating junk food. Your appetite goes away, you can claim that you've eaten something but there's close to zero nourishment. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
Getting an application up and running with a few clicks of a mouse has the same effect as eating junk food. Your appetite goes away, you can claim that you've eaten something but there's close to zero nourishment. I love this analogy.gr8. +1 for all of your points. Regards, Srini T. --The real failure is failing to try for success. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
On Fri, Jun 4, 2010 at 12:47 PM, Noufal Ibrahim nou...@gmail.com wrote: On Fri, Jun 4, 2010 at 12:32 PM, Venkatraman S venka...@gmail.com wrote: I would recommend starting with http://alpha.djangogenerator.com/ to get a feel of an 'application'. It might be just me but I think this is an *extremely* bad idea. I just tried the site and it looks like a nice point and click wizard to create an application template which people can customise into an application. The world has enough people who consider programming mostly a matter of point and click who don't know what's going on. I would be completely against using any of these tools for an introductory programming course. I'd teach language basics, the standard library (like Senthil pointed out) so that they don't reinvent the wheel poorly and then have them solve *hard* problems which are relevant to their area of work. Getting an application up and running with a few clicks of a mouse has the same effect as eating junk food. Your appetite goes away, you can claim that you've eaten something but there's close to zero nourishment. The point is : the audience is MBA students. And i have had experience coaching around 40+students who had ZERO experience with programing and taught them Python. They were HIGHLY skeptical to program. I had to really motivate them a lot to get them onto Python. I partly succeeded. Now the entire org, which was using Java, runs on Python. Do NOT expect MBA grads to *program* - they are decision makers, they need language as a *tool* to augment their daily work - hence Macros. I can include some verbiage here reg the MBA mentality in India et al. but thats cliched! DjangoGenerator is cool to understand what an 'application'-'relation' looks like. I have been using this to get 2 persons to understand the concept of a 'web application'. This tool is not a 'pseudo' programmer. Will you stop using Pinax for the same reasons? -V ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 12:13 PM, Shiv Shankar fsla...@gmail.com wrote: Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. Wrong choice. When a software exists which is the perhaps the most powerful plotting program *ever* written, choosing a gaming library for this demonstrates poor choice, unless there is a specific reason for that - like for example, if you are already familiar with Pygame or SDL. I am talking about gnuplot here. The commands are pretty intuitive. It gives you an interactive prompt, like python. For example, here is how to plot a curve for the function (3*x*x - 8*x) over x range of -50:50 and y-range of -10:100 gnuplot plot [-30:30] [-10:500] (3*x*x - 8*x) You can also do 3-d plots. Here is the 3d plot of a complex function in 2d plane. gnuplot splot [-30:30] [-10:500] (3*x*x - 8*x + y*y) Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. Gnuplot is its own programming language, but if you want a Python interface, try gnuplot.py. http://gnuplot-py.sourceforge.net/ -- shiv ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
On Fri, Jun 04, 2010 at 12:55:19PM +0530, Venkatraman S wrote: Do NOT expect MBA grads to *program* - they are decision makers, they need Be whatever, even if you are president of a company and *want* to write a small program to move files around or add your salary, you better know the basics before knowing macros. Otherwise, you will create a lot of problem for yourself and others. No wanting to write and delegating it to others is different matter altogether, we are not talking about that. -- Senthil He walks as if balancing the family tree on his nose. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
How about mathplotlib ? I haven't used it (yet but am planning to play with it for visualisation). What are the other good visualisation libraries for python. -- Vinayak On Fri, Jun 4, 2010 at 1:01 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 12:13 PM, Shiv Shankar fsla...@gmail.com wrote: Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. Wrong choice. When a software exists which is the perhaps the most powerful plotting program *ever* written, choosing a gaming library for this demonstrates poor choice, unless there is a specific reason for that - like for example, if you are already familiar with Pygame or SDL. I am talking about gnuplot here. The commands are pretty intuitive. It gives you an interactive prompt, like python. For example, here is how to plot a curve for the function (3*x*x - 8*x) over x range of -50:50 and y-range of -10:100 gnuplot plot [-30:30] [-10:500] (3*x*x - 8*x) You can also do 3-d plots. Here is the 3d plot of a complex function in 2d plane. gnuplot splot [-30:30] [-10:500] (3*x*x - 8*x + y*y) Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. Gnuplot is its own programming language, but if you want a Python interface, try gnuplot.py. http://gnuplot-py.sourceforge.net/ -- shiv ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 1:15 PM, Vinayak Hegde vinay...@gmail.com wrote: How about mathplotlib ? I haven't used it (yet but am planning to play with it for visualisation). What are the other good visualisation libraries for python. You mean matplotlib. It is a Python library meant for plotting and not a separate application like gnuplot. I haven't used it yet, but I understand there is some initial learning involved. Not sure if it is amenable for a rookie. -- Vinayak On Fri, Jun 4, 2010 at 1:01 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 12:13 PM, Shiv Shankar fsla...@gmail.com wrote: Hello, I have a finite 2 dimensional plane. I have a set of co-ordinates, which is basically the movement of an object. The co-ordinates are derived from a set of equations considering various factors. After a set of initial research and tryouts i *quickly *decided on using * pygame* to plot the co-ordinates on a 2D plane. Wrong choice. When a software exists which is the perhaps the most powerful plotting program *ever* written, choosing a gaming library for this demonstrates poor choice, unless there is a specific reason for that - like for example, if you are already familiar with Pygame or SDL. I am talking about gnuplot here. The commands are pretty intuitive. It gives you an interactive prompt, like python. For example, here is how to plot a curve for the function (3*x*x - 8*x) over x range of -50:50 and y-range of -10:100 gnuplot plot [-30:30] [-10:500] (3*x*x - 8*x) You can also do 3-d plots. Here is the 3d plot of a complex function in 2d plane. gnuplot splot [-30:30] [-10:500] (3*x*x - 8*x + y*y) Has any one in here implemented this sort of a program ? Which library did you use ? if possible could you explain why you chose the particular library. Gnuplot is its own programming language, but if you want a Python interface, try gnuplot.py. http://gnuplot-py.sourceforge.net/ -- shiv ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
Wrong choice. When a software exists which is the perhaps the most powerful plotting program *ever* written, choosing a gaming library for this demonstrates poor choice, unless there is a specific reason for that - like for example, if you are already familiar with Pygame or SDL. Its a strategical game anyways. But that no way justifies my choice for the library. Ill try out GNUplot. Does GNUPlot have something like py2app in pygame ? ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 2:57 PM, Shiv Shankar fsla...@gmail.com wrote: Wrong choice. When a software exists which is the perhaps the most powerful plotting program *ever* written, choosing a gaming library for this demonstrates poor choice, unless there is a specific reason for that - like for example, if you are already familiar with Pygame or SDL. Its a strategical game anyways. But that no way justifies my choice for the library. Ill try out GNUplot. Does GNUPlot have something like py2app in pygame ? Well, I might have misunderstood you. I thought you wanted to plot the output of your program separately, not tied to your main application. Looks like you want the plotting to be done in the app. Then matplotlib is a better choice, since it is a library and can be used directly in code. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 2:57 PM, Shiv Shankar fsla...@gmail.com wrote: [/..] Its a strategical game anyways. This changes things. What kind of app are you trying to make? -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
Further, on debug i got to know in tarfile.py (library file) function open( ) (Line 1147) where it is return the file attributes is failing, I am not able to make out the exact reason, why it is failing in 64-bit M/c , but the same is working in 32-bit M/c I have attached the part code with the mail, File: tarfile.py Line:1147 if mode in (r, r:*): # Find out which *open() is appropriate for opening the file. for comptype in cls.OPEN_METH: func = getattr(cls, cls.OPEN_METH[comptype]) print func,func if fileobj is not None: saved_pos = fileobj.tell() try: print func1,func(name, r, fileobj) return func(name, r, fileobj) except (ReadError, CompressionError): if fileobj is not None: fileobj.seek(saved_pos) continue raise ReadError(file could not be opened successfully) I have added few prints for debugging, please ignore it. output : tarfile.is_tarfile(tar) func bound method type.gzopen of class 'tarfile.TarFile' func1 func bound method type.taropen of class 'tarfile.TarFile' func1 func bound method type.bz2open of class 'tarfile.TarFile' func1 False As u can see, the func(name, r, fileobj), is returning none. The same test output in 32bit Mc: tarfile.is_tarfile(tar) func bound method type.gzopen of class 'tarfile.TarFile' func1 tarfile.TarFile object at 0xb7f028ac True Any information on this will be very useful. If i am wrong. Please correct me Thank u -- Thanks Regards V.Murugadoss On Fri, Jun 4, 2010 at 2:57 PM, murugadoss murugadoss2...@gmail.com wrote: Hello, I am trying to extract a tar file. while doing this i check the valid tar file using is_tarfile( ). It is working fine in a 32-bit linux machine with python 2.5.4 version and when i try it out in a 64-bit linux pc, i end up saying file is invalid(false). This machine was using python 2.4 and now i have upgraded to 2.5.4 version and I am using python 2.5.4. I went through the library file, tarfile.py and found in is_tarfile(), is opening the tarfile using tarfile.open. tar = /root/testtar.tar.gz import tarfile tarfile.is_tarfile(tar) False tarfile.open(tar) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python2.5/tarfile.py, line 1153, in open raise ReadError(file could not be opened successfully) tarfile.ReadError: file could not be opened successfully Can anyone please help me -- Thanks Regards V.Murugadoss ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
On Fri, Jun 04, 2010 at 07:18:56PM +0900, murugadoss wrote: Further, on debug i got to know in tarfile.py (library file) function open( On man, you went too far. tar = /root/testtar.tar.gz Is this is a tarfile? Answer is No. -- Senthil ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
On Friday 04 June 2010 14:46:53 Noufal Ibrahim wrote: On Fri, Jun 4, 2010 at 12:55 PM, Venkatraman S venka...@gmail.com wrote: [..] Do NOT expect MBA grads to program - they are decision makers, they need language as a tool to augment their daily work - hence Macros. I can include some verbiage here reg the MBA mentality in India et al. but thats cliched! Which is why I asked Kenneth about the intention of the course. It depends on that really. as a non-IT person and a non-programmer I have found that the ability to script some things gives me an immense sense of empowerment - I would like to share that sense with students of a B school that is taking utmost efforts to see that everything they do in IT is open source. I am inspired by the guys like the nltk guy, the bioperl guy, the gnumed guy (lead programmer is an active surgeon) and many others. One defect of the geeks in India is that most of the geeks are from IT backgrounds, unlike in the west where many a poet of yesterday is a geek of today. (Did you know that as many as 4 django core devels chat among themselves in ancient greek?) also this being a non-elite B school, the snooty know_it_all air will probably be absent in the students. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 3:52 PM, Shiv Shankar fsla...@gmail.com wrote: This changes things. What kind of app are you trying to make? War game, every one writes their own strategies to derive movement based on a intercommunication between objects. Objects are bots and one teams bot kills the others. Still in the drawing board. The user specified strategies control movement? If that's the case, you simply have to use the graphics library you're using for your game. I don't think you'll be able to use gnuplot/matplotlib/PIL etc. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python for management studies
On Fri, Jun 4, 2010 at 3:58 PM, Kenneth Gonsalves law...@au-kbc.org wrote: [..] Which is why I asked Kenneth about the intention of the course. It depends on that really. as a non-IT person and a non-programmer I have found that the ability to script some things gives me an immense sense of empowerment - I would like to share that sense with students of a B school that is taking utmost efforts to see that everything they do in IT is open source. I think you should focus on exercises then which are relevant to their work. Perhaps some form of project planning, some kinds of calculations, simple tools to make their daily things go easier, meeting minute keepers/schedulers, todo list managers etc. Some information on good practices like version control might be good too although that wanders away from programming and moves into software development. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
On Fri, Jun 4, 2010 at 11:27 AM, murugadoss murugadoss2...@gmail.comwrote: Hello, I am trying to extract a tar file. while doing this i check the valid tar file using is_tarfile( ). It is working fine in a 32-bit linux machine with python 2.5.4 version and when i try it out in a 64-bit linux pc, i end up saying file is invalid(false). This machine was using python 2.4 and now i have upgraded to 2.5.4 version and I am using python 2.5.4. I went through the library file, tarfile.py and found in is_tarfile(), is opening the tarfile using tarfile.open. tar = /root/testtar.tar.gz import tarfile tarfile.is_tarfile(tar) False tarfile.open(tar) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python2.5/tarfile.py, line 1153, in open raise ReadError(file could not be opened successfully) tarfile.ReadError: file could not be opened successfully I have a test tar file named f.tar.gz. import tarfile tarfile.open('f.tar.gz') tarfile.TarFile object at 0x7f8a652fdad0 tarfile.is_tarfile('f.tar.gz') True and for you, tar = /root/testtar.tar.gz import tarfile tarfile.is_tarfile(tar) False So your tar file is not a real tar file. No wonder it is failing to open. Does it take rocket science to figure this out ? Can anyone please help me Yes, only you can help yourself now. Spend time learning! -- Thanks Regards V.Murugadoss ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Friday 04 June 2010 15:52:16 Shiv Shankar wrote: This changes things. What kind of app are you trying to make? War game, every one writes their own strategies to derive movement based on a intercommunication between objects. Objects are bots and one teams bot kills the others. Still in the drawing board. strange - this is what I am doing! -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
Thank for the reply. The tar file is not corrupted, i am using the same file in 32-bit m/c and able to extract it. I have attached this output also with the mail. I am getting this problem only in 64-bit m/c. output from 32-bit m/c: tarfile.is_tarfile(tar) func bound method type.gzopen of class 'tarfile.TarFile' func1 tarfile.TarFile object at 0xb7f028ac True For reference i have tested the same in different systems. -- Thanks Regards V.Murugadoss On Fri, Jun 4, 2010 at 7:35 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 11:27 AM, murugadoss murugadoss2...@gmail.com wrote: Hello, I am trying to extract a tar file. while doing this i check the valid tar file using is_tarfile( ). It is working fine in a 32-bit linux machine with python 2.5.4 version and when i try it out in a 64-bit linux pc, i end up saying file is invalid(false). This machine was using python 2.4 and now i have upgraded to 2.5.4 version and I am using python 2.5.4. I went through the library file, tarfile.py and found in is_tarfile(), is opening the tarfile using tarfile.open. tar = /root/testtar.tar.gz import tarfile tarfile.is_tarfile(tar) False tarfile.open(tar) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python2.5/tarfile.py, line 1153, in open raise ReadError(file could not be opened successfully) tarfile.ReadError: file could not be opened successfully I have a test tar file named f.tar.gz. import tarfile tarfile.open('f.tar.gz') tarfile.TarFile object at 0x7f8a652fdad0 tarfile.is_tarfile('f.tar.gz') True and for you, tar = /root/testtar.tar.gz import tarfile tarfile.is_tarfile(tar) False So your tar file is not a real tar file. No wonder it is failing to open. Does it take rocket science to figure this out ? Can anyone please help me Yes, only you can help yourself now. Spend time learning! -- Thanks Regards V.Murugadoss ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Friday 04 June 2010 16:24:16 Shiv Shankar wrote: Kenneth - how are you communicating between nodes ? I have watch towers which watch on nodes and act as mutual communication points. havent reached that stage yet - what has happened is that my favourite game used to be xconq - but it no longer runs on modern systems and is not maintained, so I am developing a clone. I just started learning pygame yesterday for this purpose. Just a mite surprised that some one else is doing this too. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Friday 04 June 2010 16:26:57 Anand Balachandran Pillai wrote: strange - this is what I am doing! Wow - is game programming so popular now a days ? I never tried it myself. don't - it is addictive, your wife and kid will never see you again ;-) -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
It is for collecting the binary data from the client system. wherein the binary data is sent in tar.gz format. The exact task is to collect the data, untar and do the processing. Initially the program is written in the 32-bit linux pc. It is completely working here. Today, i loaded the same program in the server pc (which is a 64-bit x86 pc), i end up with issue. The crc check and md5 check are same in the both the p*c.* * * *for 32-bit pc*: tarfile.is_tarfile(tar) comptype gz func bound method type.gzopen of class 'tarfile.TarFile' func1 tarfile.TarFile object at 0xb7f02e2c True import binascii data = open(tar,'rb').read() binascii.crc32(data) 1270541744 import hashlib m=hashlib.md5() m.update(data) m.hexdigest() '2763563634899e9d1447731ed465f6a5' *64-bit pc:* * * tarfile.is_tarfile(tar) func bound method type.gzopen of class 'tarfile.TarFile' func1 func bound method type.taropen of class 'tarfile.TarFile' func1 func bound method type.bz2open of class 'tarfile.TarFile' func1 False import binascii data = open(tar,'rb').read() binascii.crc32(data) 1270541744 import hashlib m=hashlib.md5() m.update(data) m.hexdigest() '2763563634899e9d1447731ed465f6a5 Do GCC version may affect in any way ?? Thanks for the reply -- Thanks Regards V.Murugadoss On Fri, Jun 4, 2010 at 7:55 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 4:15 PM, murugadoss murugadoss2...@gmail.com wrote: Thank for the reply. The tar file is not corrupted, i am using the same file in 32-bit m/c and able to extract it. I have attached this output also with the mail. I am getting this problem only in 64-bit m/c. And what is this whole exercise aimed at ? Why are you trying to open a tar file using Python first in a 32-bit and then on a 64-bit machine ? Can we have some background ? Otherwise this looks like a pretty weird exercise to me. Tar files are platform agnostic. Otherwise, you would have a nightmare opening tar files downloaded from the internet. A tar file created in 32 bit Linux should open in 64 bit Linux and vice-verza. Most probably the file got corrupted when you copied (or downloaded ?) it to the 32 bit machine. Try this on ur machines - they should print the same value. import binascii data = open(tar, 'rb').read() binascii.crc32(data) Also, try an md5 checksum. import hashlib m=hashlib.md5() m.update(data) m.hexdigest() '5b603d8b5dbf6004d802efc4dedac68c' -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
I enjoy it quite a bit. The whole ode thing I've prepared for the pycon in Singapore is an attempt. With the libraries available, independant games are more feasible than ever. On 6/4/10, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 4:15 PM, Kenneth Gonsalves law...@au-kbc.org wrote: On Friday 04 June 2010 15:52:16 Shiv Shankar wrote: This changes things. What kind of app are you trying to make? War game, every one writes their own strategies to derive movement based on a intercommunication between objects. Objects are bots and one teams bot kills the others. Still in the drawing board. strange - this is what I am doing! Wow - is game programming so popular now a days ? I never tried it myself. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
On Fri, Jun 4, 2010 at 4:55 PM, murugadoss murugadoss2...@gmail.com wrote: [..] Initially the program is written in the 32-bit linux pc. It is completely working here. Today, i loaded the same program in the server pc (which is a 64-bit x86 pc), i end up with issue. [..] This is weird. Can you manually untar your file? Does your Python program have sufficient privileges to read the file? I see that it's in /root -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
On Fri, Jun 4, 2010 at 5:44 PM, Noufal Ibrahim nou...@gmail.com wrote: On Fri, Jun 4, 2010 at 4:55 PM, murugadoss murugadoss2...@gmail.com wrote: [..] Initially the program is written in the 32-bit linux pc. It is completely working here. Today, i loaded the same program in the server pc (which is a 64-bit x86 pc), i end up with issue. [..] This is weird. Can you manually untar your file? Does your Python program have sufficient privileges to read the file? I see that it's in /root Well, that is getting to the raw basics. If it turns out to be that you didn't have permission to read the file in the first place..., nothing more to say - you managed to waste the time of whoever replied to this thread. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
On Fri, Jun 4, 2010 at 6:16 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Jun 4, 2010 at 5:44 PM, Noufal Ibrahim nou...@gmail.com wrote: On Fri, Jun 4, 2010 at 4:55 PM, murugadoss murugadoss2...@gmail.com wrote: [..] Initially the program is written in the 32-bit linux pc. It is completely working here. Today, i loaded the same program in the server pc (which is a 64-bit x86 pc), i end up with issue. [..] This is weird. Can you manually untar your file? Does your Python program have sufficient privileges to read the file? I see that it's in /root At least that doesn't seem to be the case. I simulated that condition, and here is the result. import tarfile tarfile.open('/root/test.tar.gz', 'r:*') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.5/tarfile.py, line 1139, in open return func(name, r, fileobj) File /usr/lib64/python2.5/tarfile.py, line 1200, in gzopen fileobj = file(name, mode + b) IOError: [Errno 13] Permission denied: '/root/test.tar.gz' So that raises a different error not ReadError. Well, that is getting to the raw basics. If it turns out to be that you didn't have permission to read the file in the first place..., nothing more to say - you managed to waste the time of whoever replied to this thread. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] ReadError: opening tar file
I doubt it whether V.Murugadoss has file itself correct? Is he able to extract the file with other compression program. On Fri, Jun 4, 2010 at 6:21 PM, Noufal Ibrahim nou...@gmail.com wrote: On Fri, Jun 4, 2010 at 6:16 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: [..] Well, that is getting to the raw basics. If it turns out to be that you didn't have permission to read the file in the first place..., nothing more to say - you managed to waste the time of whoever replied to this thread. Unlikely. I just tried is_tarfile'ing a valid tarball with 000 permissions and it throws an IOError (which makes more sense as well). -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Praveen Kumar +91 9620621342 http://praveensunsetpoint.wordpress.com Bangalore ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
Wow - is game programming so popular now a days ? I never tried it myself. When has game programing lost its popularity ? The whole ode thing I've prepared for the pycon in Singapore is an attempt. What was it ? ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 6:49 PM, Shiv Shankar fsla...@gmail.com wrote: The whole ode thing I've prepared for the pycon in Singapore is an attempt. http://github.com/nibrahim/Devious-machinations Let me see how well it's received. If it's good, I'll present it here at the local BangPypers meetings if there's sufficient interest. It's a simple game that ties up a physics engine (ODE) and a graphics library (PyGame). A clone of the famous TIM (http://en.wikipedia.org/wiki/The_Incredible_Machine) -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
On Fri, Jun 4, 2010 at 5:22 PM, Noufal Ibrahim nou...@gmail.com wrote: On Fri, Jun 4, 2010 at 6:49 PM, Shiv Shankar fsla...@gmail.com wrote: The whole ode thing I've prepared for the pycon in Singapore is an attempt. http://github.com/nibrahim/Devious-machinations Let me see how well it's received. If it's good, I'll present it here at the local BangPypers meetings if there's sufficient interest. It's a simple game that ties up a physics engine (ODE) and a graphics library (PyGame). A clone of the famous TIM (http://en.wikipedia.org/wiki/The_Incredible_Machine) -- ~noufal http://nibrahim.net.in _ I would love to see that . besides there is one more game engine called panda3D http://www.panda3d.org/ built by carniege mellon univ students , i liked it . __ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] 2D plotting libraries.
http://github.com/nibrahim/Devious-machinations Let me see how well it's received. If it's good, I'll present it here at the local BangPypers meetings if there's sufficient interest. It's a simple game that ties up a physics engine (ODE) and a graphics library (PyGame). A clone of the famous TIM Nice. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers