How to read Mozrepl Javascript result into a Python Variable?

2013-07-13 Thread goldtech
Hi, With Mozrepl addon in Firefox and Python I do: import telnetlib tn = telnetlib.Telnet(r'127.0.0.1', 4242, 5) tn.read_eager() '\nWelcome to MozRepl.\n\n - If you get stuck at the ' tn.read_until(repl ) ...snip... tn.write(r'alert(window.content.location.href)'+\n) and I get an alert box

Re: Read active tab URL from a browser with Python ?

2013-07-03 Thread goldtech
snip Another option might be to use Python in conjuction with AutoIt: http://www.pha.com.au/kb/index.php/Using_AutoIT_with_Python http://www.autoitscript.com/forum/topic/115293-how-to-get-firefox-current-page-address/ This is powerful, and seems like I can call Autoit from Python.

Read active tab URL from a browser with Python ?

2013-07-02 Thread goldtech
Hi, I've goggled this but haven't found a way (at least a way I understand) for a running Python script to get the current URL in a browser's location bar. Is there a way? I'm using Windows so maybe that would provide a way (or not). This isn't for a browser controlled/automated by Python that

How to tell Script to use pythonw.exe ?

2013-07-02 Thread goldtech
Hi, Using Windows I want to run a .py file script using pythonw.exe so the DOS box will not open. Is there a way from inside the script to say run me with pythonw.exe and not python.exe? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to tell Script to use pythonw.exe ?

2013-07-02 Thread goldtech
I just changed the file extension of the script file from .py to .pyw and it uses pythonw.exe. I didn't read it anywhere, just intuited it and tried it. Python has some very smart people working the language... -- http://mail.python.org/mailman/listinfo/python-list

How to install libxml2-devel and libxslt-devel in Windows ?

2012-11-10 Thread goldtech
Hi, I have Windows XP and Python 2.7.x I download and install libxml2-python-2.7.7.win32-py2.7.exe, From here: http://users.skynet.be/sbi/libxml-python/ This file has both libxml2 AND libxslt. But, I also need libxml2-devel and libxslt-devel for python 2.7. Are binaries for win32 available for

Help understanding an Object Oriented Program example

2012-10-28 Thread goldtech
Hi, Trying to learn Python OOP. An example from a book, may not be formated after sending post but: class Contact: all_contacts = [] def __init__(self, name, email): self.name = name self.email = email Contact.all_contacts.append(self) OK, no I do this: c =

Re: Python Script Works Locally But Not Remotely with SSH

2012-04-07 Thread goldtech
Thank you for the help. I guess I didn't understand what's really going on. I thought if I SSH even from a Linux to a Windows machine whatever I say on the SSH client command line would be the same as me doing a command on the DOS command-line in Windows. I incorrectly thought SSH is just a

Python Script Works Locally But Not Remotely with SSH

2012-04-02 Thread goldtech
Hi, I have a WinXP PC running an SSH server and I have a Linux PC with an SSH client and logged into the XP seemingly OK. It's all on my personal LAN, the connection seems OK. I have a py file on the XP that I run via SSH from the Linux, it's: import webbrowser

Re: Python Script Works Locally But Not Remotely with SSH

2012-04-02 Thread goldtech
Bump(?) -- http://mail.python.org/mailman/listinfo/python-list

from PyQt4 import QtWebKit ImportError: DLL load failed

2012-01-18 Thread goldtech
Hi, Using WinXP I installed PyQt from http://www.riverbankcomputing.co.uk/software/pyqt/download installation file: PyQt-Py2.7-x86-gpl-4.9-1 then tried: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more

python shell that saves history of typed in commands that will persist between reboots

2011-11-15 Thread goldtech
Hi, Using Windows. Is there a python shell that has a history of typed in commands? I don't need output of commands just what I typed it. I need it to save between sessions - something that no shell seems to do. If I reboot there will still be a command history somewhere. Like bash history in

Trying to write beautifulsoup result to a file and get error message

