Re: Movie (MPAA) ratings and Python?

2013-12-09 Thread Paul Scott
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/12/2013 08:40, Ben Finney wrote:
 Dan Stromberg drsali...@gmail.com writes:
 
 Is anyone using a module or database that gives Python 3.x access
 to MPAA ratings (EG G, PG, PG-13, etc.)?

If you are already using IMDB you should have a look at
http://imdbpy.sourceforge.net/downloads.html as well. It provides a
relatively simple Python interface to either a local or hosted IMDB
dataset and allows you to grab the MPAA rating directly from the
canonical movie name.

- -- Paul

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSprk1AAoJEP7GEwhwShZxOpgIAIMYG9QRo0XHe5InJejMh0tX
rLAkDL/2oSTQ3/nYNId5EJhDAF4GFu7LYgy4e3HIIWjIPw8UM64FFdFY/3d2t2hQ
jiWSNCoj8E+5m25m8Ob3oBcv+/bQRKsXuD+DvmGhoSvwnDaNqpYmiPBRyHgKp3tm
FoKJCkmgJoMX6KWCauBuVnoRSZGO0os3fZ0t/LpUHXjeZw5xLtvLm5aNqq9vWVin
V0nLZO7DPzN9hBQU6MAkdE6d6C3a/MbIU0s/fgCRJ9bB2SpQc55ewnZxWZLstgAh
WLUPQyY06d6iv5NM7N9Adehs4xxRj3jCIw54Wl8Vhk3h1UeJygxzN1C7HfI2URY=
=2jod
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Paul Scott

On 10/07/2013 14:22, Chris Angelico wrote:
Either that or it's funny only to other Australians. ChrisA 


As a South African, I found it funny too, but then again, we often get 
confused.


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


Re: opening a file

2011-06-20 Thread Paul Scott
On Mon, 2011-06-20 at 08:14 +0200, Florencio Cano wrote:
  This works:
  infile=open('/foo/bar/prog/py_modules/this_is_a_test','r')
 
  This doesn't:
  infile=open('~/prog/py_modules/this_is_a_test','r')
 
  Can't I work with files using Unix expressions?
 
 You can use the glob module:
 http://docs.python.org/library/glob.html#module-glob

Regardless of the module that you use, you should also be using
os.path.join() to create paths. I never rely on hard coded paths
(especially since most of my code needs to run on multiple OS). In the
above example, you can easily put together a fairly complex path as
well, using os.path.join('foo', 'bar', 'prog', 'py_modules', ... ) which
will take care of what you need.

Not sure about regular python, but certainly in the wx GUI toolkit,
there is a wx.StandardPaths.Get() function which will get the user's
home or standard path where you can store all sorts of config data etc
in a hidden directory as well.

-- 
-- Paul

http://www.paulscott.za.net
http://twitter.com/paulscott56
http://www.chisimba.com


signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I intentionally crash my lappy?

2010-12-20 Thread Paul Scott

