Windows 10: How do I run this python script?

Discus and support How do I run this python script? in Windows 10 Customization to solve the problem; https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any... Discussion in 'Windows 10 Customization' started by DarryAG, May 9, 2023.

  1. DarryAG Win User

    How do I run this python script?


    https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any additional things or verify anything?Thanks if you can guide me.

    :)
     
    DarryAG, May 9, 2023
    #1

  2. Simple Python Scripts

    Hey exodusprime1337,
    Just got in from shoveling snow *Frown How do I run this python script? :(

    I'm all for suggesting Linux to people, but...
    I've also learned to keep my variables to a minimum.
    What I'm saying is, when learning something new,
    Python in this case, you don't want to add Linux and the
    shell into the mix as debugging is harder with 2 unknowns.

    Stick with your tried and true environment when experimenting
    w/ Python and when you have time to focus on Linux only
    start messing w/ shell scripting, perl and tcl/tk.
    Then you'll realize that you can do everything on Linux.

    For now just remove my she-bang line Code: #!/usr/bin/python[/quote] as it's only function is to tell the Linux kernel what interpreter to use.

    I'll have another script for you tonight *Smile How do I run this python script? :)
     
    regexorcist, May 9, 2023
    #2
  3. python script does not run from commandline

    hello,

    I'm having problems suddenly running .py scripts from the command line. (CMD)

    Before, *.py was associated with python.exe (The association was created during python installation, associating python scripts (.py) with the proper executable.

    With the proper association of the .py file to python.exe , the location of the python.exe in the %PATH% variable - and the python extension in the %PATHEXT% , just typing '.\myscript.py' would launch the script in using the correct python.exe (using the
    CMD line)

    However, for some reason this suddenly changed last week. Now, typing '.\myscript.py' does nothing - simply shows me the next prompt in the CMD window.

    typing 'python myscript.py' still works, but since there are a load of batch files lingering around running the .py scripts without the explicit 'python' prefix - I have no idea what changed and i'd like to find out what's going on and fix this.

    I browsed various forums - mentioning assoc and ftype, but these do not seem to do the trick

    (in fact, on my tablet, typing .\myscript.py perfectly executes, and assoc/ftype seem to have nothing set for python scripts in the CMD window)

    On the pc in question:

    assoc .py returns 'Python.File' , ftype Python.File shows the path/python.exe to my python executable - yet when typing myscript.py in the CMD line, it does nothing.

    I also tried associating the .py extension using the 'Run with' again, (was still showing 'python') but this too changed nothing.

    I also checked the registry, to see what windows might be doing with .py extension, but although there are some references to the .py extension, some of which referring to the python.exe I like to use, it's hard to see what's going on there (not sure which
    registry items are or used for what or even if they are used in win10.)

    I 'repaired' my python install - then completely reinstalled python (adding registry entries) but nothing changed.

    when typing '.\myscript.py' on the command line - nothing happens, just the next prompt.

    when double clicking the python script - it does seem to be associated with the proper python version, it does start using the right python.exe

    My question(s)

    - if possible, how do I see (using the cmd line) what is windows is actually doing (trying to do) when I type 'myscript.py' (can I start CMD using some debug/verbose options?)

    - How/where in windows do i control how a .py script runs in the commandline? - apart from the 'run with' is there any way to tell windows how to run my python script, when I type myscript.py on the command line?

    - are there additional options for the powershell to deal with this?

    - is there a way, again from windows, to add details to the 'run with' , rather then just starting the .py using a python from the list, to tell it to use certain arguments?

    - When using 'run with' , and seeing a python logo - is there a way to tell the exact path/execution line associated with that logo?

    (if not, i really think it should be possible to see this when that list pops up using some advanced settings or something )

    any help and insights would be much appreciated.

    cheers

    GJ
     
    GertJanOurensma, May 9, 2023
    #3
  4. How do I run this python script?

    Simple Python Scripts

    Some Python Database Scripts

    Here are some Python Sqlite Database Scripts.

    You need the sqlite3 module installed,
    (but it's normally part of the initial Python install package)

    This first script creates the DATABASE and TABLE:

    Code: #!/usr/bin/python import sqlite3 try: #Here is where we create the database var_connection = sqlite3.connect("linux_database.db") #Now we create the cursor for access var_cursor = var_connection.cursor() #Now we create a database table var_cursor.execute('''CREATE TABLE linux_table(distro VARCHAR(15), version VARCHAR(5), type VARCHAR(10))''') var_connection.commit() var_connection.close() print "" print "linux_database DATABASE has been created" print "distro_table TABLE has been created" print "" except (ImportError, RuntimeError, TypeError, NameError): print "" print "Error, exception thrown" print ""[/quote] Image of this script running on my system:


    How do I run this python script? [​IMG]



    This next script inserts pre-defined data into the newly created table.
    The pre-defined data is contained within multiple TUPLES and the
    tuples are contained within a LIST.

    Code: #!/usr/bin/python import sqlite3 try: #Here is where we connect to the database var_connection = sqlite3.connect("linux_database.db") #Now we create the cursor for access var_cursor = var_connection.cursor() var_data = [ ('Gentoo', '2010', 'rolling'), ('Arch', '2010', 'rolling'), ('Slackware', '13.0', 'fixed'), ('Fedora', '12.0', 'fixed'), ('Debian', '5.0', 'fixed'), ('Ubuntu', '9.10', 'fixed'), ('openSUSE', '11.3', 'fixed'), ('Mandriva', '2010', 'fixed'), ('Mint', '8.0', 'fixed'), ('PCLinuxOS', '2010', 'rolling'), ] var_cursor.executemany('''INSERT INTO linux_table(distro, version,type) VALUES(?, ?, ?)''', var_data) var_connection.commit() var_connection.close() print "" print "Data has been input successfully" print "" except (ImportError, RuntimeError, TypeError, NameError): print "" print "Error inputing data" print ""[/quote] Again, here is the script running on my system:


    How do I run this python script? [​IMG]



    This final script sends a query to the database and displays the result.

    Code: #!/usr/bin/python import sqlite3 try: #Here is where we create the database var_connection = sqlite3.connect("linux_database.db") #Now we create the cursor for access var_cursor = var_connection.cursor() var_cursor.execute('''SELECT distro, version, type FROM linux_table ORDER BY distro''') print "" column_width = 15 for column_description in var_cursor.description: print column_description[0].ljust(column_width) , print "" print "-" * 45 var_index = range(len(var_cursor.description)) #Loop through the cursor dataset to extract data for row in var_cursor: for index in var_index: var_value = str(row[index]) print var_value.ljust(column_width) , print "" var_connection.commit() var_connection.close() print "" except (ImportError, RuntimeError, TypeError, NameError): print "" print "Error, selecting data to be displayed" print ""[/quote]
    Here is the script output:


    How do I run this python script? [​IMG]



    Some basic database functions in Python.
    It's a simple into which you can build on.
    Have Fun with it!! *Wink How do I run this python script? ;)
     
    regexorcist, May 9, 2023
    #4
Thema:

How do I run this python script?

Loading...
  1. How do I run this python script? - Similar Threads - run python script

  2. I want to run a python script, when windows wake from sleep. HOW????

    in Windows 10 Gaming
    I want to run a python script, when windows wake from sleep. HOW????: Any way to run a task in task scheduler when windows 10 wake from sleep mode. https://answers.microsoft.com/en-us/windows/forum/all/i-want-to-run-a-python-script-when-windows-wake/e3ac7b46-ae63-463c-ba50-deffb799beee
  3. I want to run a python script, when windows wake from sleep. HOW????

    in Windows 10 Software and Apps
    I want to run a python script, when windows wake from sleep. HOW????: Any way to run a task in task scheduler when windows 10 wake from sleep mode. https://answers.microsoft.com/en-us/windows/forum/all/i-want-to-run-a-python-script-when-windows-wake/e3ac7b46-ae63-463c-ba50-deffb799beee
  4. I want to run a python script, when windows wake from sleep. HOW????

    in Windows 10 Customization
    I want to run a python script, when windows wake from sleep. HOW????: Any way to run a task in task scheduler when windows 10 wake from sleep mode. https://answers.microsoft.com/en-us/windows/forum/all/i-want-to-run-a-python-script-when-windows-wake/e3ac7b46-ae63-463c-ba50-deffb799beee
  5. 2147942667. on task scheduler when running python script

    in Windows 10 Gaming
    2147942667. on task scheduler when running python script: I am trying to run the Python script on the task scheduler but it gives the error 2147942667which means an invalid path. but that is correctone more thing I came around to was the permission that the user doesn't have permission to access the file but I have a single user...
  6. 2147942667. on task scheduler when running python script

    in Windows 10 Software and Apps
    2147942667. on task scheduler when running python script: I am trying to run the Python script on the task scheduler but it gives the error 2147942667which means an invalid path. but that is correctone more thing I came around to was the permission that the user doesn't have permission to access the file but I have a single user...
  7. How do I run this python script?

    in Windows 10 Gaming
    How do I run this python script?: https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any additional things or verify anything?Thanks if you can guide me....
  8. How do I run this python script?

    in Windows 10 Software and Apps
    How do I run this python script?: https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any additional things or verify anything?Thanks if you can guide me....
  9. MTP Python script

    in Windows 10 Ask Insider
    MTP Python script: I want to run a Python script using a MTP path (an external device). How can I write to it? submitted by /u/Geekest07 [link] [comments] https://www.reddit.com/r/Windows10/comments/f2g8ao/mtp_python_script/
  10. python script does not run from commandline

    in Windows 10 Customization
    python script does not run from commandline: hello, I'm having problems suddenly running .py scripts from the command line. CMD Before, *.py was associated with python.exe The association was created during python installation, associating python scripts .py with the proper executable. With the proper association...