2011-11-13 Thread goldtech
If I try: ... soup = BeautifulSoup(ft3) f = open(r'c:\NewFolder\clean4.html', w) f.write(soup) f.close() I get error message: Traceback (most recent call last): File C:\Documents and Settings\user01\Desktop\py\tb1a.py, line 203, in module f.write(soup) TypeError: expected a character

Processing a large string

2011-08-11 Thread goldtech
Hi, Say I have a very big string with a pattern like: akakksssk3dhdhdhdbddb3dkdkdkddk3dmdmdmd3dkdkdkdk3asnsn. I want to split the sting into separate parts on the 3 and process each part separately. I might run into memory limitations if I use split and get a big array(?) I wondered if

Re: Strings show as brackets with a 'u'.

2011-07-27 Thread goldtech
Rick gave you some good advice, perhaps worth re-reading. What you need are investigative skills, and not just bits of data. Totally agree. beginning to see what's going on. I'm not specifically accessing the list element with n (vs. n[0]). Printing n uses repr which gives the unicode tag.

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread goldtech
Thank you. So what is happening? Is it that I'm in an environment that is not unicode and python is telling me the string (ie. n[0]) is unicode? (I'll do a hatchet-job on this subject if I ask anymore about unicode). Thanks to posters for their patience! --

Strings show as brackets with a 'u'.

2011-07-23 Thread goldtech
Hi, n [u'174'] Probably newbie question but not sure how suppress the brackets and the 'u' ? I assume pyhon is telling me it's a unicode string in the n variable. I'm using using Idle on winXP, activestate 2.7. Is there a way to suppress this and just show 174 in the shell ? A script

Image processing to auto adjust colors in python ?

2011-05-16 Thread goldtech
Hi, I'm processing thumbnails with python but one thing I need to do is to auto-adjust an image for the best colors. I am using ffmpeg to get thumbs three seconds into a video, sometimes the image is too dark. Normally I'd go into something like the windows program Irfan View and do Auto Adjust

Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread goldtech
Hi, Trying to learn how to run a linux command and get the stdout and stderr. I'm trying the following: cmd3 = r'ffmpeg -i /home/giga/Desktop/Guitar1.flv' p = Popen(cmd3, stdout=PIPE, stderr=PIPE) Traceback (most recent call last): File pyshell#73, line 1, in module p = Popen(cmd3,

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread goldtech
Read The Fine Manual:http://docs.python.org/library/subprocess.html#subprocess.Popen: snip... Try instead: cmd3 = ['ffmpeg', '-i', '/home/giga/Desktop/Guitar1.flv'] Cheers, Chris --http://blog.rebertia.com No doubt, I should RTFM...you're right! Yes, works like a charm now. Thanks

Can not uninstall activepython. Missing msi ?

2011-04-12 Thread goldtech
Hi, I want to uninstall Active Python 2.6.2.2 and upgrade. Certain things are not working and it's probably time to upgrade anyway. When I try to uninstall it says missing msi. Before I delete all the folders and clean the registry out is there something I can try to have a normal or more

import module doesn't work for new package

2010-12-03 Thread goldtech
I tried install a Python - would the word be package? - on Ubuntu 10.10. Could you tell me how to fix? I would be grateful, is it a path problem? Thanks. Lee gi...@giga1:~/Desktop/pykhtml-0.2$ sudo python setup.py install [sudo] password for giga1: running install running build running build_py

Python's equivalent to Main calling program and subprograms

2010-12-01 Thread goldtech
Hi, Could someone link me to info - I'm sure this is commonly done: Long ago with Fortran and Pascal there was a pattern used a lot. It was like: Start Main Global Var Subprogram1 Subprogram2 Subprogram3 End of Main End The global var was a var that all the subprograms could

SAX unicode and ascii parsing problem

