Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Python function executes twice when region loop is present
Post: RE: Python function executes twice when region loo...

(Jan-06-2020, 11:06 PM)ichabod801 Wrote: The instance count is reported in report_instance_stats. This is called on line 139, at the end of the 'for instance' loop on line 38. But that's within the ...
bluethundr General Coding Help 2 2,595 Jan-07-2020, 03:01 PM
    Thread: Python function executes twice when region loop is present
Post: Python function executes twice when region loop is...

This function lists all the instances in an AWS account. It does that for each region. For some reason I end up with the total number of instances reported by the function is doubled when the region l...
bluethundr General Coding Help 2 2,595 Jan-06-2020, 09:21 PM
    Thread: Python function returns inconsistent results
Post: RE: Python function returns inconsistent results

(Dec-20-2019, 04:00 PM)stullis Wrote: If you run it a third time, does it triple? What happens if you wait a couple minutes before running it again? The only way I see it doubling the number of inst...
bluethundr General Coding Help 4 3,137 Dec-20-2019, 04:34 PM
    Thread: Python function returns inconsistent results
Post: Python function returns inconsistent results

I wrote a script that lists EC2 instances in Amazon Web Services. It writes the results to confluence. But it's behaving oddly. I'm on windows 10. The first time you run it from the command line it...
bluethundr General Coding Help 4 3,137 Dec-20-2019, 03:22 PM
    Thread: python script fails with a lot of data
Post: RE: python script fails with a lot of data

(Nov-11-2019, 12:12 AM)Larz60+ Wrote: error is pretty clear: Quote:requests.exceptions.HTTPError: 400 Client Error: for url: https://wiki.us.cworld.company.com/rest/.../138317098 400 error is bad r...
bluethundr General Coding Help 2 2,098 Nov-11-2019, 01:35 PM
    Thread: python script fails with a lot of data
Post: python script fails with a lot of data

I wrote a python script that seemed to work pretty well. It lists EC2 instances in AWS and then writes them to our Confluence wiki. If it processes one environment with 10 servers it works and writes...
bluethundr General Coding Help 2 2,098 Nov-10-2019, 11:57 PM
    Thread: web scraping to csv formatting problems
Post: RE: web scraping to csv formatting problems

(Jul-03-2019, 02:32 AM)Larz60+ Wrote: The URL posted doesn't appear to be valid Yes, I am aware. Perhaps I should have clarified in the OP. This is a company URL, and I am not allow to post specific...
bluethundr Web Scraping & Web Development 4 2,732 Jul-03-2019, 09:23 PM
    Thread: web scraping to csv formatting problems
Post: web scraping to csv formatting problems

Hello, I am trying to scrape a web page and send the result to CSV. I am able to get the content I want in the CSV. However, the content is being repeated down the page and unique info is sent across...
bluethundr Web Scraping & Web Development 4 2,732 Jul-02-2019, 08:38 PM
    Thread: Python requests writes the name of the file instead of contents to web page
Post: Python requests writes the name of the file instea...

I have a function that tries to write a web page into conflunece. Instead of posting the contents of a file, it writes the name of the file to the web page. I am using the python requests module to w...
bluethundr General Coding Help 1 2,123 Jun-05-2019, 04:43 PM
    Thread: Step through a really large CSV file incrementally in Python
Post: RE: Step through a really large CSV file increment...

(May-06-2019, 08:14 PM)Yoriz Wrote: Maybe something like this will work Note All code not tested with open(source) as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') next(csv_re...
bluethundr General Coding Help 6 6,836 May-07-2019, 02:48 AM
    Thread: Step through a really large CSV file incrementally in Python
Post: Step through a really large CSV file incrementally...

I am trying to speed up loading a large CSV file into a MySQL database. I'm using this code it takes about 4 hours to load a 4GB file with millions of rows: with open(source) as csv_file: csv_rea...
bluethundr General Coding Help 6 6,836 May-06-2019, 06:43 PM
    Thread: Read CSV file into MySQL and use executemany instead of execute
Post: Read CSV file into MySQL and use executemany inste...

I have a python script that reads a large (4GB!!!) CSV file into MySQL. It works as is, but is DOG slow. The CSV file has over 4 million rows. And it is taking forever to insert all the records into t...
bluethundr General Coding Help 1 4,163 May-04-2019, 03:05 AM
    Thread: Importing a CSV loops to infinity in python
Post: RE: Importing a CSV loops to infinity in python

(May-03-2019, 03:25 PM)buran Wrote: (May-03-2019, 03:19 PM)bluethundr Wrote: Why is this code looping infinitely???it's not looping infinitely, but every time you run it, it starts from the top of...
bluethundr General Coding Help 2 3,496 May-03-2019, 03:28 PM
    Thread: Importing a CSV loops to infinity in python
Post: Importing a CSV loops to infinity in python

I've accidentally created an infinite loop importing a CSV file using python and importing it into MySQL. I don't see where the error is! This is my code: import os import mysql.connector import csv...
bluethundr General Coding Help 2 3,496 May-03-2019, 03:19 PM
    Thread: charmap codec can't decode byte error with gzipped file in python
Post: RE: charmap codec can't decode byte error with gzi...

(Apr-30-2019, 04:58 AM)snippsat Wrote: You should post all Traceback because there is also line number of error. Also all email imports should be posted. Try line 11: body = MIMEText(content, 'html...
bluethundr General Coding Help 2 3,666 Apr-30-2019, 12:26 PM
    Thread: charmap codec can't decode byte error with gzipped file in python
Post: charmap codec can't decode byte error with gzipped...

I am attempting to send an email that includes a file in gzip format as an attachment using python. But I'm getting an error when I try to send the file. This is the exception I'm getting: Excep...
bluethundr General Coding Help 2 3,666 Apr-29-2019, 09:53 PM
    Thread: Import Large CSV File into MySQL
Post: Import Large CSV File into MySQL

Hello, I'm trying to import one column of a large CSV file into MySQL using python 3.7. This is being done as a test run to import the rest of the columns. For now, I can't even get the one column ...
bluethundr General Coding Help 2 7,106 Apr-28-2019, 05:26 PM
    Thread: if /else statement not executing correctly
Post: RE: if /else statement not executing correctly

(Apr-15-2019, 08:58 PM)Larz60+ Wrote: line 8 and 14 indent is incorrect change line 13 to: if add_group_name.strip() == 'quit': on second look: remove lines 13 and 14 entirely change line 11 to: whi...
bluethundr General Coding Help 3 2,729 Apr-15-2019, 10:20 PM
    Thread: if /else statement not executing correctly
Post: if /else statement not executing correctly

I am trying to get a list of groups in an aws account. Then allow a user to add the groups to a user name, until the user enters quit: group_list = client.list_groups() all_groups = [] for group in gr...
bluethundr General Coding Help 3 2,729 Apr-15-2019, 08:53 PM
    Thread: Get EC2 Regions and Zones to correspond
Post: Get EC2 Regions and Zones to correspond

Hello, I'm trying to pull a list of AWS EC2 instances. I need to pull a list of instances from each AWS zone and region. Problems I'm having: Need to pull instances only from corresponding zone and...
bluethundr General Coding Help 0 1,310 Mar-11-2019, 06:12 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020