Closed BookOwl closed 8 years ago
I went through all the tests and fixed the bugs.
I think that this is ready, @Tymewalk
I need to fix some windows bugs. :(
I fixed the bugs! :package:
OK, I fixed the windows bugs and the merge conflicts. @Tymewalk, I believe that this is ready to merge!
Need to check on Linux. Cloning the repo and testing now :small_blue_diamond:
I have ImageMagick installed, but I get this:
Traceback (most recent call last):
File "slither/tests/svgTest.py", line 4, in <module>
import slither
File "/usr/local/lib/python2.7/dist-packages/slither-0.3.0-py2.7.egg/slither/__init__.py", line 1, in <module>
from .slither import *
File "/usr/local/lib/python2.7/dist-packages/slither-0.3.0-py2.7.egg/slither/slither.py", line 14, in <module>
if subprocess.call("identify -version", shell=True, stdout=subprocess.DEVNULL) != 0:
AttributeError: 'module' object has no attribute 'DEVNULL'
That means that you are using a Python 3.2 or older. subprocess.DEVNULL is only in Python 3.3+
We don't have to have that feature, it just means that the output of the different commands might go to the terminal.
@BookOwl I ran with Python 2. Will we have to drop SVG support for that version?
I don't think so, it just means that Python2 users (and people who use Python3.2 or lower) will get extra text in their terminal (unless I can figure out another way to get rid of it). I'll be pretty busy today, but I should be able to get it done this evening.
I think that I found a solution: Pass open(os.devnull, "wb")
to stdout
instead of DEVNULL
OK, I think that I've fixed it. Just let me test on Python2 real quick.
OK, I've gotten it to work in both Python2 and Python3. @Tymewalk, please test again.
Just tested:
timmy@timmybox:/home/timmy/ghp/Slither$ python slither/tests/svgTest.py
We have SVG support!
convert.im6: unable to open image `/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg': No such file or directory @ error/blob.c/OpenBlob/2641.
convert.im6: no images defined `info:' @ error/convert.c/ConvertImageCommand/3044.
Traceback (most recent call last):
File "slither/tests/svgTest.py", line 12, in <module>
svg.addCostume("assets/svg Logo.svg", "svg")
File "/usr/local/lib/python2.7/dist-packages/slither-0.3.0-py2.7.egg/slither/slither.py", line 194, in addCostume
costume = SVGCostume(costumePath, self.scale if hasattr(self, "scale") else 1)
File "/usr/local/lib/python2.7/dist-packages/slither-0.3.0-py2.7.egg/slither/slither.py", line 149, in __init__
shell=True)
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'convert "/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg" -format "%w %h" info:' returned non-zero exit status 1
timmy@timmybox:/home/timmy/ghp/Slither$ python3 slither/tests/svgTest.py
We have SVG support!
convert.im6: unable to open image `/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg': No such file or directory @ error/blob.c/OpenBlob/2641.
convert.im6: no images defined `info:' @ error/convert.c/ConvertImageCommand/3044.
Traceback (most recent call last):
File "slither/tests/svgTest.py", line 12, in <module>
svg.addCostume("assets/svg Logo.svg", "svg")
File "/usr/local/lib/python3.4/dist-packages/slither-0.3.0-py3.4.egg/slither/slither.py", line 194, in addCostume
costume = SVGCostume(costumePath, self.scale if hasattr(self, "scale") else 1)
File "/usr/local/lib/python3.4/dist-packages/slither-0.3.0-py3.4.egg/slither/slither.py", line 149, in __init__
shell=True)
File "/usr/lib/python3.4/subprocess.py", line 620, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command 'convert "/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg" -format "%w %h" info:' returned non-zero exit status 1
timmy@timmybox:/home/timmy/ghp/Slither$ python3.4 slither/tests/svgTest.py
We have SVG support!
convert.im6: unable to open image `/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg': No such file or directory @ error/blob.c/OpenBlob/2641.
convert.im6: no images defined `info:' @ error/convert.c/ConvertImageCommand/3044.
Traceback (most recent call last):
File "slither/tests/svgTest.py", line 12, in <module>
svg.addCostume("assets/svg Logo.svg", "svg")
File "/usr/local/lib/python3.4/dist-packages/slither-0.3.0-py3.4.egg/slither/slither.py", line 194, in addCostume
costume = SVGCostume(costumePath, self.scale if hasattr(self, "scale") else 1)
File "/usr/local/lib/python3.4/dist-packages/slither-0.3.0-py3.4.egg/slither/slither.py", line 149, in __init__
shell=True)
File "/usr/lib/python3.4/subprocess.py", line 620, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command 'convert "/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg" -format "%w %h" info:' returned non-zero exit status 1
timmy@timmybox:/home/timmy/ghp/Slither$
Tried on Python 2, Python 3, and Python 3.4 explicitly.
However, running slither/tests/svgTest.py
as an executable results in this:
import.im6: unable to open image `slither': Is a directory @ error/blob.c/OpenBlob/2641.
slither/tests/svgTest.py: line 7: syntax error near unexpected token `"We have SVG support!"'
slither/tests/svgTest.py: line 7: ` print("We have SVG support!")'
I'm on Linux if it helps.
Try running convert "/home/timmy/ghp/Slither/slither/tests/assets/svg Logo.svg" -format "%w %h" info:
in your shell and see if it's still making that error.
I found the problem: I didn't get the case of the test image right. On Windows and OS X it doesn't matter, but on Linux...
@Tymewalk, please test.
@BookOwl YESSS! :fireworks:
It works on Python 2 and 3 (Linux!) without using that convert command. Woo!
Also, when you said "case of the test image", I thought you meant something was special about it, not that the filename mattered...
I REALLY hate that case doesn't matter in Windows somedays. :stuck_out_tongue:
If there isn't anything else you can think of that we need to check, this is ready to merge!
0.4 here we come!
Yep, it can be quite a pain. 😛 I think that this is ready.
Anything else can be done later on. Merging now!
This PR adds SVG costume support to Slither using the ImageMagick tool. It should be almost ready to merge, I just need to check and make sure that I haven't forgotten or broke anything.