On 20/12/2010 10:45, mechtheist wrote:
 I am no programmer, but know the rudiments [the rudi'est of rudiments]
 of working with Python.  I have a simple need,  to have a simple
 script/app I can run that will crash my PC.  On my desktops, I can
 always hit the reset, but that is not an option with my laptop.  Can
 anyone tell me of an easy way to guarantee a program will instantly
 kill/BSOD my windows7/64bit laptop?

You could try a forkbomb and execute that via a system call. Not sure
why anyone would want to do such a thing, but there you go...

-- 
-- Paul

http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za
All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any idea to emulate tail -f

2009-05-05 Thread Paul Scott
On Mon, 2009-05-04 at 23:50 -0700, CTO wrote:
 You might want to try http://pyinotify.sourceforge.net/. Works well on
 Linux systems. Otherwise, I'd watch the mtime on the file and fork to
 handle the change.
 

pyinotify works really well. If you need to watch a file, simply use the
IN_MODIFY watch to fire off a notification when the file changes. Then
you can use that event in anything you may need.

I put up some basic pyinotify usage here:
http://www.paulscott.za.net/index.php?module=jabberblogpostid=ps123_2560_1240747637action=viewsingle
 but if you need some more help with it, read the docs and then ask me also

-- Paul
http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za
-- 

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


Re: Convert Word .doc to Acrobat .pdf files

2008-06-06 Thread Paul Scott

On Fri, 2008-06-06 at 16:22 +0530, Dinil Karun wrote:
 hi,
 
 I am using the below code but i am getting a error saying pyUno module
 not found.
 can u please help.

I just wrote the same thing!

Take a look at http://cvs2.uwc.ac.za/trac/python_tools/browser/oooconv

It should do what you want (and a little more).

Sorry, the code quality is pretty bad, but I am in the process of
cleaning it up still.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
--
http://mail.python.org/mailman/listinfo/python-list

Nested os.path.join()'s

2008-05-05 Thread Paul Scott

Today, I needed to concatenate a bunch of directory paths and files
together based on user input to create file paths. I achieved this
through nested os.path.join()'s which I am unsure if this is a good
thing or not.

example:

if os.path.exists(os.path.join(basedir,picdir)) == True :
blah blah

Question is, is there a better way of doing this? The above *works* but
it looks kinda hackish...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
--
http://mail.python.org/mailman/listinfo/python-list

Re: Nested os.path.join()'s

2008-05-05 Thread Paul Scott

On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote:
 example:
 
 if os.path.exists(os.path.join(basedir,picdir)) == True :
 blah blah
 

Sorry, pasted the wrong example...

Better example:

 pics =  glob.glob(os.path.join(os.path.join(basedir,picdir),'*'))


 Question is, is there a better way of doing this? The above *works* but
 it looks kinda hackish...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
--
http://mail.python.org/mailman/listinfo/python-list

Re: Nested os.path.join()'s

2008-05-05 Thread Paul Scott

On Mon, 2008-05-05 at 10:34 -0400, Jean-Paul Calderone wrote:
 How about not nesting the calls?
 
  from os.path import join
  join(join('x', 'y'), 'z') == join('x', 'y', 'z')
 True
 
 

Great! Thanks. Didn't realise that you could do that... :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
--
http://mail.python.org/mailman/listinfo/python-list

Re: Is massive spam coming from me on python lists?

2008-04-21 Thread Paul Scott

On Mon, 2008-04-21 at 02:01 -0400, Brian Vanderburg II wrote:
 I've recently gotten more than too many spam messages and all say 
 Sender: [EMAIL PROTECTED]  I'm wondering 
 if my mail list registration is now being used to spam myself and 
 others.  If so, sorry, but I'm not the one sending messages if other are 
 getting them even though Sender seems to include my address (I'm not 
 sure about mail headers so I don't know how From: is different than 
 Sender:)  Anyway, it seems to be a bunch of spam emails about cracks and 
 stuff.

I think all of the spam is coming from Google Groups.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: a name error

2008-04-15 Thread Paul Scott

On Tue, 2008-04-15 at 13:54 +0800, Penny Y. wrote:
 import urllib2,sys
 try:
 r=urllib2.urlopen(http://un-know-n.com/;)
 except URLError,e:
 print str(e)
 sys.exit(1)
 
 print r.info()
 
 
 But got the errors:
 
 Traceback (most recent call last):
   File t1.py, line 4, in ?
 except URLError,e:
 NameError: name 'URLError' is not defined
 
 
 Why these is not the name of URLError? I saw it on this module's page:

You need to define the urllib first.

url=urllib2
try:
r=urllib2.urlopen(http://un-know-n.com/;)
except url.URLError,e:
print str(e)
sys.exit(1)

print r.info()

You can't just launch into a catchable exception without first defining
something.

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Brand New!

2008-04-15 Thread Paul Scott

On Wed, 2008-04-16 at 02:35 -0300, Gabriel Genellina wrote:
 I'm unsure if teaching Javascript, VBScript and Python at the same time is  
 a good thing, I'd think one would get a language soup and mix all the  
 concepts, but if it works for you, go ahead.
 For other resources, see the beginners section in the Python wiki:  
 http://wiki.python.org/moin/BeginnersGuide

Well, as an example, I learnt Python to a decent level of competency in
2 days. I looked through the Dive into Python tuts, and then had a look
at the Python GUI FAQ (Which didn't really help much, as I started with
a GTK based GUI app). A little bit of Googling and a couple of questions
to this list gave me everything that I needed to roll out a pretty
decent application in 5 days. Oh, and just by the way, I am _not_ a
Computer Scientist or anything, I am a botanist, which means that if I
can do that, just about anyone that can read can do it.

Python has been long on my list of TODO's, and now, finally, it is
there. I have immensely enjoyed it so far, and will continue to tinker
well into the future.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: First Python project - comments welcome!

2008-04-08 Thread Paul Scott

On Mon, 2008-04-07 at 06:20 -0700, [EMAIL PROTECTED] wrote:
  If anyone on this list is willing/able, please do give me a few
  pointers, even if it is This is total crap - RTFM and come back when
  you are ready I would really appreciate it!
 
 Ok, since you asked for it:
 

Awesome feedback! Thank you very much. This is exactly what I needed.

I will take this into the code as soon as I have some time to play with
it again and fix it up.

Much appreciated!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

First Python project - comments welcome!

2008-04-07 Thread Paul Scott

I have started, and made some progress (OK it works, but needs some
love) on my first real Python application.

http://cvs2.uwc.ac.za/trac/python_tools/browser/podder

I would love some feedback on what I have done. In total this has taken
me 5 nights to do (I am working on it at night as PHP, not Python, is my
day job), so it can probably do with *lots* of improvement. All code is
GPL.

If anyone on this list is willing/able, please do give me a few
pointers, even if it is This is total crap - RTFM and come back when
you are ready I would really appreciate it!

Many thanks, and thank you to this community for helping me through the
initial bumps of getting into Python - a great dev tool IMHO!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: First Python project - comments welcome!

2008-04-07 Thread Paul Scott

On Mon, 2008-04-07 at 07:05 -0400, Steve Holden wrote:
 
 The code looks pretty good to someone that doesn't know Gtk graphics.
 

Err, neither do I, so I guess that means its OK? :)

 184: self.wTree2=gtk.glade.XML(globaldir+podder.glade,serverdialogue)
 
 could really do with using os.path.join() if you want to be easily 
 cross-platform. Similarly the other places you use globaldir+
 

Ah, OK, will take that into cognisance. Main use of the application will
be on Ubuntu based laptops in lecture theatres, so I am not overly
concerned, however, in the interests of writing better code, and maybe
even making it useful to others outside of my project, I will try and
fix it up.

 At line 321 you loop while True over a Queue.Queue object until the 
 QueueEmpty exception is raised, then break out of the loop. It would be 
 easier to loop while not queue.empty(). I know the docs say that this 
 function is not reliable due to multi-threading semantics, but I doubt 
 it will make your program less responsive.
 

That class is not yet even implemented. I put that code in there to do
an upload progress bar for the XML-RPC call, but can't yet figure out
how to do it properly. That being said, I will take your notes into
consideration when I get to it. Thanks!

 You even put docstrings on your code. WEll done, you are going to enjoy 
 Python.

Force of habit. :)

Thanks very much for your comments, I *really* appreciate it!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: First Python project - comments welcome!

2008-04-07 Thread Paul Scott

On Mon, 2008-04-07 at 09:56 -0700, Lie wrote:
 I don't know if it was just me, but I can't just scan through your
 code briefly to know what it is about (as is with any non-trivial
 codes), only after looking through the website's Roadmap I realized
 it's something to do with audio and recording. Perhaps you should add
 a short module-level docstring that explains in a brief what the code
 is about, somewhat like an abstract.
 

Sure, will add that. It is a simple GUI based audio (and later video)
recorder that a user can record a audio stream from line in (mic) and
create an ogg vorbis file from it. It then allows the user to upload the
ogg file to a Chisimba (PHP5 - my day job) based server to be consumed
automagically as a podcast. The file is tagged and converted to MP3
server side and added to the Chisimba podcast module. It is really for
use in lecture halls so that lecturers can upload their audio files as
podcasts for the students to listen to almost immediately afterwards.

 And second, it's just my personal preference, but I usually like to
 separate between GUI codes (codes that handle GUI events) and working
 code (the real worker). 

Couldn't agree more! MVC architecture is how I do all of my code.
Unfortunately, this was my first stab at

1. Python
2. GUI applications
3. Audio apps

so I will need some more help in doing that (i.e. ramping up my skills
or getting someone that knows what they are doing onto the project to
help out).

Thanks for the feedback though, I will improve in time... :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Beginner advice

2008-03-31 Thread Paul Scott

On Mon, 2008-03-31 at 06:45 +, Marc 'BlackJack' Rintsch wrote:
 There is an `xmlrpclib` in the standard library, so there is no need for
 an external package here.  I even think that pyXMLRPClib is the one that's
 integrated in the standard library, so the external one might be dead.
 

Ah, yes it is indeed. Thanks.

 For Windows there are tools to bundle your source and all dependencies and
 even the interpreter itself.  `py2exe` is such a tool.  With InnoSetup or
 NSIS or similar programs you can then make a `setup.exe` for that spoiled
 Windows brats.  :-)
 
 Under Linux many packages are available as distribution specific packages
 on most distributions.  So for Linux you may get away with a README
 stating the dependencies of your program and a `setup.py` for installing
 your project.  Look for `distutils` in the Python documentation for
 further information about `setup.py`\s.

