无论我做什么,sys.exit()都由unittest调用,即使是最琐碎的例子.我无法判断我的安装是否搞砸了或者发生了什么.
IDLE 1.2.2 ==== No Subprocess ====
>>> import unittest
>>>
>>> class Test(unittest.TestCase):
def testA(self):
a = 1
self.assertEqual(a,1)
>>> unittest.main()
option -n not recognized
Usage: idle.pyw [options] [test] [...]
Options:
-h, --help Show this message
-v, --verbose Verbose output
-q, --quiet Minimal output
Examples:
idle.pyw - run default set of tests
idle.pyw MyTestSuite - run suite 'MyTestSuite'
idle.pyw MyTestCase.testSomething - run MyTestCase.testSomething
idle.pyw MyTestCase - run all 'test*' test methods
in MyTestCase
Traceback (most recent call last):
File …Run Code Online (Sandbox Code Playgroud) 所以我一直在尝试学习使用RS232与串口设备通信的boost :: asio.文档记录稀疏,示例不存在.无法弄清楚如何与设备进行通信.设备无法发送数据,所以我需要做的就是写,但其他项目需要实际的来回通信,所以对此有所帮助.到目前为止,我的代码如下.
#include <boost/asio/serial_port.hpp>
using namespace::boost::asio;
int main()
{
io_service io;
serial_port port( io, "COM3" );
port.set_option( serial_port_base::baud_rate( 19200 ) );
unsigned char commands[4] = { 1, 128, 240, 0 };
// write the commands to the device
return 0;
}
Run Code Online (Sandbox Code Playgroud)
简而言之:需要有关serial_port的io部分的帮助.
首先,我使用的是Windows XP.我有多个硬盘驱动器,它看起来像是决定在第二个硬盘上制作一些文件夹(这只是一个数据驱动器,没有操作系统).这些文件夹的名称都是"e69f29f1b1f166d3d30b8c9f7156ba"和"bd92c24cc278614082cd88e7a64b".它们包含名为update的文件夹,其"访问被拒绝",所以我最好的猜测是它们是Windows更新.所以我可能无法摆脱它们,但有人至少可以解释它们是什么以及为什么它们在错误的驱动器上?
这并不像听起来那么恶意,我想获得他们当前的窗户大小,而不是看他们的内容.目的是弄清楚如果每个其他窗口都是全屏的,那么我也应该这样开始.或者,如果所有其他进程只有800x600,尽管有一个巨大的分辨率,那么这可能是用户想要的.为什么让他们浪费时间和精力调整窗口大小以匹配他们拥有的所有其他人?我主要是一个Windows devoloper,但如果有一个跨平台的方法,它不会让我感到不安.
我完全困惑为什么这段代码没有得到任何 SDL 按键事件。其他 SDL 事件(为清楚起见已删除)工作正常。它不适用于我的 XP 或 Vista 机器。没有编译/链接错误,只是从未收到 keydown 事件。
#include "SDL/SDL.h"
// Yes SDL.lib and SDLmain.lib are linked
Uint32 TimeLeft(void)
{
static Uint32 next_time = 0;
Uint32 now;
now = SDL_GetTicks();
if ( next_time <= now ) {
next_time = now + tickInterval;
return 0;
}
return(next_time-now);
}
int main( int argc, char **argv )
{
if( -1 == SDL_Init( SDL_INIT_EVERYTHING ) )
{
cerr << "Error: SDL_Init failed" << endl;
return -1;
}
SDL_Event event;
bool quit …Run Code Online (Sandbox Code Playgroud) 我正在努力使quicksort并行,线程是第一次尝试.非线程版本正确排序,但线程没有(没有惊喜).我发现有趣的是当我删除线程但保持boost :: bind调用它仍然无效.如果boost :: bind不是我想要的,请提供建议.绑定似乎是使我的函数与boost线程一起工作的最简单(或唯一)方法.
void Quicksort( fVec &Array, const int Left, const int Right )
{
if( Right <= Left )
return;
int pivot = Left;
const int pivotNewIndex = Partition( Array, Left, Right, pivot );
// These function calls make it work fine
//Quicksort( Array, Left, pivotNewIndex - 1 );
//Quicksort( Array, pivotNewIndex + 1, Right );
// boost::bind calls only swaps one element, doesn't actually sort
boost::bind( &Quicksort, Array, Left, pivotNewIndex - 1 )();
boost::bind( &Quicksort, Array, …Run Code Online (Sandbox Code Playgroud)