[PythonCE] Loading .py files in PythonCE

goodey27 at juno.com goodey27 at juno.com
Thu Nov 6 14:37:16 EST 2003


David Youngblood <david_edi at yahoo.com> wrote:
> actually the problem you have involves another
> solution. I also had the same problem with it not able
> to load scripts if the path had a space in it. so i
> modified pcceshell.py so it could accept it.
> try this:
> 1) in pcceshell.py find the function 'def
> RunCode(shell):'
> 2) now scroll down 46 lines or so down till you find
> the code 'fname = sys.argv[0]'.
> 3) replace that line of code with the following:
> if sys.argv[0][0]=='\\' and sys.argv[0][-2:] != 'py':
>    if sys.argv[1][-2:]== 'py':
>       fname = sys.argv[0] + " " + sys.argv[1]
>    else:
>       fname = sys.argv[0]
> else:
>    fname = sys.argv[0]
> 4) thats it!
> 
> This is not a perfect solution because it assumes
> there is no more than 1 space in the pathname, but it
> has worked fine for me.
> Now when you click a py script that has a space in the
> file name it should load it fine.

The real fix for this problem is, to change the registry entry.
check first under
HKEY_CLASSES_ROOT
 .pyc
Default
To see what it says then goto that string under
HKEY_CLASSES_ROOT
 (name that you got from HKEY_CLASSES_ROOT .pyc)
  Shell
   Open
    Command
And make sure that the "Default" Value name has a string that looks like
this:
"\Program Files\Python\Python.exe" "%1"
Make sure esppecialy that there are double quotes around the "%1".
Then go and check 
HKEY_CLASSES_ROOT
 .py
and do the same for it.

(My registry looks like this and every thing wroks fine)
For a free registry editor goto.
http://www.phm.lu/products

Thanks
Isr

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!



More information about the PythonCE mailing list