Windows 10: Python Error in Main Script

Discus and support Python Error in Main Script in Windows 10 Installation and Upgrade to solve the problem; Hi, Can anybody help me i am getting Python Error in main Script,... Discussion in 'Windows 10 Installation and Upgrade' started by Leannered77, Apr 7, 2020.

  1. Python Error in Main Script


    Hi, Can anybody help me i am getting Python Error in main Script,

    :)
     
    Leannered77, Apr 7, 2020
    #1

  2. Simple Python Scripts

    Hey exodusprime1337,
    Just got in from shoveling snow *Frown Python Error in Main 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 Python Error in Main Script :)
     
    regexorcist, Apr 7, 2020
    #2
  3. 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:


    Python Error in Main 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:


    Python Error in Main 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:


    Python Error in Main Script [​IMG]



    Some basic database functions in Python.
    It's a simple into which you can build on.
    Have Fun with it!! *Wink Python Error in Main Script ;)
     
    regexorcist, Apr 7, 2020
    #3
  4. Python Error in Main Script

    Simple Python Scripts

    Before we post any more scripts, I'd like to take
    a step back and go over the basic help function
    within the Python interactive console.
    (mine is on linux, not sure if the Windows version is exactly the same) *Confused Python Error in Main Script :confused:

    Here I start the Python console, it tells me what
    version I'm using and gives me a >>> prompt


    Python Error in Main Script [​IMG]


    Now I use the HELP function to view all the installed modules/libraries
    Code: help("modules")[/quote]
    Python Error in Main Script [​IMG]



    Python Error in Main Script [​IMG]


    Now to see what functions are contained within a particular module,
    we simply use help again. I'll be looking at the webbrowser module
    which can be seen in the list.
    Code: help("webbrowser")[/quote]
    Python Error in Main Script [​IMG]



    Python Error in Main Script [​IMG]


    By looking into the module, I see that I want to use the open_new(url) function,
    so my command(s) will look someting like this.
    I have to import the module to use the functions.

    Code: >>> import webbrowser >>> webbrowser.open_new("TechPowerUp")[/quote] As you can see from the image, my default browser opened to
    the specified url from within Python.


    Python Error in Main Script [​IMG]


    Help can navigate through any module, exposing the various
    functions which I hope will make your python coding easy and fun *Big Grin Python Error in Main Script :D

    Now lets do some scripting. *Wink Python Error in Main Script ;)
     
    regexorcist, Apr 7, 2020
    #4
Thema:

Python Error in Main Script

Loading...
  1. Python Error in Main Script - Similar Threads - Python Error Main

  2. A Java Script Error Occurred in the Main Process

    in Windows 10 Software and Apps
    A Java Script Error Occurred in the Main Process: I recently installed a Western Digital My Home Drive. Every time I reboot, I get an error that reads A Java Script Error Occurred in the Main Process. I spoke to them twice and they said it's a Windows error. I uninstalled the software and re-installed, and everything works...
  3. A Java Script Error Occurred in the Main Process

    in Windows 10 Drivers and Hardware
    A Java Script Error Occurred in the Main Process: I recently installed a Western Digital My Home Drive. Every time I reboot, I get an error that reads A Java Script Error Occurred in the Main Process. I spoke to them twice and they said it's a Windows error. I uninstalled the software and re-installed, and everything works...
  4. java script error in the main process

    in Windows 10 Customization
    java script error in the main process: Help!i downloaded OnVue app for a test but it says javascript error occurred in the main process. i tried the solutions posted by Mr William .i.e. to add regsvr32 jscript.dll to cmd but it still did not help. the software still does not launch the exam simulation. Can anyone...
  5. cx_Freeze: Python error in main script

    in Windows 10 BSOD Crashes and Debugging
    cx_Freeze: Python error in main script: I receive the above subject error message continuously on windows startup and it appears to be contributing to the poor performance of my Windows 10 PC causing it to run slowly and become unresponsive. I reviewed the article with a similar error message and applied the...
  6. Windows Terminal and Python scripts?

    in Windows 10 Ask Insider
    Windows Terminal and Python scripts?: The new Windows Terminal is so beautiful and well done that I completely switched over to it, but the only thing that bugs me is still seeing the basic console window when running a Python script by double clicking on it... I did manage to make a profile for Python console,...
  7. A Java Script error occured in the main process

    in Windows 10 Customization
    A Java Script error occured in the main process: I get an error message when I open the computer. A Java Script error occured in the main process. F-Secure asks you to allow Chrome browser add-on? I have a Chrome browser as the main browser. And the operating system is Windows 10. I'm asking for help step-by-step? Thanks...
  8. 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/
  9. cx_Freeze: Python error in main script

    in Windows 10 BSOD Crashes and Debugging
    cx_Freeze: Python error in main script: Hi, I have upgraded from Win 7 to Win 10. However, I have been received this error message with 100% utilisation of hard disk space. Can advise what is the issue and how to overcome it? I have disabled SysMain service. Regards, Akbar...
  10. cx_Freeze: Python error in main script

    in Windows 10 BSOD Crashes and Debugging
    cx_Freeze: Python error in main script: I receive the above subject error message continuously and it appears to be contributing to the poor performance of my Windows 10 PC causing it to run slowly and become unresponsive. I reviewed the article with a similar error message and applied the recommended fixes,...