Comments (12)
I can reproduce this problem for now, I am thinking how to fix it ...
from pychrome.
I can not reproduce this problem. actually, this is quite weird, your queue
module seems to be a NoneType object.
from pychrome.
You have to use the gist provided, and a URL that will timeout to replicate the problem. Has to be run a few times to show up once.
I'm using this to run the file: python app.py --urls=https://google.com,https://ebay.com,https://facebook.com,https://sasadacxzcsadsa.com --force-kill=True --timeout=5
It doesn't always show that error, for example, this time it's showing this:
Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/pychrome/tab.py", line 158, in _handle_event_loop
logger.error("[-] callback %s error: %s" % (event['method'], str(e)))
AttributeError: 'NoneType' object has no attribute 'error'
from pychrome.
It seems to work every time in 3.5, but in 2.7 i'm seeing errors like these.
from pychrome.
I still failed to reproduce this problem by using your gist, this time logger
seems to be a NoneType object, I am pretty sure logger
been initialized tab.py#L25, Could you reproduce the problem on other machines?
from pychrome.
I'm running it on a fresh Ubuntu 16.04.2 LTS virtual box with Python 2.7.12 & 3.5.2.
I've noticed on 3.5, although it seems to be working, it's not performing the write in the EventHandler detached method. It seems to close while it's inside of that method. I've updated the gist with comments. Look at the detached function, and specifically line 150.
https://gist.github.com/matthewlilley/a5782b204a976484f8fe04443f509018
from pychrome.
I was unsure if you needed to enable inspector, because it gets into the detached method and has the correct "reason" returned with it enabled and without. On 3.5 it actually gets into the detached method, but doesn't make it to the end of the function, and in 2.7 it never enters the function.
from pychrome.
when you call tab.stop()
, It will stop handle all events, so you need to delete this line of code
https://gist.github.com/matthewlilley/a5782b204a976484f8fe04443f509018#file-gistfile1-txt-L117
from pychrome.
I mistakenly thought I could use the Inspector.detached event to capture a timeout, but that seems wrong now as every page will fire it if tab.stop() isn't called there. It was okay in the situation though, because Page.frameStoppedLoading event doesn't get fired when a request has timed out.
All I want to do is capture a failed page load and write a log.
Also, that still doesn't solve: 'NoneType' object has no attribute 'Empty' on the Queue object in tab.py. It makes it worse :D
from pychrome.
I've update the gist. https://pastebin.com/i6JneJ5b - I'm not worried about using inspector.
I'll see if I can see what's going on in 2.7 and causing Exceptions like this:
Exception in thread Thread-8 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 754, in run
File "/usr/local/lib/python2.7/dist-packages/pychrome/tab.py", line 151, in _handle_event_loop
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'
from pychrome.
Seems like the daemon isn't being shut down correctly, at least on 2.7: http://prntscr.com/gaux4f
from pychrome.
I solved this by calling close_all_tabs at the end of the script, instead of closing them one by one. I just ran the same code with that change on 2.7, and no exceptions.
I should have been ensuring the offending tab was stopped at the end of the script. This isn't a bug.
from pychrome.
Related Issues (20)
- Simulate clicks? HOT 7
- new_tab() raise error
- CallMethodException: calling method: Page.printToPDF error: PrintToPDF is not implemented HOT 1
- 连续运行3小时左右,程序就会卡死 HOT 2
- How to switch frames?
- request for Target.createBrowserContext support
- How to tracing? HOT 2
- (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11026f510>: Failed to establish a new connection: [Errno 61] Connection refused')) HOT 1
- 请问项目支持登录操作吗?
- Date object return by runtime is {}
- Can I use this to perform "save all as HAR with content" in the network tab?
- 获取网络返回信息时报错 HOT 1
- auto start chrome
- Support one event with multi listener
- Page.addScriptToEvaluateOnNewDocument
- WebSocketBadStatusException raised when connecting to webSocketDebuggerUrl in Chrome 108+ HOT 7
- JSONDecodeError on Chrome(ium) 111 HOT 3
- DOM.getTopLayerElements() return empty list?
- install fail, pychrome.exe not found
- Chrome 120 JSONDecodeError HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pychrome.