piping with subprocess

2014-02-01 Thread Rick Dooling
I spent half a day trying to convert this bash script (on Mac) textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 into Python using subprocess pipes. It works if I save the above into a shell script called convert.sh and then do subprocess.check_call(["convert.sh", file, markd

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > Rick Dooling wrote: > > > > > I spent half a day trying to convert this bash script (on Mac) > > > > > > textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 > > &g

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > Rick Dooling wrote: > > > > > > > > > > > > > I spent ha

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 8:00:59 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > > > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > > Rick Dooling wrote: > > > > > I spent

checking whether a string is text or binary

2014-10-28 Thread Rick Dooling
I'm an English major who hacks scripts together to do things as needed. I used this code from the Python Cookbook for years. https://www.safaribooksonline.com/library/view/python-cookbook-2nd/0596007973/ch01s12.html Especially when I need to convert old WPD files to markdown, some of which don'

Re: Python on a MacBook Pro (not my machine)

2013-10-28 Thread Rick Dooling
Just upgraded to Mavericks, the new OS X, Python is: Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> (On Mountain Lion, it was 2.7.2. You can install Python

Any other screenwriters?

2013-03-08 Thread Rick Dooling
errors in Mac OS X; some Ruby ones and some Prince ones) and convert it to Python so I can fix it myself, because I don't know Ruby at all, and would rather work in Python. https://github.com/olivertaylor/Textplay Any pointers? Thanks a bunch, Rick Dooling -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a user file in Python

2007-12-01 Thread Rick Dooling
On Dec 1, 1:42 am, waltbrad <[EMAIL PROTECTED]> wrote: > Hello. I'm brand new to Python. > > Where on my system do I have to place these files before the > interpreter will import them? > In this case, odbchelper.py is a module you are trying to import. http://docs.python.org/tut/node8.html One

Re: python 2.5 - f=open('a_file.txt','w') gives [Errno 2]

2007-12-03 Thread Rick Dooling
On Dec 3, 7:47 am, dirkheld <[EMAIL PROTECTED]> wrote: > IOError: [Errno 2] No such file or directory: 'a_file.txt' I sometimes see that error on Linux when trying to run a script with DOS line endings. Is it an imported file? I don't know Macs, but start by making sure both your script and the f

Re: python 2.5 - f=open('a_file.txt','w') gives [Errno 2]

2007-12-05 Thread Rick Dooling
> Sorry for keeping you guys busy with such a mistake ;) No apologies necessary, especially since you reported the final outcome. Now anybody searching on that message will find a complete thread and a lesson learned. rick -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie

2007-12-10 Thread Rick Dooling
On Dec 10, 8:03 pm, "Whizzer" <[EMAIL PROTECTED]> wrote: > Is OReilly's Learning Python a good place to start learning to program? > I've been told Python is a good first language. > > Thanks for the advice. If you already have Python installed,just go to the bottom of this article and check the v

Re: finding dir of main .py file

2007-12-11 Thread Rick Dooling
On Dec 11, 10:08 am, "ron.longo" <[EMAIL PROTECTED]> wrote: > Is there any way that I can find the path of the main .py file of my > application? > > For example, I have an application with some resources which are in a > subdirectory: > > myPythonApp.py > /resources > image1 >

Re: re.sub() problem (regular expression)

2007-12-13 Thread Rick Dooling
On Dec 13, 9:00 pm, Davy <[EMAIL PROTECTED]> wrote: > > What's "\1" and the whole re.sub() mean? > Read about backreferences here: http://www.regular-expressions.info/brackets.html Also see the entry on parentheses here: http://docs.python.org/lib/re-syntax.html rick -- http://mail.python.or

Re: listdir() with mask

2007-12-14 Thread Rick Dooling
On Dec 14, 1:56 am, "Vladimir Rusinov" <[EMAIL PROTECTED]> wrote: glob or fnmatch http://docs.python.org/lib/module-glob.html rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie observations

2007-12-18 Thread Rick Dooling
On Dec 18, 2:14 pm, [EMAIL PROTECTED] wrote: > But where? Look it up in the function reference. OK, > where's the function reference? A line of code that you'd type in a > second is a ten-minute search. Thank God for google. Maybe this will help: http://rgruet.free.fr/PQR25/PQR2.5.html But sinc

Re: Newbie question - what's the term for input/output to a web page?

2007-12-21 Thread Rick Dooling
On Dec 21, 7:03 pm, Rachel Garrett <[EMAIL PROTECTED]> wrote: > I'd like to write a simple application that will accept input from the > user, go out to a particular web page, and submit the user's input to > the website. The results that are displayed by the web page should > then be sent back to

Re: Open source English dictionary to use programmatically w/ python

2008-01-07 Thread Rick Dooling
On Jan 7, 4:37 pm, dgoldsmith_89 <[EMAIL PROTECTED]> wrote: > Can anyone point me to a downloadable open source English dictionary > suitable for programmatic use with python: I'm programming a puzzle > generator, and I need to be able to generate more or less complete > lists of English words, alp

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Rick Dooling
On Jan 29, 10:39 am, kj <[EMAIL PROTECTED]> wrote: > I'd written a Perl module to facilitate the writing of scripts. > It contained all my boilerplate code for parsing and validating > command-line options, generating of accessor functions for these > options, printing of the help message and of t

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread Rick Dooling
On Mar 12, 11:22 am, mrstephengross <[EMAIL PROTECTED]> wrote: > Hi all. I've got a python file called 'foo' (no extension). I want to > be able to load it as a module, like so: > > m = __import__('foo') > > However, the interpreter tells me "No module named foo". If I rename > it foo.py, I can i

Re: Running a python program as main...

2008-03-26 Thread Rick Dooling
On Mar 26, 9:12 am, waltbrad <[EMAIL PROTECTED]> wrote: > On his command line he types: > > C:\...\PP3E>Launcher.py > > and this begins the program. Doesn't work for me. I have to type: > > C:\...\PP3E>python Launcher.py > > Is this a typo on his part or has he configured his settings in such a >

Re: Data Coding suggestions

2009-02-27 Thread Rick Dooling
On Feb 27, 6:42 am, "steven.oldner" wrote: > Just learning Python and have a project to create a weekly menu and a > shopping list from the menu.   > Question:  How should I set up the data?  I'm looking at maybe 70 menu > items and maybe 1000 items for the shopping list.  I need to be able > to

Re: Install Python MySQL db module?

2008-05-13 Thread Rick Dooling
On May 13, 7:29 pm, Con <[EMAIL PROTECTED]> wrote: > Hi, how does properly install the Python MySQL db module for Mac OS > X? I was only able to locate the Win32 modules. > > Thanks in advance, > > -Conrad I tried this a couple of weeks ago using macports and had problems. See, for example: htt

Re: Command line input

2008-03-31 Thread Rick Dooling
On Mar 31, 2:39 pm, [EMAIL PROTECTED] wrote: > How do I receive input from the command line in Python? As long as we are all guessing, do you perhaps mean raw_input? my_name = raw_input("What is your name? ") What is your name? Rick >>> my_name 'Rick' -- http://mail.python.org/mailman/listinfo

Re: Recursively Backup Directories

2008-04-05 Thread Rick Dooling
On Apr 5, 6:56 pm, [EMAIL PROTECTED] wrote: > What I would like to do > is recursively backup the specified directories . . . > but be able to specify exclusion directories (which copytree does > not appear to allow you to do). My initial thoughts were I'll > probably have to use os.path.walk for

new python docs

2008-09-03 Thread Rick Dooling
Wow! I've been away in other pursuits. The new docs are gorgeous and searchable. http://docs.python.org/dev/index.html Thank you, python.org. -- http://mail.python.org/mailman/listinfo/python-list

Re: Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-23 Thread Rick Dooling
No telling what Windows will do. :) I am a mere hobbyist programmer, but I think real programmers will tell you that it is a bad habit to use relative paths. Use absolute paths instead and remove all doubt. http://docs.python.org/library/os.path.html RD -- http://mail.python.org/mailman/listinf

Re: Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-23 Thread Rick Dooling
On Feb 23, 1:08 pm, Gib Bogle wrote: > It isn't useful to respond to a serious question with OS bigotry. Okay, I'll go with what Aahz said: > I've seen similar issues on Win7. > AFAIK, this has nothing to do with Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: help with Python installation

2010-02-27 Thread Rick Dooling
> Hi, > I have been trying to install python on my Win ME system Try this: http://tinyurl.com/w7wgp RD -- http://mail.python.org/mailman/listinfo/python-list