Menu

#47 can't use pycmd.exe with COMSPEC env-variable

None
closed
None
1
2013-11-06
2013-08-13
arbeiter
No

this is LOW PRIORITY, and probably not a real bug.

pycmd runs well as an independant, standalone program,
both as python script, and as executable
(i compiled the latest version with pyinstaller, and the result pycmd.exe is a 3.3mb file)

BUT
i'd like it to be the default shell on my computer.

So tried to set this system envirnment varialbe:
COMSPEC=d:\programs\utils\pycmd.exe

(note: changing comspec usually requires a full restart)
But then pycmd doesn't work anymore. It fails on line 616:


PyCmd has encountered a fatal error!

Traceback (most recent call last):
File "<string>", line 693, in <module>
File "<string>", line 93, in main
File "<string>", line 546, in run_command
File "<string>", line 616, in run_in_cmd
File "D:\shahar\programs\pycmd\build\pyi.win32\PyCmd\outPYZ1.pyz/os", line 423, in getitem
KeyError: 'CD'

Crash report written to:
C:\Users\user\AppData\Roaming\PyCmd\crash-20130813_222151.log

Press any key to exit...


this is line 616 in pycmd.py:
cd = os.environ['CD'].decode(stdout.encoding)

if i add manually 'CD' into "os.environ", it doesn't give an error, but pycmd doesn't do anything, either.
os.environ['CD'] = os.path.abspath('.') # doesn't crash, but

Questions:

can pycmd used as a full replacement to cmd.exe?
or does it have to live "inside" it?

is there a way to use pycmd.exe with COMSPEC ? (it solves me few non-important cases, like running with total commander's open-command, and few other programs that open the default shell)

Thank you

Discussion

  • Horea Haitonic

    Horea Haitonic - 2013-09-13

    I don't think you can have PyCmd truly replace cmd.exe as COMSPEC. For one thing, it takes different arguments. Apart from this, it doesn't work 100% like cmd.exe: some things are not supported (ERRORLEVEL, pseudo-env-vars like CD, TIME etc, pushd/popd, doskey...) and probably many many others.

    In TotalCommander, I use a custom command in the Start menu to start PyCmd; this is not as elegant, but it does the job.

     
  • arbeiter

    arbeiter - 2013-09-13

    ok, thanks.
    maybe it's woth mentioning somewhere, (that it impossible to use with COMSPEC).

     
  • Horea Haitonic

    Horea Haitonic - 2013-11-06

    The README.txt now mentions this limitation.

    Also, google "pycmd comspec" points to this very page, so this should be easy to figure out from now on :)

     
  • Horea Haitonic

    Horea Haitonic - 2013-11-06
    • status: open --> closed
    • assigned_to: Horea Haitonic
    • Group: -->
     

Log in to post a comment.