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
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.
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
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
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
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
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 =
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
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
Bump(?)
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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.
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!
--
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
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
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,
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
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
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
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
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,
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,
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.
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
.*? 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
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
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
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...
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.
--
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
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
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
--
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
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
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
--
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
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
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
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
, 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
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
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:
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()
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)
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
--
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
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
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/
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
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
--
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
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
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
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
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
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):
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
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 -
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
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
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
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
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,
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---
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
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
Just wanted to thank the Posters for the help!
Thanks.
Lee G.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
74 matches
Mail list logo