2010-11-30 Thread goldtech
Hi, I'm trying to parse an xml file using SAX. About half-way through a file I get this error: Traceback (most recent call last): File C:\Python26\Lib\site-packages\pythonwin\pywin\framework \scriptutils.py, line 325, in RunScript exec codeObject in __main__.__dict__ File E:\sc\b2.py,

SAX unicode and ascii parsing problem

2010-11-30 Thread goldtech
Hi, I'm trying to parse an xml file using SAX. About half-way through a file I get this error: Traceback (most recent call last): File C:\Python26\Lib\site-packages\pythonwin\pywin\framework \scriptutils.py, line 325, in RunScript exec codeObject in __main__.__dict__ File E:\sc\b2.py,

Re: SAX unicode and ascii parsing problem

2010-11-30 Thread goldtech
snip... I'm just as stumped as I was when you first asked this question 13 minutes ago. ;-) regards  Steve snip... Hi Steve, Think I found it, for example: line = 'my big string' line.encode('ascii', 'ignore') I processed the problem strings during parsing with this and it works now.

regular expression help

2010-11-29 Thread goldtech
Hi, say: import re m=cccvlvlvlvnnnflfllffccclfnnnooo re.compile(r'ccc.*nnn') rtt=.sub(||,m) rtt '||ooo' The regex is eating up too much. What I want is every non-overlapping occurrence I think. so rtt would be: '||flfllff||ooo' just like findall acts but in this case I

Re: regular expression help

2010-11-29 Thread goldtech
.*? fixed it. Every occurrence of the pattern is now affected, which is what I want. Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list

list of regex special characters

2010-11-28 Thread goldtech
I am looking for a list of special character in python regular expressions that need to be escaped if you want their literal meaning. I searched and can not find the list. Any help appreciated. -- http://mail.python.org/mailman/listinfo/python-list

How to install uTidylib, easy_install problem

2010-11-22 Thread goldtech
I'm using activepython 2.6 on XP. I am trying to install uTidylib 0.2 with easy_install. I like uTidylib more vs. newer modules.and want to use it. I get output below. How do I install it? I do see it in http://pypi.python.org/simple/uTidylib/ Thanks. C:\Documents and Settings\user1easy_install

Installed modules from Synaptic in Ubuntu problem

2010-11-20 Thread goldtech
Hi, Using Ubuntu linux 9.04 and have python 2.6. I'm trying to add a module from the synaptic installer. It's µTidylib a wrapper for HTML Tidy. It installed with out a problem, when I do a $ help ('modules') I see a module called tidy. But when I do an import tidy in a script I get an error...

Re: assigning multi-line strings to variables

2010-04-29 Thread goldtech
Thank you to posters for help to my question. Seems I had trouble with triple quotes strings in the PythonWin shell. But using the Idle shell things work as expected. But this is probably another issue...any way, w/Idle's shell I got the action regarding multiline strings I expected. --

Python's regular expression help

2010-04-29 Thread goldtech
Hi, Trying to start out with simple things but apparently there's some basics I need help with. This works OK: import re p = re.compile('(ab*)(sss)') m = p.match( 'absss' ) m.group(0) 'absss' m.group(1) 'ab' m.group(2) 'sss' ... But two questions: How can I operate a regex on a string

Re: Python's regular expression help

2010-04-29 Thread goldtech
On Apr 29, 11:49 am, Tim Chase python.l...@tim.thechases.com wrote: On 04/29/2010 01:00 PM, goldtech wrote: Trying to start out with simple things but apparently there's some basics I need help with. This works OK: import re p = re.compile('(ab*)(sss)') m = p.match( 'absss' ) f

assigning multi-line strings to variables

2010-04-27 Thread goldtech
Hi, This is undoubtedly a newbie question. How doI assign variables multiline strings? If I try this i get what's cited below. Thanks. d=d d d Traceback (most recent call last): File interactive input, line 1, in module NameError: name 'd' is not defined --

Re: assigning multi-line strings to variables

