dBase for my website always gives me this error “Invalid syntax”

0 votes

I have a web page I have developed and now am stuck getting told that the syntax is wrong. I cannot find the error, can someone please help me find my error? Here is my code for the database that is giving me my error:

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup 
from models import *

import os # File I/O
import time
import shutil
import glob
import configparser
config_parser = configparser.ConfigParser()

pdownload_dir = os.path.abspath('./prism_downloads/')
dt = str(datetime.datetime.now())
filelist = glob.glob(download_dir + '/*.html')
dbpath = ('./db')
def db_Prism():

        database.create_tables([Prism], safe=False)

        for root, dir, files in os.walk(pdownload_dir):
            for file in files:
                file_markup = ''
                with open(os.path.abspath(os.path.join(pdownload_dir, file)), 'r') as html:
                    file_markup = html.read()
                if file_markup == '':
                    print('ERROR: File was not read')
                print('Reading {0} into BS4'.format(file))
                soup = BeautifulSoup(file_markup, 'html.parser')
                print('File parsed')
                data = []
                table = soup.find('table')
                rows = table.find_all('tr') # 18th row is header row 
                cols = rows[0].find_all('td')
                cols = [ele.text.strip() for ele in cols] 
                for row in rows[0:]:
                    d = row.find_all('td')
                    d = [ele.text.strip() for ele in d]
                    data.append([ele for ele in d if ele]) # Get rid of empty values 
Line 96                 database.close()

Now here is the error message from my console:

C:\Users\Documents\NetBeansProjects\BudgetHome>python prism.py
  File "prism.py", line 96
SyntaxError: invalid syntax


Help please :(

Mar 30, 2018 in Selenium by Shubham
• 12,790 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Seems like you are missing a close parenthesis at the end of line 95. And you should also outdent line 96 two levels (even with the database.connect() statement).
answered Mar 30, 2018 by nsv999
• 5,050 points

Related Questions In Selenium

+1 vote
2 answers

Getting this error: “Element is not clickable at point”

There are 3 possible solutions for this: 1. ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,590 points
0 votes
1 answer

Error: FF Browser not working for Selenium test after update

Since Firefox's latest update to version 47.0, ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,590 points
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 27, 2018 in Selenium by Meci Matt
• 9,400 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer

TestNG error:- Cannot find class in classpath

The issue is because the project directory ...READ MORE

answered Mar 23, 2018 in Selenium by nsv999
• 5,050 points
+1 vote
1 answer

Nightwatch chromedriver error

You should use a dot before lib: "webdriver.chrome.driver" ...READ MORE

answered Mar 25, 2018 in Selenium by nsv999
• 5,050 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.