我有一些进口:
#!/usr/bin/env ruby
require 'openssl'
data = File.open('blob', 'r:ASCII-8BIT').read
c = OpenSSL::Cipher.new('AES-128-ECB')
c.decrypt
c.key = 'M02cnQ51Ji97vwT4'
o = ''.force_encoding('ASCII-8BIT')
data.bytes.each_slice(16) { |s| o += c.update(s.map(&:chr).join) }
o += c.final
File.open('blob.jpg', 'w') { |f| f.write(o) }
引发错误(可能是2):
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk, GdkPixBuf
我注意到的是,在gi的importer.py中,repository.enumerate_versions(namespace)为GdkPixBuf返回[](因此会引发错误)。
其他导入会返回一些内容:
WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "camerapython.py", line 10, in <module>
from gi.repository import Gdk, GdkPixBuf
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name GdkPixBuf, introspection typelib not found
如果需要,我的dist是Raspbian(Raspberry Pi 3)。
答案 0 :(得分:2)
你导致Pixbuf错误,应该是
from gi.repository import Gdk, GdkPixbuf