Help in File selector window in pygtk

2005-11-21 Thread Thierry Lam
Let's say I have a main window which has a File menu. When I click on
the File menu and the open button, I have a File selector window which
comes in front of my main window.  How do I make the main window
unselectable?

Thanks
Thierry

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


Help with modal in Gtk::FileChooserDialog

2005-11-21 Thread Thierry Lam
Does anyone know how to set modal to True for Gtk::FileChooserDialog?

Thanks
Thierry

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


Mapping a drive to a network path

2005-07-22 Thread Thierry Lam
In DOS, if I want to map a network path to a drive, I do the following:

net use z: \\computer\folder

How do we do something similar in python?

Thanks
Thierry

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


Re: Mapping a drive to a network path

2005-07-22 Thread Thierry Lam
Thanks, that helps.

Thierry

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


Mapping network drive on Linux

2005-08-31 Thread Thierry Lam
On windows, if I want to map a network drive to a local drive on my
computer, I do the following:

data = {
'remote' : '\\blah\data',
'local' : 'Z:'
   }
   win32net.NetUseAdd(None, 1, data)


How am I supposed to do similar thing on Linux?

Thanks
Thierry

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


Calling ftp commands from python

2005-08-31 Thread Thierry Lam
Is it possible to run an ftp command to connect to some remote computer
on the network.

For example, if I want to retrieve some data from
\\remcomputer\datafiles on the network and copy it to my local
computer, how do I do it in python on the Unix side?

I don't want to use mount since I don't have permission.

Thanks
Thierry

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


Python xml.dom, help reading attribute data

2005-09-06 Thread Thierry Lam
Let's say I have the following xml tag:

1

I can't figure out what kind of python xml.dom codes I should invoke to
read the data 1? Any help please?

Thanks
Thierry

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


Ignoring ampersand(&) as a special character in xml

2005-09-06 Thread Thierry Lam
Let's say I have the following xml tag:

a & b

Currently, an xml parser will treat & as a special character.  Does
anyone know the special characters to use around the ampersand so that
the xml parser can treat "a & b" as a whole value?

Thanks
Thierry

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


Writing at the beginning of a file

2005-09-14 Thread Thierry Lam
Let's say I already wrote a file and have the following:

testing
testing testing
testing testing testing

Is there an easy way to write something of variable length at the top
of the file?

For example,

6 testing written
testing
testing testing
testing testing testing

I tried to write some garbage on top right after opening the file and
then use seek to overwrite the garbage, but since the string to be
written can be of variable length, I'm not sure how much garbage I have
to write initially.

The other way to do what I want is to write the whole thing to a new
file, but I want to skip that method if there's an alternative way.

Another way of doing it is to buffer the whole file writing into some
variable, but that means I have to change 2000+ lines of codes and
change fp.write() to something else.

Any suggestions please?

Thanks
Thierry

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


Creating Pie Chart from Python

2005-09-15 Thread Thierry Lam
Let's say I have the following data:

500 objects:
-100 are red
-300 are blue
-the rest are green

Is there some python package which can represent the above information
in a pie chart?

Thanks
Thierry

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


Creating Pie Chart from Python

2005-09-15 Thread Thierry Lam
Let's say I have the following data:

500 objects:
-100 are red
-300 are blue
-the rest are green

Is there some python package which can represen the above information
in a pie chart?

Thanks
Thierry

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


Re: Creating Pie Chart from Python

2005-09-15 Thread Thierry Lam
In a web browser, having a pie chart in some image format will be great.

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


Walking through directories and files

2005-09-16 Thread Thierry Lam
I'm trying to use the os.walk() method to search all the directory from
a root directory and display their contents. For example, I want my
output to be like the following:


directoryA
stuffs.c
stuffs2.cpp

directoryB
asd.c
asdf.cpp


Any ideas how to do it? Currently, I can only print all the filenames
first and then the directory names.

Thanks
Thierry

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


Re: Creating Pie Chart from Python

2005-09-16 Thread Thierry Lam
Those python pie chart add ons are not very useful. For my specific pie
chart, I have some 6-8 items to show up and some of them occupy only
2-5% of the pie. This cause the names and percentages to overlap each
other.

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


Renaming files in ftplib

2006-01-07 Thread Thierry Lam
Let's say I have a file called 'test.c' on my local machine and I'm
ftping a file with similar name from a remote computer.  I want to
prefix the file ftped over with a T_, how do I do that through ftplib
in python?

