我设法为C++配置Sublime Text 2,我现在可以编译我的代码(使用MinGW编译器).
不幸的是,Sublime Text控制台不支持C++的任何类型的输入.
我想在外部控制台(例如Window的终端)中打开我编译的程序.我尝试使用"call"或"cmd"但无法使其正常工作.(它仍然在控制台中打开文件)
这是我的构建配置:
{
"cmd": ["C:\\MinGW\\bin\\mingw32-g++.exe", "-Wall", "-time", "$file", "-o", "$file_base_name"],
"cmd": ["call", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"working_dir": "${project_path:${folder}}",
"selector": "source.c",
"shell": true,
"encoding": "latin1"
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将自定义信号(在TCP客户端类中)连接到使用服务器发送的数据更新日志的方法等等.
这是TCP客户端类的声明:
class CarSocket(QObject):
logSignal = Signal(str, str)
...
def __init__(self, ...):
super(CarSocket, self).__init__()
...
Run Code Online (Sandbox Code Playgroud)
我正在尝试连接的方法logSignal:
def addToLog(self, text, mode='NORMAL'):
if mode == 'RAW':
toAdd = text
else:
toAdd = "<p>{}</p> \n <hr> \n".format(text)
self.log.logEdit.append(toAdd)
Run Code Online (Sandbox Code Playgroud)
所以,我在初始化我的应用程序时写了这一行:
self.carSocket.logSignal.connect(self.addToLog)
Run Code Online (Sandbox Code Playgroud)
当我执行它时,我得到一个非常奇怪的错误:
Traceback (most recent call last):
File "/home/ahmed/workspace/autonomee/main.py", line 286, in <module>
window = MainWindow()
File "/home/ahmed/workspace/autonomee/main.py", line 115, in __init__
self.carSocket.logSignal.connect(self.addToLog)
TypeError: connect() takes exactly 3 arguments (4 given)
[Finished in 0.5s with exit code 1] …Run Code Online (Sandbox Code Playgroud) 我的问题非常简单.我有一个TList(称为queue)包含类的对象,CNotif并希望is_alive在这些对象上使用该方法.
问题是,当我使用时queue.Items[0].is_alive(),我收到一条错误消息Error: Illegal qualifier.
我也对我在这个TList中实例化对象的方式感到困惑(以及编译器"知道"存储的对象是这种类型的方式......)
我现在所做的是:queue.Add(CNotif.create(timer, title, text, badge))但我认为不应该这样做.
先感谢您 !
我注意到一个非常烦人的错误:BeautifulSoup4(包:) bs4经常找到比以前版本(包:)更少的标签BeautifulSoup.
这是该问题的可重现实例:
import requests
import bs4
import BeautifulSoup
r = requests.get('http://wordpress.org/download/release-archive/')
s4 = bs4.BeautifulSoup(r.text)
s3 = BeautifulSoup.BeautifulSoup(r.text)
print 'With BeautifulSoup 4 : {}'.format(len(s4.findAll('a')))
print 'With BeautifulSoup 3 : {}'.format(len(s3.findAll('a')))
Run Code Online (Sandbox Code Playgroud)
输出:
With BeautifulSoup 4 : 557
With BeautifulSoup 3 : 1701
Run Code Online (Sandbox Code Playgroud)
你可以看到,差异并不小.
以下是模块的确切版本,以防有人想知道:
In [20]: bs4.__version__
Out[20]: '4.2.1'
In [21]: BeautifulSoup.__version__
Out[21]: '3.2.1'
Run Code Online (Sandbox Code Playgroud)