Re: How can I refresh the windows desktop using the python script?
[EMAIL PROTECTED] writes: > Hi Everybody > > > Here i have a query for you, that is > > How can I refresh the windows desktop using the python script? > > Thanks in advance for having given a thought on my query. > > Regards > yogi > SPI_SETDESKWALLPAPER = 20 ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "", 0) -- Dieter Deyke mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Vs lbh pna ernq guvf, lbh unir jnl gbb zhpu gvzr. -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing Yahoo Mail withtout POP
"T" <[EMAIL PROTECTED]> writes: > Is there a way to access yahoo mail via its web interface? If so, can > someone give some pointers? This works for me: http://www.ypopsemail.com/ -- Dieter Deyke mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Vs lbh pna ernq guvf, lbh unir jnl gbb zhpu gvzr. -- http://mail.python.org/mailman/listinfo/python-list
Re: Text to MP3 using pyTTS - Non-programmer question
[EMAIL PROTECTED] writes: > I'm not a programmer, but I'd like to make a program that will open and > read a txt file and output to a mp3 file. I don't need to ever hear the > voice, but I'd like the program to direct > > I've been google'ing around and have found a few tutorials about > converting pdfs to mp3 and converting typed text (in the source file) > to wave, but I'm looking for the ability to directly convert from txt > to mp3/ogg/wma. > > Currently I'm running on WinXP, but I also have access to a Linux box. > > Any help would be appreciated. I have written a script to convert .pdf to .wma, which may get you started: #! /usr/bin/env python # -*- coding: iso-latin-1 -*- import os import sys basename, suffix = os.path.splitext(sys.argv[1]) suffix = suffix.lower() pdfname = basename + ".pdf" txtname = basename + ".txt" wavname = basename + ".wav" # pdf --> txt if suffix == ".pdf": os.system('pdftotext "%s"' % (pdfname, )) suffix = ".txt" # txt --> wav if suffix == ".txt": import re data = open(txtname).read() data = data.replace(". . .", "") data = data.replace("<", "") data = data.replace(">", "") data = data.replace("Mr.", "Mister") data = data.replace("«", '"') data = data.replace("»", '"') data = data.replace(',,', '"') data = re.sub("\\d+\\s*", "", data) data = re.sub("\n\\s*\\d+\\.*\\s*\n", "\n", data) data = re.sub("\n\\s*\n\\s*\n", "\n\n", data) data = re.sub("-([a-z])", "\\1", data) open(txtname, "w").write(data) import pyTTS tts = pyTTS.Create() tts.SetRate(0) tts.Volume = 100 tts.SetVoiceByName("ATT-DT-14-Klara16") tts.SpeakToWave(wavname, data) suffix = ".wav" # split, wav --> mp3/ogg/wma if suffix == ".wav": import wave os.mkdir(basename) fi = wave.open(wavname, "r") nchannels, sampwidth, framerate, nframes, comptype, compname = fi.getparams() n = 0 while 1: n += 1 data = fi.readframes(600 * framerate) if not data: break fo = wave.open("tmp.wav", "w") fo.setparams((nchannels, sampwidth, framerate, 0, comptype, compname)) fo.writeframes(data) fo.close() # os.system('lame -m m --cbr -b 32 -q 0 -S tmp.wav "%s\\%02d.mp3" "%s"' % (basename, n)) # os.system('oggenc -q -1 -o "%s\\%02d.ogg" tmp.wav' % (basename, n)) os.system('cscript WMCmd.vbs -profile a20_1 -input tmp.wav -output "%s\\%02d.wma' % (basename, n)) fi.close() os.remove("tmp.wav") os.remove(wavname) ### This is just too big to keep around -- Dieter Deyke mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Vs lbh pna ernq guvf, lbh unir jnl gbb zhpu gvzr. -- http://mail.python.org/mailman/listinfo/python-list
Re: web-based SSH
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Astan Chee <[EMAIL PROTECTED]> writes: >> I was looking for a web-based SSH client (something like >> www.port42.com..but for some reason it doesnt work..can anyone verify > > http://www.google.com/search?q=ssh+applet http://www.appgate.com/products/80_MindTerm/110_MindTerm_Download/ -- Dieter Deyke mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Vs lbh pna ernq guvf, lbh unir jnl gbb zhpu gvzr. -- http://mail.python.org/mailman/listinfo/python-list
Re: Hardlinks on NTFS
Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > Hi :) > > I'm thinking of letting my program create hardlinks (or symlinks). I > know python allows doing this for ext, reiser and the like, but > apparently not for ntfs systems. > Is there any package out there that lets me create links in a platform > independent way? > > bye > wildemar This is my solution: import os def CreateHardLink(src, dst): import ctypes if not ctypes.windll.kernel32.CreateHardLinkA(dst, src, 0): raise OSError os.link = CreateHardLink -- Dieter Deyke mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Vs lbh pna ernq guvf, lbh unir jnl gbb zhpu gvzr. -- http://mail.python.org/mailman/listinfo/python-list
Re: pdf to text
tubby writes: > David Boddie wrote: > >> The pdftotext tool may do what you want: >> >> http://www.foolabs.com/xpdf/download.html >> >> Let us know how you get on with it. >> >> David > > Perhaps I'm just using pdftotext wrong? Here's how I was using it: > > f = filename > > try: > sout = os.popen('pdftotext "%s" - ' %f) > data = sout.read().strip() > print data > sout.close() > > except Exception, e: > print e I am using pdftotext on Windows with cygwin on a regular basis without any problem. Your program above should read: sout = os.popen('pdftotext "%s" - ' % (f,)) -- Dieter Deyke A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? -- http://mail.python.org/mailman/listinfo/python-list
Re: Code works in current dir only?
Paxton Sanders <[EMAIL PROTECTED]> writes: > Does anyone know why the following code successfully labels (with [f|d|?]) > entries in the current directory, but not in any other > directory? (All other directories' entries print [?].) > > I'm using Python 2.5.1 on Cygwin. > > Thanks! > > import os > > # collect all files and their paths > def collectinfo(path): > files = os.listdir(path) > files.sort() > for n in files: n = os.path.join(path, n) ### <== you need this > if os.path.isdir(n): > print "[d]", n > elif os.path.isfile(n): > print "[f]", n > else: > print "[?]", n > > # this works > if __name__ == "__main__": > collectinfo(".") > > # this does not work, always labels with [?] > #if __name__ == "__main__": > #collectinfo("/") -- Dieter Deyke -- http://mail.python.org/mailman/listinfo/python-list