2010-04-27 Thread goldtech
On Apr 27, 7:31 pm, Brendan Abel 007bren...@gmail.com wrote: On Apr 27, 7:20 pm, goldtech goldt...@worldpost.com wrote: Hi, This is undoubtedly a newbie question. How doI assign variables multiline strings? If I try this i get what's cited below. Thanks. d=d d d

Re: assigning multi-line strings to variables

2010-04-27 Thread goldtech
On Apr 27, 7:33 pm, MRAB pyt...@mrabarnett.plus.com wrote: goldtech wrote: Hi, This is undoubtedly a newbie question. How doI assign variables multiline strings? If I try this i get what's cited below. Thanks. d=d d d Traceback (most recent call last):   File interactive

Idle does not recognize PYTHONPATH

2009-08-22 Thread goldtech
Hi, Idle does not recognize PYTHONPATH set in .bashrc. Starting Python shell in the terminal sys.path shows the PYTHONPATH, but again not shown in IDLE. This is a common problem but I could not find a fix. Using Ubuntu 9.04. Python 2.6. Thanks --

Idle text wrap

2009-08-13 Thread goldtech
Hi, I'm using Idle interactive shell. Actually Idle-Spoon which has a few nice extensions and Python 2.6 on Linux. When I print str_value + \n Where str_value is for example a string of 120 chars. I notice that the lines seem to get hard wrapped at around 80. Is there a way I can config it to

Python and behavior

2009-08-13 Thread goldtech
Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and f ss 'f' ss=0 and f ss 0 -- http://mail.python.org/mailman/listinfo/python-list

Python base distribution come with a validating XML parser?

2008-07-25 Thread goldtech
Hi, Basic XML questions, I have a .xml file I want to validate against a .xsd file... Does the Python base distribution come with a validating XML parser? I want to make sure the elements in my xml file vs. the elements defined in my xsd are a match. I could parse both XML and xsd elements to

SAX XML Parse Python error message

2008-07-13 Thread goldtech
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me what the fix is. Thanks. Traceback (most recent call last): File

Re: SAX XML Parse Python error message

2008-07-13 Thread goldtech
, Stefan Behnel [EMAIL PROTECTED] wrote: goldtech wrote: My first attempt at SAX, but have an error message I need help with. Just in case you prefer writing readable code over debugging SAX code into existence, try lxml. http://codespeak.net/lxml/ Here is a presentation you might find

Re: SAX XML Parse Python error message

2008-07-13 Thread goldtech
On Jul 13, 5:30 pm, Waldemar Osuch [EMAIL PROTECTED] wrote: On Jul 13, 3:00 pm, goldtech [EMAIL PROTECTED] wrote: I would be grateful for support with the code I cited. It's not long and fairly standard. I'm sure my error(s) would be glaring to more experienced coders. I appreciated

Re: Tkinter scrollbar and checkbox

2008-04-25 Thread goldtech
snip... I use wxPython most of the time, however effbot has a good tutorial on scrollbars for Tkinter that I think you might find helpful: http://effbot.org/zone/tkinter-scrollbar-patterns.htm Here's another link on the subject:

Tkinter scrollbar and checkbox

2008-04-24 Thread goldtech
Hi, I'm stumped on how to have a scrollbar with a long list of checkboxes. Given code like: from Tkinter import * root = Tk() states = [] for i in range(150): var = IntVar() chk = Checkbutton(root, text=str(i), variable=var) chk.grid(sticky=W) states.append(var) root.mainloop()

String manipulation questions

2008-04-09 Thread goldtech
Hi, Replacing strings in a text (likely an XML) file. Some newbie questions... ... while line: counter=counter+1 if line.find(newstring) != -1: print 'match at line'+str(counter) newline = line.replace(oldstring, newstring) fileOUT.write(newline)

Re: String manipulation questions

2008-04-09 Thread goldtech
snip... for counter, line in enumerate(fileIN): newline = line.replace(oldstring, newstring) if newline != line: print 'match at line', counter+1 fileOUT.write(newline) enumerate - haven't seen that before. Nice! Thanks --