Thanks
Thierry

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


Copying files between different linux machines

2006-01-07 Thread Thierry Lam
Let's say I have two linux machines with the following names:
-linone
-lintwo

If I'm currently on linone and if I want to copy a bunch of files from
lintwo into linone, how can that be done in a python script without
using ftp?

Thanks
Thierry

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


Timeout at command prompt

2006-01-11 Thread Thierry Lam
I can use the python function raw_input() to read any input from the
user but how can I add a timeout so that my program exits after x
period of time when no input has been entered.

Thierry

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


Re: Timeout at command prompt

2006-01-12 Thread Thierry Lam
Which Python version are you using? I'm getting the following error
with Python 2.3.4:

Traceback (most recent call last):
  File "C:\home\pciroot\vcur\sdk\tools\inter.py", line 32, in ?
signal.signal(signal.SIGALRM, input)
AttributeError: 'module' object has no attribute 'SIGALRM'


Thierry

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


Re: Timeout at command prompt

2006-01-12 Thread Thierry Lam
Is there a windows equivalent for that solution?

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


Re: Timeout at command prompt

2006-01-12 Thread Thierry Lam
I got the signal to work on linux with sys.stdin.readline() but the
process timeout after x seconds even when I input something.  Is there
a way to close the signal after getting a correct input from the
console window?

Thanks
Thierry

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


Re: HTTPS Login

2006-08-31 Thread Thierry Lam
Instead of using the following:

> req = urllib2.Request("https://web.site.com/default.aspx";, params)
> data = urllib2.urlopen(req)


Try:

data = urllib.urlopen("https://web.site.com/default.aspx";, param)

Thierry

Tom Grove wrote:
> I am trying to login to a secure website and I am having some difficulty
> understanding the process.  Here is what I have with my limited
> knowledge of the subject:
>
> ##Start Code##
> #!/usr/bin/env
> python
>
>
>
> import
> urllib
>
> import
> urllib2
>
>
>
> #
> Main
>
> params =
> urllib.urlencode({
>
> "user" :
> "username",
>
> "pass" :
> "password"
>
> })
>
>
>
> req = urllib2.Request("https://web.site.com/default.aspx";,
> params)
> data =
> urllib2.urlopen(req)
>
>
>
> for line in
> data.readlines():
>
> print line
> ##End Code##
>
> This just doesn't seem to work.  It just brings me back to a login screen.
> 
> If you can lend a hand it would be much appreciated.
> 
> -Tom

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


Reading output from standard out

2005-05-02 Thread Thierry Lam








Let’s say I have a python program which prints output
to standard out, let’s call it HelloApp.  How do I capture these outputs
from the python GUI tkinter? For example, I want to call HelloApp from my GUI
program and I want to send the output live to a tkinter text area.

 

Thanks

Thierry






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

Reading output from standard out

2005-05-02 Thread Thierry Lam








Let’s say I have a python program which prints output
to standard out, let’s call it HelloApp.  How do I capture these
outputs from the python GUI tkinter? For example, I want to call HelloApp from
my GUI program and I want to send the output live to a tkinter text area.

 

Thanks

Thierry






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

WMI Python, writing remotely and retrieving env variables values

2007-01-12 Thread Thierry Lam
I'm using the WMI library for python and I was able to connect to
another computer on the network with the following line:

c = wmi.WMI(computer="the-network-computer", user="hello",
password="hello")

Is there a way to write information to a file on that computer?

How do I read environment variables, for example SystemDrive?

Thierry

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


Finding yesterday's date with datetime

2006-05-15 Thread Thierry Lam
Is there an easy way to determine the yesterday's date(year-month-day)
from the python datetime library if I know today's date?

Thanks
Thierry

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


Converting a time string to a more readable date, time

2008-10-27 Thread Thierry Lam
I have a python time string which has the following value:

1225137896

The above corresponds to 2008/10/27 16:04:56

What can I use to convert 1225137896 to a more readable date, time
format?
--
http://mail.python.org/mailman/listinfo/python-list


Python poly obsolete?

2006-03-17 Thread Thierry Lam
I have a piece of python code which goes like the following:

import poly

list = [1, 2, 3]

result = poly.scan(list)

I'm using Python 2.3.4 and I don't think that poly library is working
properly, I read somewhere that's it's obsolete now. What's the
alternative?

Thanks
Thierry

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