How to access my custom python scripts from CLI in order for them to act on any file?

user2986242

I am having difficulty accessing my custom scripts from the command line (python3 unzipit.py "C:\Users\Me\downloads\zipfilehome"). I want to have my scripts act on any file, no matter where they are. I don't want to have the script file in the same directory in order for it to work. I followed this question's top answer to no avail. Note: I am using Windows 10 and all my python versions are in the path with no issues accessing them.

What I did (I always refresh my CLI with every change)

In the system environmental variables:

Path: (unchanged since installation) C:\Path2Python27;C:\Path2Python27\scripts;C:\Path2Python37;C:\Path2Python37\scripts;

PYTHONPATH: C:\Path2Python37;C:\Path2Python37\scripts;C:\Users\Me\myscripts\py

Things I also tried

  • system environmental variables

Path: C:\Path2Python27;C:\Path2Python27\scripts;C:\Path2Python37;C:\Path2Python37\scripts;C:\Users\Me\myscripts\py

  • moving the same stuff to user env's Path
  • moving the above-shown system PYTHONPATH to the user env

What else am I missing? I don't understand.


All in all, what I needed to get this working:

system environmental variables

Path: C:\Path2Python27;C:\Path2Python27\scripts;C:\Path2Python37;C:\Path2Python37\scripts;

PYTHONPATH: C:\Users\Me\myscripts\py

and

making sure to use Andriy's comment. It won't work using python3 unzipit.py "C:\link\to\folder".

Andriy Ivaneyko

In order to achieve what you want you have to specify -m flag and the module name, so python will retrieve module by looking up python module path. See more here in interface-options. The command shall be:

python3 -m unzipit "C:\Users\Me\downloads\zipfilehome"

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to access a custom function from any file in the same Swift project?

分類Dev

How to write global functions in Yii2 and access them in any view (not the custom way)

分類Dev

How to deny direct acceess to a file but allow access to use it in scripts in only my website?

分類Dev

How do I search for lines in a file that only contain ASCII characters and then act on them?

分類Dev

Scrapy: How to access the custom, CLI passed settings from the __init__() method of a spider class?

分類Dev

how to open multiple file from single file which is having list of files in python and how to do processing on them?

分類Dev

Access custom environment variable from Jenkins file

分類Dev

How to access property of suggestions coming from my AutoSuggest ( custom made using .filter() )

分類Dev

How to correctly identify the file storage directory of AnkiDroid (or any other external app) from my application?

分類Dev

how to access part of my csv file - android

分類Dev

How to extract tags from HTML file and write them to a new file?

分類Dev

WooCommerce - Access 'WC_Order' from a separate PHP File

分類Dev

Java to display words from my text file in descending order?

分類Dev

How can I access a JsonResult variable in my code behind file from the javascript of my view? Razor Pages. C#

分類Dev

How to access custom JSON file in shopify at liquid file level

分類Dev

How can I access path variables in my custom HandlerMethodArgumentResolver

分類Dev

How can I access path variables in my custom HandlerMethodArgumentResolver

分類Dev

how to get values from xml file then print them using php

分類Dev

How to access a file from asset/raw directory

分類Dev

How access to react component from external file

分類Dev

How can i create a custom ListView with my xml layout file?

分類Dev

How to parse commands from a text file to a bash script in the CLI

分類Dev

How to run the bash scripts file?

分類Dev

(Qt) Read access error when attempting to use any function from another widget class on my MainWindow

分類Dev

How can I make python's argparse accept any number of [-R a b]s, and aggregate them into a list

分類Dev

How do I `eslint` my JavaScript when it depends on objects from previously loaded scripts?

分類Dev

How to add custom scripts to Firefox context menu?

分類Dev

How to access my HDFS filesystem from another machine?

分類Dev

How do I access my ubuntu server from anywhere in the world?

Related 関連記事

  1. 1

    How to access a custom function from any file in the same Swift project?

  2. 2

    How to write global functions in Yii2 and access them in any view (not the custom way)

  3. 3

    How to deny direct acceess to a file but allow access to use it in scripts in only my website?

  4. 4

    How do I search for lines in a file that only contain ASCII characters and then act on them?

  5. 5

    Scrapy: How to access the custom, CLI passed settings from the __init__() method of a spider class?

  6. 6

    how to open multiple file from single file which is having list of files in python and how to do processing on them?

  7. 7

    Access custom environment variable from Jenkins file

  8. 8

    How to access property of suggestions coming from my AutoSuggest ( custom made using .filter() )

  9. 9

    How to correctly identify the file storage directory of AnkiDroid (or any other external app) from my application?

  10. 10

    how to access part of my csv file - android

  11. 11

    How to extract tags from HTML file and write them to a new file?

  12. 12

    WooCommerce - Access 'WC_Order' from a separate PHP File

  13. 13

    Java to display words from my text file in descending order?

  14. 14

    How can I access a JsonResult variable in my code behind file from the javascript of my view? Razor Pages. C#

  15. 15

    How to access custom JSON file in shopify at liquid file level

  16. 16

    How can I access path variables in my custom HandlerMethodArgumentResolver

  17. 17

    How can I access path variables in my custom HandlerMethodArgumentResolver

  18. 18

    how to get values from xml file then print them using php

  19. 19

    How to access a file from asset/raw directory

  20. 20

    How access to react component from external file

  21. 21

    How can i create a custom ListView with my xml layout file?

  22. 22

    How to parse commands from a text file to a bash script in the CLI

  23. 23

    How to run the bash scripts file?

  24. 24

    (Qt) Read access error when attempting to use any function from another widget class on my MainWindow

  25. 25

    How can I make python's argparse accept any number of [-R a b]s, and aggregate them into a list

  26. 26

    How do I `eslint` my JavaScript when it depends on objects from previously loaded scripts?

  27. 27

    How to add custom scripts to Firefox context menu?

  28. 28

    How to access my HDFS filesystem from another machine?

  29. 29

    How do I access my ubuntu server from anywhere in the world?

ホットタグ

アーカイブ