Re: Python ADO Date Time database fields

2008-01-25 Thread goldtech
snip try this: val = oRS.Fields(dt).Value print type(val) this gives: type 'time' print float(val) yes, it gives 0.0 But there should be a way to print what is *actually in the field*. When I open the DB table in Access I see: 12:00:00 AM. That's what I want - the value, and the form

Python ADO Date Time database fields

2008-01-24 Thread goldtech
Hi, Given an MS-Access table with a date type field with a value of: 12:00:00 AM - just12:00:00 AM, there's nothing else in the field. I want to print exactly what's in the field, ie. 12:00:00 AM. What I get printed is: 12/30/0/ 00:00:00 I try: import win32com.client from win32.client import

Tk Tkinter : multiple file selection dialog over multiple directories ?

2007-12-14 Thread goldtech
Hi, TKinter question Let's say I use: ... files = tkFileDialog.askopenFilenames(filetypes=[('AccessDB Files', '*.mdb')]) ... This works OK - I can select multiple files and the var files will be a tuple of the files. But let's say the files I want to select are in different folders/

Win32.com

2007-11-13 Thread goldtech
Given WinXP. I remove Pythonwin and it seems I lose win32.com. I can't import win32.com Is win32.com bundled with Pythonwin? -- http://mail.python.org/mailman/listinfo/python-list

Re: Test for a unicode string

2007-10-25 Thread goldtech
snip... Like: if unicode string: print 'string's line #' else: process the string If I use re.UNICODE like: m = re.match(r\w+, s, re.UNICODE) then it seems to fix my problem. Trying to read as much as I can on unicode --

Test for a unicode string

2007-10-24 Thread goldtech
Hi, I have a regular expression test in a script. When a unicode character get tested in the regex it gives an error: UnicodeError: ASCII decoding error: ordinal not in range(128) Question: Is there a way to test a string for unicode chars (ie. test if a string will throw the error cited

A Python way to get MS Access table column information?

2007-10-15 Thread goldtech
Using Python and OBDC in MS-Access DBs. So, I'm able to run SQL statements from Python on an Access DB. Is there an SQL statement that will give me column information? For a table I want to know the data type and of course colum/Attribute name for each column. So far the answer has been no. VB

Re: How to create a file on users XP desktop

2007-10-08 Thread goldtech
from win32com.shell import shell, shellcon desktop = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, 0, 0) /code I have a general problem with using win32com. It's the documentation. I never know what is available, what classes, methods, what they do. Even some of the existing

Re: Tkinter text widget

2007-10-08 Thread goldtech
On Oct 7, 11:00 am, Simon Forman [EMAIL PROTECTED] wrote: On Oct 6, 11:18 pm, goldtech [EMAIL PROTECTED] wrote: I thought the DISABLED made it so I could not edit it. But it also makes it so I can not scroll down. If you make the window smaller than the content then try to put a cursor

Re: How to create a file on users XP desktop

2007-10-08 Thread goldtech
from win32com.shell import shell, shellcon desktop = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, 0, 0) /code Tim, How did you learn Win32com? Other than the O'Reilly book, I've never found a lot of documentation. Trying to browse COM in PythonWin is tough - there's tons of stuff in

Re: Tkinter text widget

2007-10-08 Thread goldtech
After some Google searching I found ScrolledText, this does what I want :^) from Tkinter import * from ScrolledText import ScrolledText root = Tk() text = ScrolledText(root, font=(Courier)) ScrolledText text.pack() i='123456789abcdefghijklmnopqrstuvwxyz\n' for x in range(30):

Re: Tkinter text widget

2007-10-07 Thread goldtech
You can scroll, but you can't see the cursor. Use for x in range(30): text.insert(END, %3d % x + i) to check. ED I tried it w/the line numbers. On my system I see 0-23. But there is no way to scroll. Still the same result. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a file on users XP desktop

