MCP gives error when I attempt to decompile it (1.8.8) - minecraft

I'm trying to create my MCP workspace, however, I run into a problem when I run decompile.sh (creates all files). When I run the sh file, it gives me a python error.
Traceback (most recent call last):
File "runtime/decompile.py", line 58, in decompile
commands = Commands(conffile, verify=True, no_patch=no_patch, workdir=workdir, json=json)
File "/Users/louie/Desktop/louie/mcp918/runtime/commands.py", line 176, in __init__
normalStart = self.readconf(workdir, json)
File "/Users/louie/Desktop/louie/mcp918/runtime/commands.py", line 565, in readconf
self.mcLibraries = MinecraftDiscovery.getLibraries(mcDir, self.jsonFile, osKeyword)
File "/Users/louie/Desktop/louie/mcp918/runtime/MinecraftDiscovery.py", line 157, in getLibraries
libFilename = "%s-%s-%s.jar"%(libSubdir, libVersion, substitueString(library['natives'][osKeyword]))
File "/Users/louie/Desktop/louie/mcp918/runtime/MinecraftDiscovery.py", line 185, in substitueString
str = str.replace("${arch}", getArch())
TypeError: coercing to Unicode: need string or buffer, NoneType found
louie#Louies-MBP mcp918 %
Any idea of how to fix this?
OS: Mac
I have python 3 installed
I have java 8 installed

Here's the failing code:
def getArch():
machine = platform.machine()
if os.name == 'nt' and sys.version_info[:2] < (2,7):
machine = os.environ.get("PROCESSOR_ARCHITEW6432", os.environ.get('PROCESSOR_ARCHITECTURE', ''))
machine2bits = {'AMD64': '64', 'x86_64': '64', 'i386': '32', 'x86': '32'}
return machine2bits.get(machine, None)
def substitueString(str):
str = str.replace("${arch}", getArch())
return str
Since you're on an Apple Silicon Mac, you're on the ARM architecture, which MCP918 doesn't support. (This shouldn't be a surprise, since Apple Silicon wasn't released until 5 years after MCP918 was.)

Related

Data Length Error when Merging PDFs with PyPDF2

