如何检查/检测在我的VSPackage下运行的Visual Studio版本?
我无法从注册表中获取,因为计算机可能安装了多个版本,所以我猜有一个能够获得它的API.
有人知道如何使用C#从托管的Visual Studio包中获取它吗?
我想让urllib2与PyWebKitGtk一起工作以支持cookie.我认为这主要是有效的,但是会话之间的cookie不起作用.cookies.txt文件已保存,它看起来好像在请求中使用了cookie(在Wireshark中检查过),但我看到加载到浏览器窗口的数据似乎没有使用cookie.登录后,关闭应用程序,然后重新启动它,我的登录会话消失了.
我的代码
def load_uri_in_browser(self):
self.cookiejar = LWPCookieJar(config_dir + "/cookies.txt")
if os.path.isfile(self.cookiejar.filename):
self.cookiejar.load(ignore_discard=True)
#for testing, this does print cookies
for index, cookie in enumerate(self.cookiejar):
print index, ' : ', cookie
self.opener = urllib2.build_opener(
urllib2.HTTPRedirectHandler(),
urllib2.HTTPHandler(debuglevel=0),
urllib2.HTTPSHandler(debuglevel=0),
urllib2.HTTPCookieProcessor(self.cookiejar))
self.opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13')]
self.view = webkit.WebView()
self.view.connect('navigation-policy-decision-requested', self.navigation_policy_decision_requested_cb)
self.mainFrame = self.view.get_main_frame()
self.mainFrame.load_uri("http://twitter.com")
#gtk window loaded earlier
self.window.add(self.view)
self.window.show_all()
self.window.show()
def navigation_policy_decision_requested_cb(self, view, frame, net_req, nav_act, pol_dec):
uri=net_req.get_uri()
if uri.startswith('about:'):
return False
page = self.opener.open(uri) …
Run Code Online (Sandbox Code Playgroud)