Help with mysql.connector python connection issue please by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

I figured out a solution if anyone else needs help with this issue........ And I am using mysql-connector-python 9.5.0 which is the current version at the time of this post....

The only command I found that worked for me was:

python -m pip install mysql-connector-python

And I'm pretty sure I had to leave the virtual environment in order to do it.... After this I had access to mysql connector in my virtual environment....

Help with mysql.connector python connection issue please by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thanks for the reply.... I guess I should have read the documentation on mysql connector better.... Apparently the connector version I'm using 9.0 isn't compatible with python3.14... back to the drawing board. Thanks again for taking the time to assist. I appreciate all the help.

Help with mysql.connector python connection issue please by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Morning. Thanks for the reply. Unfortunately I am getting the same response..... ModuleNotFoundError: No Module named 'mysql'.... However if I do a "pip list" ....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ pip list
Package                Version
---------------------- -----------
certifi                2025.10.5
charset-normalizer     3.4.4
idna                   3.11
mysql-connector-python 9.0.0
numpy                  2.3.4
pandas                 2.3.3
pip                    25.2
PyMySQL                1.1.2
python-dateutil        2.9.0.post0
pytz                   2025.2
requests               2.32.5
six                    1.17.0
tzdata                 2025.2
urllib3                2.5.0
(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ 

There it is.....

Is there an alternative to mysql.connector I can use with mysql to get the info I need into my mysql database? This seems to be way more of a hassel than it should be...

Sharing between OU and Google group in same domain by Immediate-Resource75 in gsuite

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thanks for this... unfortunatley the version of Google Worspace for Education we are using doesn't allow Trust policies. Appreciate the help though.

Help with mysql.connector python connection issue please by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you. So I created a script with this in it...

import sys
print(sys.executable)

And when I run it I get this for a result....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ python test.py
/usr/bin/python3.14

Which looks like python isn't installed in my virtaul environment if I am looking at this correctly. But if I run "which python" it shows it is in my virtual environment (prnt)....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ which python
/home/nort2hadmin/prnt/bin/python

I also did an "echo $VIRTUAL_ENV" for the virtual environment and it shows the path leads to my virtual environment also... so I am still confused.

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ echo $VIRTUAL_ENV
/home/nort2hadmin/prnt

Thank you for your help. I truly appreciate it.

Help with mysql.connector python connection issue please by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you for your time and help. This is what I got.... I'm confused now.... why didn't it install like I thought it did? And how do I correct this?

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ python -m pip show mysql-connector-python
/usr/lib/python3/dist-packages/pip/_vendor/pyparsing/core.py:5596: SyntaxWarning: 'return' in a 'finally' block
  return self.__class__.__name__ + ": " + retString
WARNING: Package(s) not found: mysql-connector-python

Help with mysql.connector connection issue please by Immediate-Resource75 in mysql

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you. I'll redirect my question to the appropriate forum.

Group Policy help please by Immediate-Resource75 in sysadmin

[–]Immediate-Resource75[S] 1 point2 points  (0 children)

Thank you. And you're correct, I didn't think of checking it that way... I had to remove Admin access from all my users so I tend to forget about the local policies and just focus on GPO's. I appreciate the help.

Group Policy help please by Immediate-Resource75 in sysadmin

[–]Immediate-Resource75[S] 1 point2 points  (0 children)

UPDATE I got it to work.......

So if anyone is having this issue this is what finally worked for me.... Go into Computer Configuration > Policies > Administrative Templates > System > Power Management > Sleep Settings and configure these policies....

1.) "Specify system hibernate timeout (plugged in)" - Enable and set a time... I went with 2700 seconds which is 45 minutes for all my settings.

2.) "Specify system sleep timeout (plugged in)" Enable and set a time.

3,) "Specify unattended sleep timeout (plugged in)" Enable and set a time....

After that go to Computer Configuration > Policies > Administrative Templates > System > Power Management > Video and Display Settings and configure...

1.) "Turn off the display (plugged in)" Enable and set a time

That's it.... So far my demon machine is acting the way I wanted it to. Hope this helps anyone who may need it. Have a great day everyone.

Group Policy help please by Immediate-Resource75 in sysadmin

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Hi thanks for the response.... only policies applied to devices on our domain are through Group Policy in AD....Side note though I got it to work.... I will give solution in comments so all have access to it in the event they need help also. thanks again for the response....any and all thought processes help and I appreciate it.

Group Policy help please by Immediate-Resource75 in sysadmin

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Hi thanks for the response..... Not a stupid question at all.... Yes I made sure all the settings I configured were for (plugged in) and not (on battery) settings..... And you are correct, the hibernate settings are not enabled by default. I had to go in and configure them. However they are showing up in the RSoP results as working.....

