newbe who is also senior having a senior moment

2006-09-06 Thread stan
I am a complete newbe to python and only got here because I am trying to set 
up iTunes in game Second Life.  Have followed all instructions but keep 
getting an error reading from my XP Pro OS as follows

File "C:\Python24\2L file for iTunes", line 4, in -toplevel-
import win32com.client
ImportError: No module named win32com.client

can someone pls point me in the right direction here as I am trying to 
urgently fix the file for someones birthday in game (I know pathetic)

thanks
Stan 


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


New to Python: my impression v. Perl/Ruby

2005-10-15 Thread Stan Krajewski



Very interesting. I too am deciding between the 
three languages. I find Python to be the easiest to use. By 
far. 
 
I find the forced indentation in Python a 
blessing in disguise. 
 
It seems Python is making in-roads into the 
progarmming community.
 
With Ruby, its back to idiosyncratic and abstract 
syntax. Why? Is it necessary to be cryptic? Whoever can figure out the puzzle is 
the smartest one?
 
 
 
 
"Everything should be made as simple as possible, 
but no simpler." 
 
Albert Einstein 
 
 
 
Thanks for sharing your thoughts!
 
 
Stan
 
 
 
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Working with dbase files

2005-02-27 Thread Stan Cook
Does anyone know how I can access and read data 
from a dbase (.dbf) file?

Regards,
Stan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.3.2 Shell Message

2013-12-29 Thread Stan Ward
On Sunday, December 29, 2013 5:18:18 PM UTC-5, Stan Ward wrote:

Note: I do not get the "WARNING: The version of Tcl/Tk (8.5.9) in use may be 
unstable." message when I run python directly from bash (Mac "Terminal"), but I 
do get it in the IDLE.app Shell Window, run as follows, based on the 
recommendation in Python for Kids, with the addition of the .bash_profile call 
to to try to ensure paths.

. .bash_profile
open -a "//Applications/Python 3.3/IDLE.app" --args -n

Sorry about all this newbie questions/info.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.3.2 Shell Message

2013-12-30 Thread Stan Ward
Thanks Ned.  That did the trick!  Jason Briggs, author of Python of Kids, gave 
me the same answer.  Happy to be over this hurdle.  Thanks!  Happy New Year!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Unsuccessful installation

2015-11-19 Thread Kaufman, Stan
Python would not run on this Windows XP computer.  After four  attempts at 
"change/remove" it still gives the same message:

[cid:image001.png@01D122D0.93CC3270]

The first trip through "change/remove" appeared to be a further step in 
installation.  The second through fourth trips indicated "repairing..."  Each 
time, an attempt to run it resulted in the above message.




---
Stan Kaufman
Principal Scientist (retired)
TSI Incorporated
500 Cardigan Road
St. Paul, MN 55126

---
"Science is what we have learned about how to keep from fooling ourselves."
Richard Feynman
---


This e-mail or the documents accompanying this e-mail contain information that 
may be confidential and/or privileged. 
It may also be prohibited from disclosure under applicable law. The information 
is intended to be for the use of the 
individual or entity named on this transmission. If you are not the intended 
recipient, be aware that any disclosure, 
copying, distribution or use of the contents of this information is without 
authorization and is prohibited. If you 
have received this e-mail in error, please notify us immediately so that we can 
take action to correct the problem.
-- 
https://mail.python.org/mailman/listinfo/python-list


Spanish Accents

2011-12-22 Thread Stan Iverson
Hi;
If I write a python page to print to the web with Spanish accents all is
well. However, if I read the data from a text file it prints diamonds with
question marks wherever there are accented vowels. Please advise.
TIA,
Stan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spanish Accents

2011-12-22 Thread Stan Iverson
On Thu, Dec 22, 2011 at 10:58 AM, Chris Angelico  wrote:

> Firstly, are you using Python 2 or Python 3? Things will be slightly
> different, since the default 'str' object in Py3 is Unicode.
>

2

>
> I would guess that your page is being output as UTF-8; you may find
> that the solution is as easy as declaring the encoding of your text
> file when you read it in.
>

So I tried this:

file = open(p + "2.txt")
for line in file:
  print unicode(line, 'utf-8')

and got this error:

 142   print unicode(line, 'utf-8')
   143
   144 print '''http://13gems.com/Sign_Up.py"; method="post" target="_blank">
 *builtin* *unicode* = , *line* = '\r\n'
 
/usr/lib64/python2.4/encodings/utf_8.pyin
*decode*(input=,
errors='strict')14
15 def decode(input, errors='strict'):
16 return codecs.utf_16_decode(input, errors, True)
17
18 class StreamWriter(codecs.StreamWriter):
 *global* *codecs* = , codecs.*utf_16_decode* = , *input* = , *errors* = 'strict', *builtin* *True* = True

*UnicodeDecodeError*: 'utf16' codec can't decode byte 0x0a in position 20:
truncated data
  args = ('utf16', '\r\n', 20, 21, 'truncated data')
  encoding = 'utf16'
  end = 21
  object = '\r\n'
  reason = 'truncated data'
  start = 20

Tried it with utf-16 with same results.

TIA,

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


Re: Spanish Accents

2011-12-22 Thread Stan Iverson
On Thu, Dec 22, 2011 at 11:30 AM, Rami Chowdhury
wrote:

> Could you try using the 'open' function from the 'codecs' module?
>

I believe this is what you meant:

file = codecs.open(p + "2.txt", "r", "utf-8")
for line in file:
  print line

but got this error:

 141 file = codecs.open(p + "2.txt", "r", "utf-8")
   142 for line in file:
   143   print line
   144
 *line* = '\r\n', *file* = 
/usr/lib64/python2.4/codecs.py in *next*(self=)   492
   493 """ Return the next decoded line from the input stream."""
   494 return self.reader.next()
   495
   496 def __iter__(self):
 *self* = , self.*reader* = , self.reader.*next* = >
/usr/lib64/python2.4/codecs.py in *next*(self=)   429
   430 """ Return the next decoded line from the input stream."""
   431 line = self.readline()
   432 if line:
   433 return line
 line *undefined*, *self* = , self.*
readline* = >  /usr/lib64/python2.4/codecs.py in *readline*(self=, size=None, keepends=True)   344
 # If size is given, we call read() only once
   345 while True:
   346 data = self.read(readsize, firstline=True)
   347 if data:
   348
 # If we're at a "\r" read one extra character (which might
 data *undefined*, *self* = , self.*read* =
>, *
readsize* = 72, firstline *undefined*, *builtin* *True* = True
/usr/lib64/python2.4/codecs.py in *read*(self=, size=72, chars=-1, firstline=True)   291
 data = self.bytebuffer + newdata
   292 try:
   293
 newchars, decodedbytes = self.decode(data, self.errors)
   294 except UnicodeDecodeError, exc:
   295 if firstline:
 *newchars* = u'', *decodedbytes* = 0, *self* = , self.*decode* = , *data* =
'\xe1intentado para ellos bastante sabios para discernir lo obvio.
Tales perso',
self.*errors* = 'strict'

*UnicodeDecodeError*: 'utf8' codec can't decode bytes in position 0-2:
invalid data
  args = ('utf8', '\xe1 intentado para ellos bastante sabios para
discernir lo obvio. Tales perso', 0, 3, 'invalid data')
  encoding = 'utf8'
  end = 3
  object = '\xe1 intentado para ellos bastante sabios para discernir lo
obvio. Tales perso'
  reason = 'invalid data'
  start = 0

which is the letter á (a with accent).
So I tried with utf-16 and got this error:

 141 file = codecs.open(p + "2.txt", "r", "utf-16")
   142 for line in file:
   143   print line
   144
 *line* = '\r\n', *file* = 
/usr/lib64/python2.4/codecs.py in *next*(self=)   492
   493 """ Return the next decoded line from the input stream."""
   494 return self.reader.next()
   495
   496 def __iter__(self):
 *self* = , self.*reader* = , self.reader.*next* = >
/usr/lib64/python2.4/codecs.py in *next*(self=)   429
   430 """ Return the next decoded line from the input stream."""
   431 line = self.readline()
   432 if line:
   433 return line
 line *undefined*, *self* = , self.*
readline* = >  /usr/lib64/python2.4/codecs.py in *readline*(self=, size=None, keepends=True)   344
 # If size is given, we call read() only once
   345 while True:
   346 data = self.read(readsize, firstline=True)
   347 if data:
   348
 # If we're at a "\r" read one extra character (which might
 data *undefined*, *self* = , self.*read* =
>, *
readsize* = 72, firstline *undefined*, *builtin* *True* = True
/usr/lib64/python2.4/codecs.py in *read*(self=, size=72, chars=-1, firstline=True)   291
 data = self.bytebuffer + newdata
   292 try:
   293
 newchars, decodedbytes = self.decode(data, self.errors)
   294 except UnicodeDecodeError, exc:
   295 if firstline:
 newchars *undefined*, decodedbytes *undefined*, *self* = , self.*decode* = >, *data* = '\r\nNoticia:
Este sitio web entre este portal est\xe1 i', self.*errors* = 'strict'
/usr/lib64/python2.4/encodings/utf_16.py in *decode*(self=, input='\r\nNoticia: Este
sitio web entre este portal est\xe1 i', errors='strict')47
 self.decode = codecs.utf_16_be_decode
48 elif consumed>=2:
49
 raise UnicodeError,"UTF-16 stream does not start with BOM"
50 return (object, consumed)
51
 *builtin* *UnicodeError* = 

*UnicodeError*: UTF-16 stream does not start with BOM
  args = ('UTF-16 stream does not start with BOM',)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spanish Accents

2011-12-22 Thread Stan Iverson
On Thu, Dec 22, 2011 at 12:42 PM, Peter Otten <__pete...@web.de> wrote:

> The file is probably encoded in ISO-8859-1, ISO-8859-15, or cp1252 then:
>
> >>> print "\xe1".decode("iso-8859-1")
> á
> >>> print "\xe1".decode("iso-8859-15")
> á
> >>> print "\xe1".decode("cp1252")
> á
>
> Try codecs.open() with one of these encodings.
>

I'm baffled. I duplicated your print statements but when I run this code
(or any of the 3 encodings):

file = codecs.open(p + "2.txt", "r", "cp1252")
#file = codecs.open(p + "2.txt", "r", "utf-8")
for line in file:
  print line

I get this error:

*UnicodeEncodeError*: 'ascii' codec can't encode character u'\xe1' in
position 48: ordinal not in range(128)
  args = ('ascii', u'Noticia: Este sitio web entre este portal
est...r\xe1pidamente va a salir de aqu\xed.\r\n', 48, 49,
'ordinal not in range(128)')
  encoding = 'ascii'
  end = 49
  object = u'Noticia: Este sitio web entre este portal
est...r\xe1pidamente
va a salir de aqu\xed.\r\n'
  reason = 'ordinal not in range(128)'
  start = 48

Please advise. TIA,
Stan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spanish Accents

2011-12-22 Thread Stan Iverson
On Thu, Dec 22, 2011 at 2:17 PM, Peter Otten <__pete...@web.de> wrote:

> You are now one step further, you have successfully* decoded the file.
> The remaining step is to encode the resulting unicode lines back into
> bytes.
> The encoding implicitly used by the print statement is sys.stdout.encoding
> which is either "ascii" or None in your case. Try to encode explicitly to
> UTF-8 with
>
> f = codecs.open(p + "2.txt", "r", "iso-8859-1")
> for line in f:
>print line.encode("utf-8")
>
>
> OOEEE! Thanks!
Stan
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter focus_set use with grid

2006-07-19 Thread Stan Cook
A newbie to Tkinter here. . . . . .

I'm trying to set the focus on an Entry textbox with 
focus_set.  I am using the grid manager.  I created the same 
interface before using the  pack() method and the focus_set 
worked, but now it says

"AttributeError: 'NoneType' object has no attribute 'focus_set'"

Below is the section of the code:

#   CREATES THE GUI FOR DCN INPUT
def get_dcn():
master = Tk()
_dcn = StringVar()
label1 = Label(text="Enter DCN:",width=10).grid(row=0)
txtbox = Entry(relief=SUNKEN, width=20, takefocus=1, 
textvariable=_dcn).grid(row=0, column=1)
txtbox.focus_set()
btnOK= 
Button(text="OK",command=assign_dcn(_dcn)).grid(row=1, column=0)
btnCancel = Button(text="Cancel", 
command=killer).grid(row=1, column=1)
master.mainloop()
return

Does anyone know where I went wrong?

Regards. . . .

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


create a text file

2006-05-29 Thread Stan Cook
I'm writing a script to list all of my music files' id3 tags 
to a comma delimited file.  The only part I'm missing seems 
like it should be the simplest.  I haven't used Python for 
the last couple of years.  My question is this:

When I use os.open(,"w"), I get an error 
message,TypeError: an integer is required.  Has 
something changed?  Did I miss something???

Thanks,

---> S Cook
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: create a text file

2006-06-04 Thread Stan Cook
Fredrik Lundh wrote:
> Stan Cook wrote:
> 
>> I'm writing a script to list all of my music files' id3 tags to a 
>> comma delimited file.  The only part I'm missing seems like it should 
>> be the simplest.  I haven't used Python for the last couple of years.  
>> My question is this:
>>
>> When I use os.open(,"w"), I get an error 
>> message,TypeError: an integer is required.  Has something 
>> changed?  Did I miss something???
> 
> the function is called "open", not "os.open".
> 
> there's an open function in the os module, but that's doing something 
> slightly different (see the library reference documentation for details 
> if you're curious).
> 
> 
> 
Thanks, I found it.
-- 
http://mail.python.org/mailman/listinfo/python-list


how to get the length of a number

2006-06-11 Thread Stan Cook
Can anyone tell me how to get the length of a number.  I 
know len(string) will get the length of a string, but it 
doesn't like len(int).  I seem to remember something like %s 
string.  I tried to set a variable = to %s int, but that 
doesn't work.  Is there a function I've forgotten about to 
convert an integer to a string?

Regards

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


Re: how to get the length of a number

2006-06-11 Thread Stan Cook
Saketh wrote:
> Stan Cook wrote:
>> Can anyone tell me how to get the length of a number.  I
>> know len(string) will get the length of a string, but it
>> doesn't like len(int).  I seem to remember something like %s
>> string.  I tried to set a variable = to %s int, but that
>> doesn't work.  Is there a function I've forgotten about to
>> convert an integer to a string?
>>
>> Regards
>>
>> Stan
> 
> Use str(int). Then use len(). For example, len(str(12345)) will give
> you 5.
> 
A! How could I have forgotten that.  Boy is my face red :)

Thanks

I'll try to make my next question a more intelligent one.

Regards,

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


Database read and write

2006-06-14 Thread Stan Cook
Ok .  I know I'm talking ancient history, but some of us are 
stuck working with them.  Is there anything for python which 
will ope, read, and write to a Dbase 3 or 4 file?  I really 
need your assistance on this one.

Regards,

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


Re: Database read and write

2006-06-15 Thread Stan Cook
ftc wrote:
> Stan Cook a écrit :
>> Ok .  I know I'm talking ancient history, but some of us are stuck 
>> working with them.  Is there anything for python which will ope, read, 
>> and write to a Dbase 3 or 4 file?  I really need your assistance on 
>> this one.
> 
> If you work on Windows, there are dbf odbc drivers installed so you can 
> access your dbf files through ODBC driver I think.
I'm working with Linux.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python with Eclipse

2006-06-18 Thread Stan Cook
I've been trying to use Eclipse with Python on Linux for a 
while and have noticed something odd.  After running the 
code or debugging a few times, its responsiveness gets 
really bad.  Upon checking the equivalent of the task 
manager, I find several instances of Python running.  When I 
kill these instances, the responsiveness comes back.  I'm 
not sure if there is a better place to post this, but it is 
Python related.  Is this just an issue with Eclipse or is 
there something else I should inspect?

Any help would be appreciated.

Regards,

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


Re: Python with Eclipse

2006-06-20 Thread Stan Cook
Jason wrote:
> PyDev Eclipse keeps around the python interpreter unless it gets
> removed.  I think part of the point is to keep around failed runs so
> the user can investigate the stack.  Eclipse doesn't keep this around
> if you Run you script, but it will keep the interpreter alive if you
> Debug your script, regardless of how it exits.  (It may dispose of the
> interpreter if your program exits with a normal error code.)
> 
> Anyway, in the Debug View, you can see a list of all the python
> interpreters that PyDev and Eclipse are keeping alive.  There's a set
> of debugging-related buttons just above: step into, step over, step
> return, continue, and others.
> 
> One of the buttons there looks like a couple of "X" symbols.  This
> button officially shuts down a python interpreter.  (Be careful and
> don't actually click the "X" symbol that closes the debug area!)
> 
>   --Jason
> 
> Stan Cook wrote:
>> I've been trying to use Eclipse with Python on Linux for a
>> while and have noticed something odd.  After running the
>> code or debugging a few times, its responsiveness gets
>> really bad.  Upon checking the equivalent of the task
>> manager, I find several instances of Python running.  When I
>> kill these instances, the responsiveness comes back.  I'm
>> not sure if there is a better place to post this, but it is
>> Python related.  Is this just an issue with Eclipse or is
>> there something else I should inspect?
>>
>> Any help would be appreciated.
>>
>> Regards,
>>
>> S Cook
> 
Thanks,  I'll try that and keep an eye on the open sessions.

Regards,

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


Another Eclipse Question with Python

2006-06-20 Thread Stan Cook
I followed the help instructions to set a watchpoint for a 
variable, or at lest I tried.  When I hilight the variable 
and go to the run menu, the "toggle watchpoint" is grayed 
out and can't be selected as specified.  Is this Python 
related only?  Just wondering, I want to use the software 
with all of the features it allows if possible.

Thanks

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


Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Stan Graves
LaundroMat wrote:
> Suppose I have this function:
>
> def f(var=1):
> return var*2
>
> What value do I have to pass to f() if I want it to evaluate var to 1?
> I know that f() will return 2, but what if I absolutely want to pass a
> value to f()? "None" doesn't seem to work..


What about this?

>>> def f(var=None):
... if var == None:
... var = 1
... return 2*var
...
>>> f()
2
>>> f(3)
6
>>> a=4
>>> f(a)
8
>>> b=None
>>> f(b)
2
>>> 

--Stan Graves

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