published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 1500 42000 CPM = 35.7143 per 1,000 exit=0 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 7 1500 edge: YouTube Help worked example, 7 over 1,500 monetized playbacks CPM = 4.6667 per 1,000 exit=0 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 1,500 42,000 edge: numbers typed with thousands separators CPM = 35.7143 per 1,000 exit=0 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 250 0 edge: zero impressions error: impressions must be greater than 0 exit=1 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm -5 1000 edge: negative spend error: spend must not be negative exit=1 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm abc 5 edge: text instead of a number error: not a number: 'abc' exit=1 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 12,5 1000 edge: a decimal comma is refused, not read as 125 error: comma only as a thousands separator, like 1,500; write decimals with a dot: '12,5' exit=1 published: python3 cpm.py cpm 1500 42000 run: python3 cpm.py cpm 12.5 1000.5 edge: fractional impressions: the script accepts them, the calculator asks for a whole number CPM = 12.4938 per 1,000 exit=0 published: python3 cpm.py spend 20 30000 run: python3 cpm.py spend 20 30000 spend = 600.0000 exit=0 published: python3 cpm.py spend 20 30000 run: python3 cpm.py spend 0 30000 edge: a free placement, CPM 0 spend = 0.0000 exit=0 published: python3 cpm.py spend 20 30000 run: python3 cpm.py spend -20 30000 edge: negative CPM error: CPM must not be negative exit=1 published: python3 cpm.py impressions 600 20 run: python3 cpm.py impressions 600 20 impressions = 30000.0000 exit=0 published: python3 cpm.py impressions 600 20 run: python3 cpm.py impressions 600 0 edge: CPM 0 would divide by zero error: CPM must be greater than 0 exit=1 published: python3 cpm.py impressions 600 20 run: python3 cpm.py impressions -600 20 edge: negative spend error: spend must not be negative exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file deals.csv video A: 35.7143 per 1,000 video B: 20.0000 per 1,000 video C: 5.0000 per 1,000 exit=0 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-crlf-nonascii.csv edge: Windows line breaks and a non-ASCII label video รค: 35.7143 per 1,000 exit=0 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-empty.csv edge: empty file error: no data rows in edge-empty.csv exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file nope.csv edge: missing file error: file not found: nope.csv exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-zero.csv edge: a row with 0 impressions error: row 1: impressions must be greater than 0 exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-unquoted-comma.csv edge: 1,500 typed unquoted in a CSV splits into two columns error: row 1 needs exactly 3 comma-separated columns: label,spend,impressions exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-bad-first-row.csv edge: first row has text in the spend cell error: row 1: not a number: 'abc' exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file edge-semicolon.csv edge: semicolons instead of commas error: row 1 needs exactly 3 comma-separated columns: label,spend,impressions exit=1 published: python3 cpm.py file deals.csv run: python3 cpm.py file /tmp edge: a directory instead of a file error: cannot read as a file: /tmp exit=1