由于ArgumentError,Kivy应用程序将无法运行两次

时间:2019-06-26 09:25:19

标签: python kivy spyder

我是Kivy GUI软件包的新手,并想通过遵循官方网站上的“ Pong Game教程”学习制作游戏。我输入了基本代码以打开一个工作正常的GUI窗口。但是,当我关闭此窗口并再次运行相同的代码时,我收到ArgumentError。我将Spyder的最新版本用作IDE,并且已经更新了所有软件包。

唯一可以解决此问题的方法是重新启动Spyder。我在执行过程中做错了吗?

代码每次执行时都应打开一个新窗口。第一次运行后,我得到此控制台输出,但是以ArgumentError结尾。

代码:

exec error: Error: Command failed: ffmpeg -y  -f x11grab -s 1920x1080 -framerate 30 -i :1.0+0,0 -vsync 1 -c:v libx264 -preset ultrafast -crf 0 -pix_fmt yuv444p output.mkv
ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[x11grab @ 0x55f87adcffa0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':1.0+0,0':
  Duration: N/A, start: 1561540173.584858, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
[libx264 @ 0x55f87adda860] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x55f87adda860] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 @ 0x55f87adda860] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.64.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Segmentation fault1 q=0.0 size=   10942kB time=00:00:02.40 bitrate=37332.4kbits/s speed=0.923x

控制台输出

from kivy.app import App
from kivy.uix.widget import Widget


class PongGame(Widget):
    pass


class PongApp(App):
    def build(self):
        return PongGame()


if __name__ == '__main__':
    PongApp().run()

2 个答案:

答案 0 :(得分:0)

您可以使spyder每次执行时都运行一个新进程。转到“运行”菜单,然后选择“每个文件的配置...”(Ctrl + F6),然后在“控制台”下选择“在外部系统终端中执行”。

答案 1 :(得分:-1)

只需进入菜单->运行->每个文件的配置->在外部系统终端中执行->确定。

应该可以