2007-10-07 Thread goldtech
This is really a Windows question, not a Python question. You should have been able to figure it out yourself by examining existing environment variables. I agree, you're right. I learn more by figuring out the code myself. After Google briefly: In a DOS box type: SET This was too easy -

Tkinter text widget

2007-10-06 Thread goldtech
I thought the DISABLED made it so I could not edit it. But it also makes it so I can not scroll down. If you make the window smaller than the content then try to put a cursor in there to use up/down arrow you can't. What I want is not to be able to change text content, but no other action is

How to create a file on users XP desktop

2007-10-06 Thread goldtech
Can anyone link me or explain the following: I open a file in a python script. I want the new file's location to be on the user's desktop in a Windows XP environment. fileHandle = open (., 'w' ) what I guess I'm looking for is an environmental variable that will usually be correct on most

Re: tkinter question

2007-10-05 Thread goldtech
try to change listbox.pack() to listbox.pack(expand=True, fill=BOTH) .. is it that you want ? Yes. -mykhal Worked with TRUE all uppercase. Exactly what I needed. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

tkinter question

2007-10-04 Thread goldtech
This works OK. But I notice that if I enlarge the window after the script has run, the white listbox only gets so big while the grey background enlarges. Is there a way to have it all white when I enlarge a window - like what normally happens? from Tkinter import * root = Tk() root.title(Dirty

Parameter Passing - String Variable Truncated ?

2007-08-31 Thread goldtech
Hi, I'm passing what I think is a string parameter to another Python program (spawn.py) - see the code snip below. But only the counter part gets printed to a log file via spawn.py. Yet the echo print to the output window shows the whole string with the fc part. Better explained below I hope,

Re: Parameter Passing - String Variable Truncated ?

2007-08-31 Thread goldtech
snip... -- Try handle.write(repr(sys.argv[1:]) + \n) and come back with your conclusions ... unless of course someone has spoonfed you in the meantime. Another clue: write yourself a little arg-dumper script and try running it in a Command Prompt window. 8---

Python syntax r prefix to a string

2007-08-19 Thread goldtech
Does anyone know this syntax and could link me to an explanation? Something like: Workspace = r'C:\foobar\mystuff\xyz' What's that r doing? Sometimes I see a u too. Explanation appreciated. Thanks, Lee G. -- http://mail.python.org/mailman/listinfo/python-list

C++ Runtime Library error message - Pythonwin?

2007-08-11 Thread goldtech
Hi, Doing GIS [Geographic Information Systems] scripts. I was running a batch clip script that worked OK for 126 iterations then I got the following message: Microsoft Visual C++ Runtime Library program: C:\python21\pythonwin\pythonwin.exe This application has requested the runtime to

Re: frequency analysis of a DB column

2007-08-04 Thread goldtech
Just wanted to thank the Posters for the help! Thanks. Lee G. -- http://mail.python.org/mailman/listinfo/python-list

Submit web form only client-side with Python? COM?

2007-08-04 Thread goldtech
Say I have have an HTML form , the user hits the submit button and I what text they enetered into a HTML form field is written to a file. But I don't have PHP, JAVA the usual client or server sided layers to write the data to a file, and I'm not to keen on JavaScript. Note: I can not add or

Client-side HTML form processing with Python?

2007-08-04 Thread goldtech
I want to have an HTML form from a local local html file write a text field's data to a local text file. I have no client or server side tools like PHP, JAVA. I don't know JavaScript. I can not add anything to the workstation I am using. It's going to have to be a client-side solution - there's

Re: Client-side HTML form processing with Python?

2007-08-04 Thread goldtech
Looks like Tkinter is the way to do it. There's always a way with Python - good stuff! -- http://mail.python.org/mailman/listinfo/python-list

frequency analysis of a DB column

2007-08-01 Thread goldtech
In Python 2.1 are there any tools to take a column from a DB and do a frequency analysis - a breakdown of the values for this column? Possibly a histogram or a table saying out of 500 records I have one hundred and two 301 ninety-eight 212 values and three-hundred 410? Is SQL the way to for