setup.py sounds like the best way to go. Most of the classrooms and
lecture halls run on Ubuntu machines, and as I said, I don't really care
much for the Windows brats anyway. 'doze installers etc would be a nice
to have, but not needed right now.
 
  5. Editor - I am using Eric (which I quite like), any advice on IDE's?
 
 Use the one you like best.  ;-)
 
Thought as much. I do 90% of my coding in vi anyways, but am still
getting a couple of nutty errors from Python simply because I have not
yet gotten the hang of significant whitespace :) Darn that PHP!


Thanks for the feedback, now I just need some justification on the
GTK/GUI stuff - wxWidgets, GTK+ Glade or other?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Beginner advice

2008-03-31 Thread Paul Scott

On Mon, 2008-03-31 at 04:02 -0700, Graham Ashton wrote:
 pyGTK is great. I used it quite heavily a year or so ago. GTK is a
 nice tool kit from the user's perspective too; you can make some
 rather attractive and usable applications with it, and the GUI builder
 is a boon. Obviously it integrates slightly better into it's native
 platform than it does Mac/Windows, but if you're targetting Ubuntu
 users then it's a great choice.

OK, this is almost exactly what I needed. All that I really want to know
is can I do this in a really easy, comfortable tool like GTK and get
away with it without someone 3 months down the line saying something
like: Dude, what were you *thinking* using deprecated stuff like that?

