Closed SoulArsenic closed 9 years ago
@LengBinBin It seems there's non-unicode characters in your path to file right?
yes, but i could not change the file named 'clang'
it seems that the 'ckassName' need set unicode type, before use the 'className' in line "filename = indexFileLocation + hashlib.md5(className).hexdigest()" i am tring resovle the problem but fail... by the way , my python version is 3.4.3 ,is that has effect to the Dynamic code injection ?
As a workaround I would suggest uninstall dyci
Chnage
https://github.com/DyCI/dyci-main/blob/master/Scripts/dyci-recompile.py#L1
https://github.com/DyCI/dyci-main/blob/master/Scripts/dyci-recompile.py#L1
To python 2.7.6 version
And intsall it again.
I have changed python version to
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
unfortunately,it's still got the error TypeError: Unicode-objects must be encoded before hashing
.
and i have tried remove all files and restart the step,it didn't works.
it's there any other possible reasons can affect the plugin?
3 :hourglass: wasted :)
I notice that in the file /dyci-main/Scripts/dyci-clang.py
it's has change the /usr/bin/clang
,I try to change the encodingfilename = indexFileLocation + hashlib.md5(className).hexdigest()
in line 22, but failed.
It's seems that only failed in Xcode,in python cell it's working well.
My python knowledge is lacking, could you please help me try to change it?
Can you be more descripitve? :) Something can fail in many ways :
Each of those can have "error" which is shown, when something fails :) Without this knowledge it's hard to understand what you're trying to do and what the result is
Not even compile successfully.
I have change
filename = indexFileLocation + hashlib.md5(className).hexdigest()
to
filename = indexFileLocation + hashlib.md5(className.encode()).hexdigest()
,
it works,but a new error has cause :
process = Popen(compileString, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = process.communicate() emulating output / err stdout.write(output) stderr.write(err)
in line 65,
File "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", line 71, in <module> stdout.write(output) TypeError: must be str, not bytes
It seems that Popen
in python3 returns "bytes" instead of string :) And stdout have string
parameter in it. Don't know too much about python2 and python3 differences.
My python version has been change to 2.7.5 already. But it didn't solve anything.😢
Compile problem has been solved.
dyci-clang.py
line 22stdout.write(output) stderr.write(err)
to stdout.write(str(output)) stderr.write(str(err))
a new issue is coming...
Failed to inject code
File "/Users/lengbinbin/.dyci/scripts/dyci-recompile.py", line 34
print 'Directory %s does not exists' % dir
SyntaxError: Missing parentheses in call to 'print'
Save me! :(
dig deeper :) I wouldn't be able to help you since I cannot reproduce it on own machine.
If you have project (example project) which compiles and inject successfuly try to find what the difference you have, and trace differences. I'll be able to look at this deeply at the end of the week .
I would try to resolve the problem . Hope the issue can been resolved .I will go fight with it. Bless me ...
dyci-main installation sucess,but ,i have got this message when i building the project:
Traceback (most recent call last): File "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", line 22, in
filename = indexFileLocation + hashlib.md5(className).hexdigest()
TypeError: Unicode-objects must be encoded before hashing
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1