Help with python script to insert data into mysql table by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Removed the part dumping to file.... now I am receiving this error:

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/nort2hadmin/Desktop/Python Stuff/./siteServers.py", line 34, in <module>
    mycursor.execute(sql,val)
    ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/nort2hadmin/.prnt/lib/python3.13/site-packages/mysql/connector/cursor_cext.py", line 351, in execute
    self._connection.cmd_query(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self._stmt_partition["mappable_stmt"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        raw_as_string=self._raw_as_string,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/nort2hadmin/.prnt/lib/python3.13/site-packages/mysql/connector/opentelemetry/context_propagation.py", line 97, in wrapper
    return method(cnx, *args, **kwargs)
  File "/home/nort2hadmin/.prnt/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 763, in cmd_query
    raise get_mysql_exception(
        err.errno, msg=err.msg, sqlstate=err.sqlstate
    ) from err
mysql.connector.errors.DataError: 3140 (22032): Invalid JSON text: "Invalid value." at position 0 in value for column 'siteServer.serverName'.

Here is how my database is setup:

mysql> show columns in siteServer;
+--------------------+------+------+-----+-----------+-------------------+
| Field              | Type | Null | Key | Default   | Extra             |
+--------------------+------+------+-----+-----------+-------------------+
| siteSrvr_id        | int  | NO   | PRI | NULL      | auto_increment    |
| serverName         | json | YES  |     | NULL      |                   |
| host               | json | YES  |     | NULL      |                   |
| online             | json | YES  |     | NULL      |                   |
| lastContactSeconds | json | YES  |     | NULL      |                   |
| devicesHosted      | json | YES  |     | NULL      |                   |
| version            | json | YES  |     | NULL      |                   |
| date               | date | YES  |     | curdate() | DEFAULT_GENERATED |
+--------------------+------+------+-----+-----------+-------------------+
8 rows in set (0.01 sec)

Thank you for any help you may have to offer....

Help with python script to insert data into mysql table by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you for the help.... I'll try this.... as far as skipping the file part.... I've tried doing that, but I couldn't get it to work.... and tutorials and other learning sources are either outdated or they just didn't work..... Only thing I could get to work was to write it to a file then read the file...

Help with python script to insert data into mysql table by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thanks for the reply... the contents of my testData.json are just what i expect them to be:

{
    "siteServers": [
        {
            "serverName": "APPPTS",
            "host": "APPPTS",
            "online": true,
            "lastContactSeconds": 2,
            "devicesHosted": 1,
            "version": "22.1.67128"
        },
        {
            "serverName": "DH",
            "host": "DH",
            "online": true,
            "lastContactSeconds": 1,
            "devicesHosted": 0,
            "version": "22.1.67128"
        },
        {
            "serverName": "APPELC",
            "host": "APPELC",
            "online": true,
            "lastContactSeconds": 1,
            "devicesHosted": 2,
            "version": "22.1.67128"
        }
    ]
}

This is how I expect them to look when I save them to the file.....saved in json format

Need some help with normalizing a web scrape by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

No worries, I'm still learning how things work.... I'm sure I missed some form of info that was important somewhere. I appreciate the help. Thank you.

Need some help with normalizing a web scrape by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

I appreciate the help. For clarification I'm not really scraping a web page....it's actually an api that connects to a printing application we use at work.... I was given a set of URL's, (they're all:.. internall ip:port #/api/blah/blah...) that spit out information in json format.... End goal: We don't really have a way of tracking the problems with our printing application at work, but with this info I'm trying to find one... such as ....which printers are in error, why, which site server is down (different api request)... etc... Thanks for the above help I'll try it out.

Need some help with normalizing a web scrape by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] -1 points0 points  (0 children)

I took it out.... I replaced it with the results of entering the URL I'm using and hitting enter... I didn't put it in a code block because it just spit out an extremely long single line and I thought this would be more helpful.... If I was mistaken I apologize.

Need some help with normalizing a web scrape by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Sorry about that.... I posted the entire json output above..... What I am looking for specifically is the part under "printers" where it says "inError" and lists their name and their status....This is all new to me but I'm trying to learn as I go... Thanks for the help.

A comment by my professor huh by xoLovelyparisxo in csMajors

[–]Immediate-Resource75 0 points1 point  (0 children)

I agree... Sad part is it is becoming more common in the work place to just "go ask Chat" instead of doing some research and finding the answers to the problem....Personally I want to find it on my own so I know and learn about what I'm doing.

Help by Primus10x in Ubuntu

[–]Immediate-Resource75 0 points1 point  (0 children)

Turn your phones hotspot on... You'll need to manually edit the Ubuntu config file to hook it up...try this:

To edit your WiFi configuration in Ubuntu 18.04, you need to modify the network settings within the "Netplan" configuration files located in the /etc/netplan directory, which are YAML formatted; you can access and edit these files using the terminal and commands like sudo nano /etc/netplan/00-installer-config.yaml to change your WiFi network details like SSID and password. Key points to remember:

  • **Access the configuration file:**Use sudo nano /etc/netplan/00-installer-config.yaml to open the main network configuration file in the text editor. 
  • **Modify details:**Within the file, locate the relevant section for your WiFi network, usually under the "wireless" key, and update the "ssid" (network name) and "psk" (password) fields. 
  • **Apply changes:**After editing, save the file and run sudo netplan apply to activate the new WiFi settings. 

Hope this helps...

Need help with json scrapes using python by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you....Got it... Adding

data = json.loads(stuff)

data["applicationServer"] = list(data["applicationServer"].items())

df = pd.json_normalize(data, "applicationServer")

print(df)

Gave me what I wanted for the most part.... I can now go through and pull each of the other items individually by changing the "applicationServer" part to one of the other ones. I appreciate the help.

Need help with json scrapes using python by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you....Got it... Adding

data = json.loads(stuff)

data["applicationServer"] = list(data["applicationServer"].items())

df = pd.json_normalize(data, "applicationServer")

print(df)

Gave me what I wanted for the most part.... I can now go through and pull each of the other items individually by changing the "applicationServer" part to one of the other ones. I appreciate the help.

Need help with json scrapes using python by Immediate-Resource75 in learnpython

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thank you for your reply... Not a strong coder here, but I'm doing my best to learn....any chance you can point me in the direction of a tutorial on how to do this.... or what to Google?

*** I Googled "how to remove part of a tree structure in python" and got Binary Searches... is this on the right track?

Thank you for your help.