Sorry, but I had to ask, and I am sure that I will ask a lot more
questions as things move along. 

I really appreciate all the feedback so far! It is often quite difficult
sifting through all the years worth of blogs, docs and other resources
when starting on something new like this, so bear with me, and I will
try and make a more meaningful contribution back to Python as soon as I
can!

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Command line input

2008-03-31 Thread Paul Scott

On Mon, 2008-03-31 at 12:39 -0700, [EMAIL PROTECTED] wrote:
 How do I receive input from the command line in Python?

I have used:

sys.argv[ 1 ]

I have been doing Python for around 2 days now, so please do double check that!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list

Beginner advice

2008-03-30 Thread Paul Scott

I have been tasked to come up with an audio recorder desktop (cross
platform if possible - but linux only is OK) that:

1. records a lecture as an MP3 file (pymedia?)
2. Provides a login form for server credentials
3. Uploads via XMLRPC (pyxmlrpclib) to the server as a podcast

I have been working on this (having never really worked with Python
before) for the past 24 hours or so, and would just like to get some
feedback on the direction that I am taking if possible.

1. Is pymedia an active project? Should I use something else?

2. GUI design - I am using glade designer and pyGTK. Good choice?

3. pyXMLRPClib - active? Something better?

4. I see that there are literally thousands of somewhat external looking
libraries for python, I presume that there is some way of bundling all
the deps into a single source and then compiling? or otherwise packaging
them all (this software will be for academia, so difficult installs are
out!)

5. Editor - I am using Eric (which I quite like), any advice on IDE's?

Any help would be massively appreciated! Python looks like a *really*
easy and powerful language (hey, I managed to do a desktop application
in a few hours and I am a botanist!) and I would like to do a lot more
with it. I have a PHP background (taught myself that also) so C syntax
is almost like my native tongue :) but Python syntax seems just as easy,
if not easier!

I am still going through Mark Pilgrims' tutorials (dive into ones) and
am slowly getting the hang of things, so if these questions seem inane,
please do excuse me and feel free to tell me to RTFM!

Thanks

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
-- 
http://mail.python.org/mailman/listinfo/python-list