I am starting a project that will take specific pages out of each PDF in a folder and merge those pages into a single file. I am getting the error below when building the quoted code about the length of the encryption, and I don't know where I would need to address that.
from PyPDF2 import PdfFileMerger
import glob
files = glob.glob('C:/Users/Jake/Documents/UPLOAD/test_merge/*.pdf')
merger = PdfFileMerger()
for file in files:
merger.append(file)
merger.write("merged.pdf")
merger.close()
ERROR
Traceback (most recent call last):
File "C:\Users\Jake\Documents\Work Projects\Python\Contract Merger\Merger .02", line 10, in <module>
merger.write("merged.pdf")
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_merger.py", line 312, in write
my_file, ret_fileobj = self.output.write(fileobj)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 838, in write
self.write_stream(stream)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 811, in write_stream
self._sweep_indirect_references(self._root)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 960, in _sweep_indirect_references
data = self._resolve_indirect_object(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 1005, in _resolve_indirect_object
real_obj = data.pdf.get_object(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_reader.py", line 1187, in get_object
retval = self._encryption.decrypt_object(
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 747, in decrypt_object
return cf.decrypt_object(obj)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 185, in decrypt_object
obj[dictkey] = self.decrypt_object(value)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 179, in decrypt_object
data = self.strCrypt.decrypt(obj.original_bytes)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 87, in decrypt
d = aes.decrypt(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 246, in decrypt
raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode
[Finished in 393ms]
I wrote a basic program from a YouTube video and tried to run it, but I got the error that PyCryptodome was a dependent for PyPDF2. After installing that, I am getting an error about the data length for encryption when writing the pdf. Googling that error lead me to this solution. I am a bit of a novice, and I don't really understand why any kind of encryption is being applied in the first place, other than what I assume is necessary for the pdf reader/writer to operate, so I don't know where I would need to apply that solution in this code.
After writing up this question, I was lead to this solution, which I tried to run the code below, I received the same error.
from PyPDF2 import PdfFileMerger, PdfFileReader
import glob
merger = PdfFileMerger()
files = glob.glob('C:/Users/Jake/Documents/UPLOAD/test_merge/*.pdf')
for filename in files:
with open(filename, 'rb') as source:
tmp = PdfFileReader(source)
merger.append(tmp)
merger.write('Result.pdf')
ERROR
Traceback (most recent call last):
File "C:\Users\Jake\Documents\Work Projects\Python\Contract Merger\Merger .03.py", line 13, in <module>
merger.write('Result.pdf')
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_merger.py", line 312, in write
my_file, ret_fileobj = self.output.write(fileobj)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 838, in write
self.write_stream(stream)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 811, in write_stream
self._sweep_indirect_references(self._root)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 960, in _sweep_indirect_references
data = self._resolve_indirect_object(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_writer.py", line 1005, in _resolve_indirect_object
real_obj = data.pdf.get_object(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_reader.py", line 1187, in get_object
retval = self._encryption.decrypt_object(
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 747, in decrypt_object
return cf.decrypt_object(obj)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 185, in decrypt_object
obj[dictkey] = self.decrypt_object(value)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 179, in decrypt_object
data = self.strCrypt.decrypt(obj.original_bytes)
File "C:\Users\Jake\Anaconda3\lib\site-packages\PyPDF2\_encryption.py", line 87, in decrypt
d = aes.decrypt(data)
File "C:\Users\Jake\Anaconda3\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 246, in decrypt
raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode
[Finished in 268ms]
My thinking is that something else has gone wrong, but I am at a loss at to what that could be.
What have I done wrong with this build to get this error, and how can I correct it?
Turns out this is an issue with PyPDF2. There is a 3-line fix that can be injected to correct the error if you attempt this before it is patched.

Twitsted ValueError: Unknown ECC curve on Raspian Stretch

I want to use my Raspberry Pi 3, running Rapian Stretch for a web scraping project. For python i use the berryconada distribution.
When I run my Spider, I get
ValueError: Unknown ECC curve
On my Laptop (Xubuntu 16.04) everything runs fine. Maybe I need to install an additional library or something?
Down below the full traceback.
Traceback (most recent call last):
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/middleware.py", line 43, in process_request
defer.returnValue((yield download_func(request=request,spider=spider)))
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/utils/defer.py", line 45, in mustbe_deferred
result = f(*args, **kw)
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/handlers/__init__.py", line 65, in download_request
return handler.download_request(request, spider)
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/handlers/http11.py", line 63, in download_request
return agent.download_request(request)
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/handlers/http11.py", line 300, in download_request
method, to_bytes(url, encoding='ascii'), headers, bodyproducer)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/web/client.py", line 1633, in request
endpoint = self._getEndpoint(parsedURI)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/web/client.py", line 1617, in _getEndpoint
return self._endpointFactory.endpointForURI(uri)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/web/client.py", line 1494, in endpointForURI
uri.port)
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/contextfactory.py", line 59, in creatorForNetloc
return ScrapyClientTLSOptions(hostname.decode("ascii"), self.getContext())
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/contextfactory.py", line 56, in getContext
return self.getCertificateOptions().getContext()
File "/home/pi/berryconda3/lib/python3.6/site-packages/scrapy/core/downloader/contextfactory.py", line 51, in getCertificateOptions
acceptableCiphers=DEFAULT_CIPHERS)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/python/deprecate.py", line 792, in wrapped
return wrappee(*args, **kwargs)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/internet/_sslverify.py", line 1595, in __init__
self._ecCurve = _OpenSSLECCurve(_defaultCurveName)
File "/home/pi/berryconda3/lib/python3.6/site-packages/twisted/internet/_sslverify.py", line 1744, in __init__
raise ValueError("Unknown ECC curve.")
I dropped berryconda and pip installed scrapy. If you're getting this error on Jessie, moving to Stretch gives you access to the newer openssl libs which contain the missing things.
After I upgraded to Stretch I cut berryconda from my path, pip uninstalled cryptography, twisted, pyopenssl, and scrapy.
Then with the no cache option I pip installed scrapy, which brought all those packages back, and now my spider is running.

Kazoo package using Jython

Kazoo's fairly working under the Python, but the project which i'm working on requires to use it under the Jython.
Here is the issue:
>>> from kazoo.client import KazooClient
>>> zk = KazooClient('127.0.0.1')
>>> zk.start()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 541, in start
event = self.start_async()
File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 576, in start_async
self._connection.start()
File "C:\jython2.7.0\Lib\site-packages\kazoo\protocol\connection.py", line 170, in start
rw_sockets = self.handler.create_socket_pair()
File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\threading.py", line 165, in create_socket_pair
return utils.create_socket_pair(socket)
File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\utils.py", line 148, in create_socket_pair
temp_srv_sock.bind(('', port))
File "C:\jython2.7.0\Lib\_socket.py", line 1367, in meth
return getattr(self._sock,name)(*args)
File "C:\jython2.7.0\Lib\_socket.py", line 812, in bind
self.bind_addr = _get_jsockaddr(address, self.family, self.type, self.proto, AI_PASSIVE)
File "C:\jython2.7.0\Lib\_socket.py", line 1565, in _get_jsockaddr
addr = _get_jsockaddr2(address_object, family, sock_type, proto, flags)
File "C:\jython2.7.0\Lib\_socket.py", line 1594, in _get_jsockaddr2
hostname = {AF_INET: INADDR_ANY, AF_INET6: IN6ADDR_ANY_INIT}[family]
KeyError: 0
How i'd already said - there is no this kind issue using the python.
I'm pretty sure that it is connected with the Jython-version of the _socket.py file, but don't know the workaround.
What can you recommend?

What dependencies do I need for USB programing in python with pyUSB?

I am trying to get the usb.find command to work properly in a python script I'm writing on Angstrom for the Beagleboard.
Here is my code:
#!/usr/bin/env python
import usb.core
import usb.util
import usb.backend.libusb01 as libusb
PYUSB_DEBUG_LEVEL = 'debug'
# find our device
# Bus 002 Device 006: ID 1208:0815
# idVendor 0x1208
# idProduct 0x0815
# dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# iManufacturer 1 TOROBOT.com
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815,
backend=libusb.get_backend() )
I don't know what's missing, but here is what I do know.
When I don't specify the backend, no backend is found. When I do specify the backend usb.backend.libusb01 I get the following error:
root#beagleboard:~/servo# ./pyServo.py
Traceback (most recent call last):
File "./pyServo.py", line 17, in <module>
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815, backend=libusb.get_backend() )
File "/usr/lib/python2.6/site-packages/usb/core.py", line 854, in find
return _interop._next(device_iter(k, v))
File "/usr/lib/python2.6/site-packages/usb/_interop.py", line 60, in _next
return next(iter)
File "/usr/lib/python2.6/site-packages/usb/core.py", line 821, in device_iter
for dev in backend.enumerate_devices():
File "/usr/lib/python2.6/site-packages/usb/backend/libusb01.py", line 390, in enumerate_devices
_check(_lib.usb_find_busses())
File "/usr/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: usb_find_busses
What am I missing so that this will work properly?
Try installing python-pyusb through opkg, that should install the native dependencies.

Non-zero exit status while regenerating during component build in chromium

I have tried configuring Component Build in Chromium but while regenerating the chromium.gyp_env by running link
gclient runhooks
i get following error
C:\chromiumtrunk\home\src_tarball\tarball\chromium\src>gclient runhooks
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/downlo
ad_nacl_toolchains.py --no-arm-trusted --keep' in 'C:\chromiumtrunk\home\src_tar
ball\tarball\chromium'
C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\native_client\toolchain\.
tars\toolchain_win_x86.tar.bz2 is already up to date.
win_x86: already up to date.
C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\native_client\toolchain\.
tars\naclsdk_win_x86.tgz is already up to date.
win_x86_newlib: already up to date.
C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\native_client\toolchain\.
tars\naclsdk_pnacl_win_x86.tgz is already up to date.
pnacl_win_x86: already up to date.
C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\native_client\toolchain\.
tars\naclsdk_pnacl_translator.tgz is already up to date.
pnacl_translator: already up to date.
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/linux/
install-arm-sysroot.py --linux-only' in 'C:\chromiumtrunk\home\src_tarball\tarba
ll\chromium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/chrome/insta
ller/linux/sysroot_scripts/install-debian.wheezy.sysroot.py --linux-only --arch=
amd64' in 'C:\chromiumtrunk\home\src_tarball\tarball\chromium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/chrome/insta
ller/linux/sysroot_scripts/install-debian.wheezy.sysroot.py --linux-only --arch=
i386' in 'C:\chromiumtrunk\home\src_tarball\tarball\chromium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/tools/clang/
scripts/update.py --mac-only' in 'C:\chromiumtrunk\home\src_tarball\tarball\chro
mium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/win/se
tup_cygwin_mount.py --win-only' in 'C:\chromiumtrunk\home\src_tarball\tarball\ch
romium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/util/l
astchange.py -o src/build/util/LASTCHANGE' in 'C:\chromiumtrunk\home\src_tarball
\tarball\chromium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/util/l
astchange.py -s src/third_party/WebKit -o src/build/util/LASTCHANGE.blink' in 'C
:\chromiumtrunk\home\src_tarball\tarball\chromium'
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/gyp_ch
romium' in 'C:\chromiumtrunk\home\src_tarball\tarball\chromium'
Enabled Psyco JIT.
Updating projects from gyp files...
Warning: Missing input files:
C:\Program Files (x86)\Windows Kits\8.0\bin\x86\fxc.exe
C:\Program Files (x86)\Windows Kits\8.0\Redist\D3D\x86\d3dcompiler_46.dll
Hook ''C:\chromium\depot_tools\python_bin\python.exe' src/build/gyp_chromium' to
ok 637.08 secs
________ running 'C:\chromium\depot_tools\python_bin\python.exe src/build/landmi
nes.py' in 'C:\chromiumtrunk\home\src_tarball\tarball\chromium'
Traceback (most recent call last):
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\get_landmin
es.py", line 63, in <module>
sys.exit(main())
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\get_landmin
es.py", line 58, in main
print_landmines(options.target)
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\get_landmin
es.py", line 29, in print_landmines
if (distributor() == 'goma' and platform() == 'win32' and
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 20, in inner
ret = func()
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 60, in distributor
if 'goma' in gyp_defines():
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 20, in inner
ret = func()
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 48, in gyp_defines
for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
ValueError: dictionary update sequence element #0 has length 1; 2 is required
Traceback (most recent call last):
File "src/build/landmines.py", line 133, in <module>
sys.exit(main())
File "src/build/landmines.py", line 127, in main
set_up_landmines(target, landmines)
File "src/build/landmines.py", line 59, in set_up_landmines
out_dir = get_target_build_dir(landmine_utils.builder(), target,
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 20, in inner
ret = func()
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 102, in builder
if platform() == 'android':
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 20, in inner
ret = func()
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 73, in platform
if 'OS' in gyp_defines():
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 20, in inner
ret = func()
File "C:\chromiumtrunk\home\src_tarball\tarball\chromium\src\build\landmine_ut
ils.py", line 48, in gyp_defines
for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
ValueError: dictionary update sequence element #0 has length 1; 2 is required
Error: Command C:\chromium\depot_tools\python_bin\python.exe src/build/landmines
.py returned non-zero exit status 1 in C:\chromiumtrunk\home\src_tarball\tarball
\chromium
From the error it looks like there is something wrong with your GYP_DEFINES environment variable. what does echo $GYP_DEFINES output? It should be a set of space separated key=value pairs.