Setting Current Dir in Python

2007-09-04 Thread Sandipan Gangopadhyay
Hi all!

I have utility programs in Python that do clean up, image processing tasks
on files in a folder. I just drop the program into the folder and run it.

I have been double clicking on a Python program in my Windows XP Home to
make it run . it sets the program's directory as the current directory when
it runs.

I have recently installed Python 2.5.1 and Pythonwin (without any errors) on
Windows Vista Ultimate.

Now, the programs run fine within Pythonwin IDE when current directory is
set to the program's directory.

But, when I double click them from Windows Explorer, the program is not run.

If I run the following program:


===
# MODULE IMPORT
try:
import time, os, Image, urllib, string, math, os.path, filecmp, shutil,
sys
except:
strInput = raw_input("Failed import. Hit enter key to continue.")
pass

# FIGURE OUT CURR DIR
try:
print "CURENT = %s" % os.listdir(".")
print "PARENT = %s" % os.listdir("..")
print "ABS PATH = %s" % os.path.abspath(".")
print "CURENT = %s" % os.listdir(os.curdir)
print "PARENT = %s" % os.listdir(os.pardir)
except:
strInput = raw_input("Failed os module calls. Hit enter key to end.")
pass

print
strInput = raw_input("Hit enter key to end program")

Through Pythonwin IDE without setting the directory (using Open, or Save
As), I get:


===
CURENT = ['addins', 'AppPatch', 'assembly', 'atl80.dll',  . - snip - . ,
'winsxs', 'WMSysPr9.prx', 'xpsp1hfm.log', '_default.pif']
PARENT = ['$Recycle.Bin', 'autoexec.bat', 'Boot', 'bootmgr', 'BOOTSECT.BAK',
'config.sys', 'Documents and Settings', . - snip - . , 'Program Files',
'ProgramData', 'Python25', . - snip - . , 'System Volume Information',
'temp', 'Users', 'Windows']
ABS PATH = C:\Windows
CURENT = ['addins', 'AppPatch', 'assembly', 'atl80.dll', . - snip - ., ,
'winsxs', 'WMSysPr9.prx', 'xpsp1hfm.log', '_default.pif']
PARENT = ['$Recycle.Bin', 'autoexec.bat', 'Boot', 'bootmgr', 'BOOTSECT.BAK',
'config.sys', 'Documents and Settings', . - snip - . , 'Program Files',
'ProgramData', 'Python25', . - snip - . , 'System Volume Information',
'temp', 'Users', 'Windows']

If I run it using double click on the program through Windows Explorer, I
get:


===
Nothing . the window closes immediately. Despite the except catches.

If I run it from a Command Prompt, by first navigating to the program's
directory and then specifying [ python.exe SandhirFileMonitor.py ], I get:


===
sys:1: DeprecationWarning: Non-ASCII character '\xef' in file
SandhirFileMonitor.py on line 356, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details
Failed import. Hit enter key to continue.
CURENT = ['Diff.txt', 'Folder2', 'report-templates', 'reports - Copy
(2).html','reports - Copy (3).html', 'reports - Copy (4).html', 'reports -
Copy (5).html', 'reports - Copy.html', 'reports.html',
'SandhirFileBackupUtility - Copy.py', 'SandhirFileBackupUtility.py',
SandhirFileBackupUtility.py - Shortcut.lnk', 'SandhirFileMonitor.py']
PARENT = ['BackupV10', 'BackupV11', 'DayReadiness', 'reporterV70']
ABS PATH =
E:\Data\ActiveData\SandipanPersonalData\FromNODE06\SoftwareBackups\BackupV11
CURENT = ['Diff.txt', 'Folder2', 'report-templates', 'reports - Copy
(2).html', 'reports - Copy (3).html', 'reports - Copy (4).html', 'reports -
Copy (5).html', 'reports - Copy.html', 'reports.html',
'SandhirFileBackupUtility - Copy.py', 'SandhirFileBackupUtility.py',
'SandhirFileBackupUtility.py - Shortcut.lnk', 'SandhirFileMonitor.py']
PARENT = ['BackupV10', 'BackupV11', 'DayReadiness', 'reporterV70']

I am obviously missing something very simple, but I can't figure this out .
it's been a few days now.

Can someone help? Thanks.

Sandipan


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


Python for BlackBerry

2008-03-15 Thread Sandipan Gangopadhyay
Is there a Python for BlackBerry? Thanks.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of E-Lo
Sent: Saturday, March 15, 2008 6:03 AM
To: python-list@python.org
Subject: Python for Palm OS

Is there any other edition of Python for Palm OS instead of Pippy?
-- 
http://mail.python.org/mailman/listinfo/python-list


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


RE: Python for BlackBerry

2008-03-15 Thread Sandipan Gangopadhyay
Thanks, Mike.
This one seems to be for Nokia, particularly S60 and Symbian in general.
Does BlackBerry work on Symbian? Let me check.
Thanks.
Sandipan

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike
Driscoll
Sent: Saturday, March 15, 2008 6:04 PM
To: python-list@python.org
Subject: Re: Python for BlackBerry

On Mar 15, 7:24 am, "Sandipan Gangopadhyay"
<[EMAIL PROTECTED]> wrote:
> Is there a Python for BlackBerry? Thanks.
>
> -Original Message-
> From: [EMAIL PROTECTED]
>
> [mailto:[EMAIL PROTECTED] On Behalf Of
E-Lo
> Sent: Saturday, March 15, 2008 6:03 AM
> To: [EMAIL PROTECTED]
> Subject: Python for Palm OS
>
> Is there any other edition of Python for Palm OS instead of Pippy?
> --http://mail.python.org/mailman/listinfo/python-list

You might look at Mobile Python. I'm not sure if it works on
Blackberry though: http://www.mobilepythonbook.org/

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


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


RE: Python for BlackBerry

2008-03-16 Thread Sandipan Gangopadhyay
I checked; BlackBerry is not on Symbian.
They provide a Java Dev Envt (whatever that may mean).
Does that mean, we can try and implement JPython/Jython on it?
Thanks.
Sandipan

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike
Driscoll
Sent: Sunday, March 16, 2008 8:47 AM
To: python-list@python.org
Subject: Re: Python for BlackBerry

On Mar 15, 9:52 pm, "Sandipan Gangopadhyay"
<[EMAIL PROTECTED]> wrote:
> Thanks, Mike.
> This one seems to be for Nokia, particularly S60 and Symbian in general.
> Does BlackBerry work on Symbian? Let me check.
> Thanks.
> Sandipan
>
> -Original Message-
> From: [EMAIL PROTECTED]
>
> [mailto:[EMAIL PROTECTED] On Behalf Of
Mike
> Driscoll
> Sent: Saturday, March 15, 2008 6:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Python for BlackBerry
>
> On Mar 15, 7:24 am, "Sandipan Gangopadhyay"
> <[EMAIL PROTECTED]> wrote:
> > Is there a Python for BlackBerry? Thanks.
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
>
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> E-Lo
> > Sent: Saturday, March 15, 2008 6:03 AM
> > To: [EMAIL PROTECTED]
> > Subject: Python for Palm OS
>
> > Is there any other edition of Python for Palm OS instead of Pippy?
> > --http://mail.python.org/mailman/listinfo/python-list
>
> You might look at Mobile Python. I'm not sure if it works on
> Blackberry though:http://www.mobilepythonbook.org/
>
> Mike
> --http://mail.python.org/mailman/listinfo/python-list

I was afraid of that. I'm at PyCon and between their flakey wireless
and my own laptop's flakey wireless card, it''s been a pain to do any
research. Good luck.

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


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