Coder Social home page Coder Social logo

Echo command on windows 10 about doitlive HOT 8 CLOSED

sloria avatar sloria commented on May 22, 2024
Echo command on windows 10

from doitlive.

Comments (8)

sloria avatar sloria commented on May 22, 2024

I don't use Windows so can't diagnose this. Feel free to send a PR though.

from doitlive.

PandaWhoCodes avatar PandaWhoCodes commented on May 22, 2024

Full error

ashis@g33k:Desktop $ @echo off
Traceback (most recent call last):
  File "c:\python3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\python3\Scripts\doitlive.exe\__main__.py", line 9, in <module>
  File "c:\python3\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\python3\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\python3\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python3\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python3\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\python3\lib\site-packages\doitlive\cli.py", line 329, in play
    commentecho=commentecho)
  File "c:\python3\lib\site-packages\doitlive\cli.py", line 189, in run
    magicrun(command, **state)
  File "c:\python3\lib\site-packages\doitlive\keyboard.py", line 131, in magicrun
    extra_commands=extra_commands, test_mode=test_mode)
  File "c:\python3\lib\site-packages\doitlive\keyboard.py", line 119, in run_command
    return subprocess.call([shell, fp.name])
  File "c:\python3\lib\subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "c:\python3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "c:\python3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

from doitlive.

StephenRoille avatar StephenRoille commented on May 22, 2024

Hey @arthuro555, I just got the same issue running on Windows 10. If you look at the traceback you can see the error occurs on line 119 in keyboard.py:

File "c:\python3\lib\site-packages\doitlive\keyboard.py", line 119, in run_command return subprocess.call([shell, fp.name])

If you inspect the shell variable it seems to be equal to bin/bash. Obviously bash is not available out-of-the-box on Windows, but since you are using GitHub I assume you have git installed on your machine. Apparently, all you need to do is overwrite this shell value with your actual bash.exe path.

To resolve the issue I imported the sys module and added the following condition at the top of the run_command function in the keyboard.py file,

import sys
...
if sys.platform == "win32":
... # use the path to your bash.exe file here
... shell = "C:/Program Files/Git/usr/bin/bash.exe"

After that fix, I was able to use the doitlive play and doitlive record commands with no issues.
Hope this helps 😉

from doitlive.

sloria avatar sloria commented on May 22, 2024

You can set the shell within your session script, at the top of the file:

#doitlive shell: C:/Program Files/Git/usr/bin/bash.exe

from doitlive.

StephenRoille avatar StephenRoille commented on May 22, 2024

I tried to set the --shell flag directly from the command line but it didn't work (see documentation examples),

doitlive play session.sh --shell "C:\Program Files\Git\usr\bin\bash.exe"

I also tried to set a #doitlive shell comment within the session.sh file (as @sloria mentioned) and it worked just fine 👌 (see documentation configuration),

#doitlive shell: C:/Program Files/Git/usr/bin/bash.exe

Thanks for the tip.

from doitlive.

StephenRoille avatar StephenRoille commented on May 22, 2024

Correction from my previous post.

The program operates correctly after removing the comment
#doitlive shell: /bin/bash from the session.sh file and issuing the following command,

doitlive play session.sh --shell "C:\Program Files\Git\usr\bin\bash.exe"

So it seems the file comment #doitlive shell: has higher precedence than the --shell argument. I think this might be an undesirable effect, most command-line tools are designed to overwrite sensible defaults if command-line arguments are provided. But of course, that is just a personal opinion.

Nonetheless, thank you @sloria for sharing this beautiful and yet amusing package.

from doitlive.

sloria avatar sloria commented on May 22, 2024

So it seems the file comment #doitlive shell: has higher precedence than the --shell argument.

Woops, that's not intentional. I agree --shell should take precedence. PRs welcome to fix that.

Thanks for the kind words!

from doitlive.

sloria avatar sloria commented on May 22, 2024

Closing this for now; see workaround above to set your shell on Windows.

from doitlive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.