我是python的新手,有人可以指出这个代码有什么问题,我没有错误

时间:2018-06-18 03:27:48

标签: python-3.x selenium-webdriver web-scraping screen-scraping mysql-python

所以我现在正在开发一个项目,我在下面提到的代码是我想要执行的最后一个循环,其中每个列表的数据将逐行添加到mysql数据库中,

我在运行代码时没有得到,但是正如您所看到的,我还提供了一个指示器来检查进程是否已经启动并且无法启动。

所以我无法理解问题究竟是什么。

  1. 我是否正确使用了拉链功能?
  2. 我在我的另一个项目中使用了相同的循环,并且它完美地工作
  3. 所以有人可以帮助我,因为我在哪里出错:

    for t,p,be,yb,pid,pty,ba,pa,pf,pag,cn in zip(Title  ,Price ,Beds ,Year_Built ,Property_ID ,Property_Type ,Baths ,Property_Area ,Property_Firm ,Property_Agent ,Contact_Number):
        csql.execute("insert into homefinder(title,price,beds,year,PID,ptype,baths,area,firm,agent,contact) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" , (t,p,be,yb,pid,pty,ba,pa,pf,pag,cn))
    
    
    As per Jeff's instructions i ran a pdb on my code:
    here are the results:
        c:\users\rishi\music\python\live project\homefinder\homefinder-selenium-test.py(163)<module>()
    -> for t,p,be,yb,pid,pty,ba,pa,pf,pag,cn in zip(Title  ,Price ,Beds ,Year_Built ,Property_ID ,Property_Type ,Baths ,Property_Area ,Property_Firm ,Property_Agent ,Contact_Number):
    (Pdb) next
    > c:\users\rishi\music\python\live project\homefinder\homefinder-selenium-test.py(164)<module>()
    -> csql.execute("insert into homefinder(title,price,beds,year,PID,ptype,baths,area,firm,agent,contact) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" , (t,p,be,yb,pid,pty,ba,pa,pf,pag,cn))
    (Pdb)
    > c:\users\rishi\music\python\live project\homefinder\homefinder-selenium-test.py(163)<module>()
    -> for t,p,be,yb,pid,pty,ba,pa,pf,pag,cn in zip(Title  ,Price ,Beds ,Year_Built ,Property_ID ,Property_Type ,Baths ,Property_Area ,Property_Firm ,Property_Agent ,Contact_Number):
    (Pdb)
    --Return--
    > c:\users\rishi\music\python\live project\homefinder\homefinder-selenium-test.py(163)<module>()->None
    -> for t,p,be,yb,pid,pty,ba,pa,pf,pag,cn in zip(Title  ,Price ,Beds ,Year_Built ,Property_ID ,Property_Type ,Baths ,Property_Area ,Property_Firm ,Property_Agent ,Contact_Number):
    (Pdb)
    --Call--
    > c:\programdata\anaconda3\lib\threading.py(1279)_shutdown()
    -> def _shutdown():
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1285)_shutdown()
    -> tlock = _main_thread._tstate_lock
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1288)_shutdown()
    -> assert tlock is not None
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1289)_shutdown()
    -> assert tlock.locked()
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1290)_shutdown()
    -> tlock.release()
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1291)_shutdown()
    -> _main_thread._stop()
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1292)_shutdown()
    -> t = _pickSomeNonDaemonThread()
    (Pdb)
    > c:\programdata\anaconda3\lib\threading.py(1293)_shutdown()
    -> while t:
    (Pdb)
    --Return--
    > c:\programdata\anaconda3\lib\threading.py(1293)_shutdown()->None
    -> while t:
    (Pdb)
    --Call--
    > c:\programdata\anaconda3\lib\logging\__init__.py(1928)shutdown()
    -> def shutdown(handlerList=_handlerList):
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1935)shutdown()
    -> for wr in reversed(handlerList[:]):
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1938)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1939)shutdown()
    -> h = wr()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1940)shutdown()
    -> if h:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1941)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1942)shutdown()
    -> h.acquire()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1943)shutdown()
    -> h.flush()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1944)shutdown()
    -> h.close()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1952)shutdown()
    -> h.release()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1935)shutdown()
    -> for wr in reversed(handlerList[:]):
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1938)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1939)shutdown()
    -> h = wr()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1940)shutdown()
    -> if h:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1941)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1942)shutdown()
    -> h.acquire()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1943)shutdown()
    -> h.flush()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1944)shutdown()
    -> h.close()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1952)shutdown()
    -> h.release()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1935)shutdown()
    -> for wr in reversed(handlerList[:]):
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1938)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1939)shutdown()
    -> h = wr()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1940)shutdown()
    -> if h:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1941)shutdown()
    -> try:
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1942)shutdown()
    -> h.acquire()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1943)shutdown()
    -> h.flush()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1944)shutdown()
    -> h.close()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1952)shutdown()
    -> h.release()
    (Pdb)
    > c:\programdata\anaconda3\lib\logging\__init__.py(1935)shutdown()
    -> for wr in reversed(handlerList[:]):
    (Pdb)
    --Return--
    > c:\programdata\anaconda3\lib\logging\__init__.py(1935)shutdown()->None
    -> for wr in reversed(handlerList[:]):
    (Pdb)
    --Call--
    Exception ignored in: <async_generator object _ag at 0x0000001F852A1798>
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\types.py", line 27, in _ag
      File "C:\ProgramData\Anaconda3\lib\bdb.py", line 50, in trace_dispatch
      File "C:\ProgramData\Anaconda3\lib\bdb.py", line 82, in dispatch_call
      File "C:\ProgramData\Anaconda3\lib\pdb.py", line 251, in user_call
      File "C:\ProgramData\Anaconda3\lib\pdb.py", line 351, in interaction
      File "C:\ProgramData\Anaconda3\lib\pdb.py", line 1453, in print_stack_entry
      File "C:\ProgramData\Anaconda3\lib\bdb.py", line 391, in format_stack_entry
    TypeError: 'NoneType' object is not callable
    

0 个答案:

没有答案