In Powershell I installed boto-rsync using pip:

PS> pip install boto-rsync

That installed boto-rsync in C:\python27\Scripts as 'boto-rsync' as expected. I have C:\python27\Scripts in the path (pip.exe is there) but I can't invoke my new package from the command line, e.g:

PS> boto-rsync *from* *to*

You can't run Python scripts in PowerShell. (You can in Unix shells). You have to do this:

python.exe path/to/some/script.py

That assumes python.exe is in your path. Otherwise you have to do something like this:

C:\Python27\python.exe path/to/some/script.py
  • Not quite right. You can run Python scripts in PowerShell directly, given that they have the correct extension and are in the search path. If they have the .py extension, you can either call it with script.py, or add .py to the PATHEXT envvar and call it without the extension, just script. However, boto-rsync does not have an extension at all - as far as Windows is concerned, it is a file containing arbitrary data and cannot be directly executed (Windows does not use the shebang). – Bob Jan 12 '15 at 5:31
  • @Bob, thanks, I did not know that. I think Dizzley's best option here would be to write a little PowerShell wrapper script that calls python.exe with the appropriate parameters. – dangph Jan 12 '15 at 6:02
  • Yes, that is likely the best idea. You should edit that into your answer. (Actually, a batch script would work just as well in this case, potentially better if you don't want to deal with PS execution policies... also, .ps1 isn't in PATHEXT by default either.) – Bob Jan 12 '15 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.