[PythonCE] Loading .py files in PythonCE

David Youngblood david_edi at yahoo.com
Wed Nov 5 12:43:42 EST 2003

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
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]
      fname = sys.argv[0]
   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.

--- Voidspace <mike at pcblokes.com> wrote:

    This is the infuriating bug I had which was
causing Tkinter files tofail....

I fixed it myself last night when I suddenly
remembered I'd had it inthe last version......

The path of the file I'm trying to run is passed to
pccedhell *without*enclosing quotes (either a windows
foible or a pcceshell foible)...

*So* - it doesn't understand paths with spaces

I run my  main script from a special directory...
however my Tk test Iwas storing in 'My Documents'
which is why they failed.....

So the solution below looks like an interesting one
which I'll try....


David Youngblood wrote:
I had the same problem. I copied the
file'pcceshell.py' from my last version of python and
thenmade the following change to it:1) open it with a
file editor2) find the function 'def
RunCode(shell):'3) about 9 lines down find 'del
sys.argv[0]'4) comment this line out. '#del
sys.argv[0]'5) save this file to your python\lib
folder and try itagainHope this helps.David Y ---
Tharsan Bhuvanendran <tharsan at rogers.com> wrote:  
Hi I'm running the binaries distribution
fromhttp://www.validus.com/~kashtan And I'm wondering
how can I can load .py files? When I do try to open a
.py file with python.exe(from Windows/StartMenu), I
get a ValueError (need more than 1 value tounpack)
inlib/pcceshell.py, line 538 Thanks- Tharsan    
PythonCE mailing
listPythonCE at python.orghttp://mail.python.org/mailman/listinfo/pythonce
__________________________________Do you
Yahoo!?Protect your identity with Yahoo! Mail
listPythonCE at python.orghttp://mail.python.org/mailman/listinfo/pythonce

-- http://www.Voidspace.org.uk The Place where
headspace meets cyberspace. Online resource site -
covering science, technology, computing, cyberpunk,
psychology, spirituality, fiction and more.
Atlantibot coding message
has talent. What is rare is the courage to follow
talent to the dark place where it leads. -Erica
JongAmbition is a poor excuse for not having sense
enough to be lazy.         -Milan Kundera

Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

More information about the PythonCE mailing list