-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileNotFoundError error in tests.py #137
Comments
I think it means your scad file has an warning in it. Have a look at openscad.log. I pushed a change recently that makes warnings hard errors and terminates openscad but there is a bug in openscad that returns a zero exit status in that case, so the script continues. I reported the bug and I think that it was fixed in master. |
It turns out that I did have a warning, but I fixed that and the problem still remains. I tried another project of mine and that also now suffers the same problem. So I tried the MainsBreakoutBox example project and that also suffers the same problem, so I think something has been inadvertently broken. Here's the output from MainsBreakoutBox:
|
It runs fine on my machine but none of the images have changed because it is not long since I last ran it. They did change then due to the change in teardrop_plus which makes a few pixels change around holes and countersunk screw heads. It looks like a problem in this command:
For some reason it doesn't create Does What happens if you run the magick command manually? Does it make |
So if I run that command manually, it takes a few seconds and then does not produce tmp.png. It doesn't produce an error message. And |
Can you attach the image and I will try it here. It seems like a bug in magick. Checking that tmp.png exists and is not really a work around because you will end up with a missing image. |
No, I haven't changed it since I originally installed it. I'll upgrade to the latest version and try that... |
Odd it should suddenly stop working. Does it work for any small images? Note it takes less than 1s to process that file on my laptop. |
I pushed a change to give an explicit error message when png.tmp is not generated instead of a carrying on and generating an exception. |
I've been playing around with this a while now. It seems there is something odd going on with the file's path. If I type:
then it will fail silently (note, BC200 is the variant of the project).
it works. Two other points of note:
I have recently had a Windows update, that is the only thing I can think of that may have stopped this working, but I can't see anything in the update notes about this. So a workaround could be to copy the file to the local directory before running magick on it. |
Weird. One advantage of Win7 is I don't get updates! Does it still work if you copy it to tmpA.png and then do
I can't imagine a Windows update being so broken. Is the filesystem on a normal drive, not networked or a folder synced to GoogleDrive? Is it a virus checker issue? I don't really want to add a workaround for paths not working. |
I was mistaken when I said it works when you copy the file to the local directory. What does work is:
Not sure why splitting the operation in two helps. Note that magick BC200/assemblies/Base_assembled.png is 248KB, aa.png is 97KB and bb.png is 21KB, so the first line must be stripping some information out of the original file. I also tried doing
ie, just the resize on its own, and this fails. So it looks like the resize on the full size file is what causes the problem, so it seems like some sort of out of memory problem, but this does seem very odd in what is a mature program. |
Is it possible to get older releases? E.g. the same as I have to rule it out. I don't see how magick can go from working to broken if you didn't change it's version. Is it perhaps a hardware problem on your PC. Do you have anything else to try it on? It only seems to go wrong making the small image from the bigger one that it created itself. It seems to be able to make the bigger one from the giant one exported from OpenSCAD, so I don't think it runs out of memory. I don't understand how running it with no parameters makes the file smaller, when the source is a file it has just created itself. When I do that here the file is exactly the same size and the contents only differ by 10 bytes, which I think is a timestamp. |
I knew this issue would be a rabbit hole when I reported it... I agree, the issue is probably something to do with my PC, but I haven't changed anything except for auto-updates. I thought that I have an old mac that I haven't really used since I went back to Windows, so I could try it out on there. I'll start doing that as a background task. |
No OpenSCAD makes an image four times bigger and it is downsized by Magick to get anti-aliasing. What happens if you use windows paths, i.e. \BC200\assemblies\Base_assembled.png ? |
I tried windows paths and also putting quotes around the path, both without success. It does seem that there is something about my machine that is causing Magick to fail. |
I found some old Magick versions at https://imagemagick.en.uptodown.com/windows/versions 7.0.6-9, Aug 22nd, 2017 works and 7.0.9-16, Jan 14th, 2020 fails. Unfortunately they have nothing in between those versions. I can't believe that if this is a bug in Magick, that it hasn't been found in all that time. It is possible that they have become more strict on the chaining of operations though - is it possible there are some restrictions on or prerequisites for applying multiple operations on an image that you have overlooked? |
So I revisited the image you posted and there is something wrong about it. It is 4096 by 4096 and is not centred vertically. Processing with magick with no parameters does shrink it from 248K to 97K. So it does look like an image from OpenSCAD, not one that has been processed with magick. So it looks like the first call to magick also does nothing. That has tmp.png as source and destination so if it does nothing it presumably leaves the file unchanged and update_image() then copies it to the correct place. |
Odd about the image, but I don't think the image is the problem. I may have generated that image from within OpenSCAD, since it is quicker than running a build. I made a dummy project with a single assembly which consisted of a single stl, a 10x10x10 cube, and that failed. Going back to Magick 7.0.6-9 seems to have fixed my problems. I've just kicked off a full build to verify. |
By the way, at line 193 of |
No it must have been made from the command line to get an image that big. Basically I thought it was only failing to make the small image but it also fails to make the large one as well. The script just does not notice because it is done in place. When did you last update OpenSCAD. I wonder if that is what started it failing. |
The size is deliberate to allow for the 10 pixel border all the way round to get 1024. |
I last updated OpenSCAD as a result of looking into this problem - because you said it wasn't dealing with warnings correctly. See my previous post, the problem seems to be with Magick. I've just reinstalled Magick 7.0.9-16, and my full build has just completed and everything now works fine. I guess I must have upgraded Magick fairy recently, but I don't remember doing so. |
Your previous version of Magick was a year old though and the next version only two weeks later, so it is unlikely you updated since Jan last year. I was mistaken when I suggested it could be an OpenSCAD warning because I didn't notice it was the second magick call that was failing. Seems like the first one does not like the output from OpenSCAD and silently leaves it unchanged and that gets copied to assemblies unchanged. The second call to magick does not like it either and so does not create tmp.png and then the script falls over. If you run magick with no arguments it looks like it compresses the file and then running it with arguments on the compressed version works. So it looks a bit like magick can't handle a 4096 x 4096 uncompressed image if it has to do those operations on it. Odd though because you would think the first thing it would do is uncompress it before it starts trimming and shrinking. When did it last work OK? |
Actually 4096 x 4096 uncompressed would be a huge file, so it must be compressed by OpenSCAD but magick can compress it further somehow. |
I'm not sure when it stopped working. I'd say sometime in the last month, but I couldn't be sure. I think it was working when you added the I first noticed a problem a while ago in the the images in my |
Yes the big images would be too big but the small ones are missing and the script would have stopped until you added the change in this PR. Then I presume it would carry on leaving a readme with no small assembly pictures and the big ones huge. |
If it had been built before then the small images would probably exist but be out of date, |
Yes, the small images would have still been hanging around, so a readme would still have been produced. |
Can we close this as it seems to be a bug in Magick and should now cause the build to stop with a more obvious pointer to Magick? |
Well, we both seem to have work arounds, but it might hit new users. But I guess it can be closed. Perhaps we should report the bug to Magick? |
Yes if they accept bug reports. |
I'm sometimes getting a
FileNotFoundError
intests.py
when doing amake_all
, see error trace below. I haven't been able to track down what exactly causes this to happen, but do have a fix, see at end.The addition of two checks of
if os.path.isfile(tmp_name):
fix the problem.The text was updated successfully, but these errors were encountered: