Re: Windows vs Linux [was: p2exe using wine/cxoffice]

2005-10-26 Thread Tim G
Thomas Heller wrote:
> FYI, if you don't know this already: You also can resize the console without
> going through the properties menu with 'mode con cols=... lines=...'.

Good grief! I haven't used "mode con" in years; forgotten
it even existed! Thanks for bringing that back, Thomas.

TJG

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


Re: Windows vs Linux

2005-10-26 Thread Tim G

Bernhard Herzog wrote:
> "Tim Golden" <[EMAIL PROTECTED]> writes:
>
> > But as far as I can tell
> > from my experience and from the docs -- and I'm not near a
> > Linux box at the mo -- having used ctrl-r to recall line x
> > in the history, you can't just down-arrow to recall x+1, x+2 etc.
> > Or can you?
>
> You can.  It works fine on this box, at least.
> GNU bash, version 2.05a.0(1)-release (i386-pc-linux-gnu)
> libreadline 4.2a

Sadly, this seems not to be the case on my Ubuntu Breezy:
bash 3.00.16, libreadline 4.3/5.0 (not sure which one
bash is using). ctrl-r is fine; but you can't down-arrow
from there; it just beeps at you. Is there some setting I'm
missing?

TJG

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


Re: Problems with threaded Hotkey application

2005-11-23 Thread Tim G
And just to confirm, it does in fact work. If you move the
RegisterHotKey line to within the thread's run method, the thread's
message loop picks up the hotkey press.

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


Re: Problems with threaded Hotkey application

2005-11-23 Thread Tim G
One obvious point is that, according to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefWM_HOTKEY.asp

the WM_HOTKEY message is posted to the queue *of the thread which
registered the hotkey*. I haven't yet tried it myself to see, but in
your example the main thread registers the hotkey, and the KeyCatch
thread is waiting to receive it.

TJG

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


Re: Problem remotely shutting down a windows computer with python

2005-01-04 Thread Tim G
> I have a problem when using the python script found here:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649
>
> It is a script to remotely shutdown a windows computer.  When I use
it,
> the computer shuts down, but doesn't power off like with a regular
> shutdown. It stays on the "Safe to power off" screen and I have to
push
> the power button to actually power off.  Anyone know why this happens
> with this script?  Thanks for any help.
>
> Eric

I see that others have answered the question
pretty completely, but just to add the obligatory
WMI solution:
[ assumes you're using the wmi module from
http://tgolden.sc.sabren.com/python/wmi.html ]



import wmi
c = wmi.WMI (computer="other_machine", privileges=["RemoteShutdown"])
os = c.Win32_OperatingSystem (Primary=1)[0]
os.Win32Shutdown (Flags=12)


The Flags=12 bit should shut down all the way.

TJG

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


Re: Installing IPython on win2k

2005-01-08 Thread Tim G
Dave Merrill wrote:
> Hi, I'm new to python, and ipython, but not to programming, having
trouble
> getting ipython installed on windows 2000, python 233. Any help would
be
> much appreciated; I'm sure I'm being some basic flavor of dense...

First of all, rest assured that it does work (and quite
easily) so welcome to Python and iPython and I hope
the going's a bit smoother as you go along.

> Then downloaded ipython-0.6.6.zip and unzipped it. When I
double-click
> setup.py, I get only a brief wait cursor; nothing else happens, and
> importing ipython as a test fails.

First of all, ipython isn't really an import into python; you run
it and it runs python (if you understand me). So when you've
installed it, I think it puts an item on your start menu. On
linux, it puts an executable ipython onto your path.

I've just downloaded and run the setup.py, and it does
create a Start Menu item which will start iPython. Look
out for that and see if it does the business.

> Both files in the scripts dir, ipython and pycolor, have no filename
> extension, which seems odd to my newbie eye. I tried renaming them to
.py,
> still no difference.

This is a unixism. Some unix types decry the use of file extensions
because the information the extension gives -- which executable
program to use -- is already embedded in the first line of a file.

>
> My apologies for this basic question, and my no doubt ignorant
flailing
> about. Very much looking forward to getting this working.
> 
> Thanks,
> 
> Dave Merrill

Good luck and happy hunting

TJG

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


Re: COM problem .py versus .exe

2005-06-29 Thread Tim G
Greg Miller wrote:
> I tried the code snippet using win32api.GetFileVersionInfo(), what I
> get now is the following when running on the executable machine:
>
> . . . FileFlagsMask => 63
> FileType => 2
> FileVersionMS => 65536
> FileVersionLS => 1
> Signature => -17890115
> FileSubtype => 0
> FileFlags => 0
> ProductVersionLS => 1
> FileDate => None
> ProductVersionMS => 65536
> FileOS => 4
> StrucVersion => 65536

> I can't find too much on the 'net about these output values.

>From the pywin32 help entry for GetFileVersionInfo:

"Information to return: \\ for VS_FIXEDFILEINFO"

Google for VS_FIXEDFILEINFO and hit "I'm Feeling Lucky". You've
still got to work out how to piece the values together, but I'm
sure you're just as capable of doing that as I am. (And probably
more so).

TJG

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


FTP Error: Windows AS/400

2005-09-13 Thread Tim G.
I am trying to use Win Python to ftp files from an AS/400 IFS directory
down to my Windows machine.

I seem to get stuck when I am trying to send a command to the AS/400 to
switch file systems from native to IFS and then to issue a cd to my
folder.  I get the error below.

If anyone has had experience trying to ftp from a 400, I would greatly
appreciate any info on the topic.


Code:

import ftplib, os

filename=''
path = "jde7333"
os.chdir('c:\\ftp_jde400')

