小编DSc*_*ana的帖子

Twitter错误代码429与Tweepy

我正在尝试使用tweepy api创建一个访问Twitter帐户的项目,但我面临状态代码429.现在,我环顾四周,我发现这意味着我有太多的请求.但是,我一次只发送10条推文,在这些推文中,我的测试中只有一条推文存在.

for tweet in tweepy.Cursor(api.search, q = '@realtwitchess ',lang = ' ').items(10):
                        try:
                                text = str(tweet.text)
                                textparts = str.split(text) #convert tweet into string array to disect
                                print(text)

                                for x, string in enumerate(textparts): 
                                        if (x < len(textparts)-1): #prevents error that arises with an incomplete call of the twitter bot to start a game
                                                if string == "gamestart" and textparts[x+1][:1] == "@": #find games
                                                        otheruser = api.get_user(screen_name = textparts[2][1:]) #drop the @ sign (although it might not matter)
                                                        self.games.append((tweet.user.id,otheruser.id))
                                        elif (len(textparts[x]) …
Run Code Online (Sandbox Code Playgroud)

python twitter tweepy

8
推荐指数
2
解决办法
1万
查看次数

Pygame无头设置

我正在使用pygame的操纵杆api在无头系统上使用操纵杆和我的项目,但是pygame需要一个"屏幕",所以我已经设置了一个虚拟视频系统.它工作正常,但现在突然间它给了我这个错误:

Traceback (most recent call last):
  File "compact.py", line 10, in <module>
    screen = display.set_mode((1, 1))
pygame.error: Unable to open a console terminal
Run Code Online (Sandbox Code Playgroud)

这就是我所拥有的无头设置,应该是这个问题.

from pygame import *
import os
import RPi.GPIO as GPIO
os.environ["SDL_VIDEODRIVER"] = "dummy"
screen = display.set_mode((1, 1))
Run Code Online (Sandbox Code Playgroud)

python pygame headless joystick

7
推荐指数
1
解决办法
3940
查看次数

push_back到vector c ++时的分段错误

我试图使用该push_back方法将空白对象附加到列表中.

main.cpp中

    vector<FacialMemory> facial_memory;

    printf("2\n");

    // Add people face memories based on number of sections
    for (int i = 0; i < QuadrantDict::getMaxFaceAreas(); i++)
    {
            printf("i %d\n", i);
            FacialMemory n_fm;
            facial_memory.push_back(n_fm);  // NOTE: Breaks here
    }
Run Code Online (Sandbox Code Playgroud)

push_back方法调用中,程序崩溃并出现分段错误.我查看了类似的问题,他们指出了我在这里的解决方案.我也尝试过FacialMemory()传入push_back调用,但仍然是同样的问题.

FacialMemory类定义如下:FacialMemory.h

class FacialMemory
{
private:
        vector<FaceData> face_memory;
public:
        FacialMemory();
        ~FacialMemory();
        void pushData(FaceData face);
        bool isEmpty();
        vector<FaceData> getFaces();
        FaceData getRecent();
};
Run Code Online (Sandbox Code Playgroud)

构造函数和析构函数

FacialMemory::FacialMemory()
{
}


FacialMemory::~FacialMemory()
{
       delete[] & face_memory;
}
Run Code Online (Sandbox Code Playgroud)

c++

6
推荐指数
1
解决办法
9748
查看次数

Pino:默认级别未定义

我对后端 Web 开发人员很陌生,我正在尝试建立一个 TypeScript 项目。大多数其他一切似乎都很好,但是当我尝试使用Pino记录器时,我在编译levels.js文件中收到此错误:

throw Error(`default level:${defaultLevel} must be included in custom levels`)

我的logger.ts看起来像这样:

1 import pino from 'pino';
2 
3 const l = pino({
4   name: process.env.APP_ID,
5   level: process.env.LOG_LEVEL,
6 });
7 
8 export default l;
Run Code Online (Sandbox Code Playgroud)

该项目是通过yeoman.

不确定这是否足以调试问题。

javascript node.js typescript

6
推荐指数
1
解决办法
3301
查看次数

Visual Studio Intellisense没有显示某些类

我的Visual Studio没有显示IntelliSense自动完成中的许多可用类.例如,我正在处理的项目具有对Microsoft.Xna.Framework命名空间的引用,但即使在文件中添加using语句后Microsoft.Xna.Framework,IntelliSense也无法识别类似Texture2D和的类Rectangle.但是,我仍然可以输入它们而不会出现编译器错误.知道发生了什么事吗?

IntelliSense可以检测标准库,System.Diagnostics但不能检测任何外部库.

它不是NameSpace冲突问题,因为IntelliSense中也缺少当前命名空间中的类.

我试过了:

  • 重新启动Visual Studio(使用和不使用关闭选项卡)
  • 删除内容 %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentCacheModel folder
  • 重置导入和导出设置

c# intellisense xna syntax-highlighting visual-studio

3
推荐指数
3
解决办法
7479
查看次数

带有cmake的架构x86_64的1个重复符号

我正在尝试使用mac上的cmake编译测试类.当我运行cmake和make命令时,我最终得到了这个错误:

duplicate symbol _main in:
    CMakeFiles/Carm.dir/CMakeFiles/3.7.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o
    CMakeFiles/Carm.dir/test.cpp.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Carm] Error 1
make[1]: *** [CMakeFiles/Carm.dir/all] Error 2
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)

告诉我在main中有一个重复的符号.当我单独使用g ++时,这段代码可以完美编译.

car.h

#ifndef CAR_H
#define CAR_H

#include <string>

using namespace std;

namespace test {
    class Car {
    private:
            string model;
            int hp;
            int speed;

    public:
            Car(string n_model, int n_hp);
            string getModel();
            int getHp();
            int getSpeed();

    }; …
Run Code Online (Sandbox Code Playgroud)

c++

3
推荐指数
1
解决办法
1993
查看次数