ftp = ftplib.FTP('test400')
ftp.login('oneworld', 'onew0r1d')
#ftp.sendcmd('quote site namefmt 1')
ftp.sendcmd('site namefmt 1')
ftp.cwd(path)
#remotefiles = ftp.nlst()
#ftp.retrlines('LIST')
#for filename in remotefiles:
#file = open(filename, 'wb')
#ftp.retrbinary('RETR ' + filename, file.write, 1024)
#file.close()

ftp.quit()


Error:

Traceback (most recent call last):
  File "C:\Python24\Tools\scripts\ftp400.py", line 10, in ?
ftp.cwd(path)
  File "C:\Python24\lib\ftplib.py", line 494, in cwd
return self.voidcmd(cmd)
  File "C:\Python24\lib\ftplib.py", line 246, in voidcmd
return self.voidresp()
  File "C:\Python24\lib\ftplib.py", line 221, in voidresp
resp = self.getresp()
  File "C:\Python24\lib\ftplib.py", line 214, in getresp
raise error_perm, resp
ftplib.error_perm: 501 Unknown extension in database file name.

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


FTP Windows AS/400

2005-09-13 Thread Tim G.
I am trying to execute a win python script that connects to an AS/400;
changes from the native lib to the IFS file system; then, changes to a
directory in IFS; gets a file.

Any help would be greatly appreciated.

I cannot get the script to switch from native to IFS.  I get the
following error:

Traceback (most recent call last):
  File "C:\Python24\Tools\scripts\ftp400.py", line 9, in ?
ftp.cwd(path)
  File "C:\Python24\lib\ftplib.py", line 494, in cwd
return self.voidcmd(cmd)
  File "C:\Python24\lib\ftplib.py", line 246, in voidcmd
return self.voidresp()
  File "C:\Python24\lib\ftplib.py", line 221, in voidresp
resp = self.getresp()
  File "C:\Python24\lib\ftplib.py", line 214, in getresp
raise error_perm, resp
ftplib.error_perm: 501 Unknown extension in database file name.

here is the script:

import ftplib, os

filename=''
path = "directory"
os.chdir('c:\\ftp_jde400')

ftp = ftplib.FTP('server', 'user', 'password')
ftp.sendcmd('site namefmt 1')
ftp.cwd(path)
#remotefiles = ftp.nlst()
#ftp.retrlines('LIST')
#for filename in remotefiles:
#file = open(filename, 'wb')
#ftp.retrbinary('RETR ' + filename, file.write, 1024)
#file.close()

ftp.quit()

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


Re: simple input that can understand special keys?

2005-02-28 Thread Tim G
Gabriel B. wrote:
> i'm writting an application that will use Tinker in a newer future.
> Now it's console only. I simply ommit some data on the display,
> print() some other and go on. The problem is that i can't test the
> actions tiggered by special keys, like Page Up/Down or the F1...12
>
> Right now i'm using raw_input() since even the Tk version will have
> only one input place, and for debuging i'm literally writting pageup,
> pagedow and the F's. But i want to put it in test while i write the
> GUI.
>
> is there any hope for me? I wanted to stay only with the console for
> now. And it's windows by the way :)
>
> Thanks

This is a notoriously un-cross-platform sort of issue.
Don't know about Tk, but for Windows, you could
use one of the existing console/curses packages:

Chris Gonnerman's WConIO:
http://newcenturycomputers.net/projects/wconio.html

The effbot's console module:
http://effbot.org/zone/console-index.htm

or a Win32 curses port:
http://flangy.com/dev/python/curses/

or you could splash out a bit and go for Pygame,
which gives you pretty much complete control over
pretty much everything:
http://pygame.org

or you could use the part-of-the-batteries mscvrt
module:
http://www.python.org/doc/2.4/lib/msvcrt-console.html


TJG

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


Re: HELP: Python equivalent of UNIX command "touch"

2005-03-03 Thread Tim G
Since no-one's suggested this yet, I highly recommend
UnxUtils: http://unxutils.sourceforge.net/ which includes
a touch.exe. Obviously, this doesn't answer your call for
a Python version, but if you're happy with touch under
Unix, maybe this will work for you.

TJG

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


Re: os.path.islink()

2004-12-08 Thread Tim G
You may well be able to do it with the win32file module
functions: GetFileAttributesEx or GetFileInformationByHandle
It's not my area of expertise, but usually a bit of poking around
in msdn.microsoft.com yields some results, as does Googling
around for other people (often VB or Delphi-based) who have
done the same thing.

TJG

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


Re: HELP Printing with wxPython

2005-05-11 Thread Tim G
> Hello all, I'm trying hard to make possible to print some simple text
from
> python to the default printer using wxPython, after days of internet
> searches I found this page:
http://wiki.wxpython.org/index.cgi/Printing but
> is impossible to use this script even if I do exactly as said there.
I think
> the script is buggy or I am not able to use it, even if seems very
simple to
> use...
>
> Anyone can give me an hint on how to easily and simply print some
text? Is
> there a library ready to download and use? Something like
SendPrinter("some
> text\n")?

On the strict wxPython front, I can't help
you, but I might be able to offer some help.
Depends a little bit on how much you're tied
to wxPython and how much you need to be cross-platform.

Essentially, if you're on Windows (and have no need
to run on anything else) then consider some of the
solutions here:

http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html

If you're on Unix / whatever with no need to do
anything else, then I'm sure there are straightforward
ways to push stuff to a printer. (Something using lpr
he thinks, hoping someone with real knowledge can chip
in).

If you *really* want to use wxPython for cross-platform
needs, or just because you think it's cleaner, then try
on the wxPython lists if you haven't already.

TJG

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