3

When I try to open my project it gives me an error saying "Heads up! Could not open project". Could you please help me? Let me know if you want me to share the file.

We were working on the file, and suddenly after saving we were not able to open it again.

Project file that gives me this error

5
  • 2
    Please provide more details. Which OS you use? Application version? Any specific actions you've taken before this issue appeared and what have you tried to troubleshoot it?
    – Alex
    Commented Feb 11, 2022 at 6:49
  • 1
    I run ev3 on windows EV3 classroom 1.5.2. We wanted to make a copy of the existing program and did save as and given new file name. Is there any way I could share the file to you so that you can take a look. Commented Feb 11, 2022 at 12:44
  • You could use a file sharing app like Google Drive, OneDrive, Dropbox, etc. Commented Feb 12, 2022 at 15:44
  • drive.google.com/file/d/1gtLcj8iC3xoKfA_XRJMmK5TMHXdgtGW9/… Please find the link below. Let us know what went wrong. Appreciate if you could have this file open in ev3 Commented Feb 14, 2022 at 1:04
  • @DavidLechner Could you please confirm if you were able to download file and fix it? Commented Feb 14, 2022 at 12:39

4 Answers 4

4

This is a generic error message, so everyone that gets the error won't have the same problem. However, using the methods described below could help find other problems as well.

The project files for the MINDSTORMS programming software are just ZIP files and can be opened with standard ZIP file tools. For Scratch-based software like EV3 Classroom, this file contains 3 files, one of which is scratch.sb3. The scratch.sb3 file is another ZIP file and can be extracted as well. Inside of the scratch.sb3 are two files, one of which is project.json. This is the actual project code file.

This file contains minified JSON that is hard to read, but modern code editors like Visual Studio Code contain tools to automatically format the file in a more readable way. Once this is done, an experienced coder can use their intuition to look for anomalies in the file.

The JSON file contains a top-level object with 4 sections, "targets", "monitors", "extensions" and "meta". The contents of these sections will depend on the project, but in general, "targets" contains an array of two objects, one where "isStage": true and one where "isStage": false. The former looks to be default Scratch stuff that isn't used and the latter is the bulk of the project file. The "monitor" section will be empty unless you have monitors (variable value watchers) set up in your project. The "extensions" section contains a list of the different block types used in your project and "meta" is some more default Scratch stuff.

I was able to find the issue with the file provided by noticing that in the "targets" section, there were two "isStage": true and two "isStage": false objects. So it appears that somehow two versions of the project got saved in the same file. I was able to recover the projects by making two copies of the original file. In one, I deleted the second two targets and in the other I deleted the first two targets. I used a diff tool to compare the contents of these and they similar but not identical, so I deduced that they are two versions of the same project. I then updated the ZIP files with the modified project.json and was able to open the projects in the EV3 Classroom software.

Another common issue is for variables or lists to contain null which is not allowed. They might look something like this in the project.json file (tip: use a code formatting tool to make it easier to read):


            "variables": {
                ",TgC](u;@i@rnsU@,};W": [
                    "MyVariable",
                    null
                ]
            },
            "lists": {
                "w(x#TbXK8~v6wedm-V9+": [
                    "MyList",
                    [
                        null,
                        "thing",
                        "thing"
                    ]
                ]
            },

To fix the null variable or list value issue, change null to 0 (or some other value that is valid).


            "variables": {
                ",TgC](u;@i@rnsU@,};W": [
                    "MyVariable",
                    0
                ]
            },
            "lists": {
                "w(x#TbXK8~v6wedm-V9+": [
                    "MyList",
                    [
                        "thing",
                        "thing",
                        "thing"
                    ]
                ]
            },
2
3

I figured out how to fix my .lmsp file for my particular case, and I wanted to share here in case it helps some of you.

So according to the previous posts, both the .lmsp file and the scratch.sb3 file (inside the .lmsp file once you changed the extension to .zip) are actually zip archives.

The issue was in the project.json file inside scratch.sb3[.zip]. As it turns out, if you run the program while your EV3 is connected to your computer (via USB in my case), it will try to save the historic values in your variables back to project.json after the program has finished running. In my case, I had a variable that was constantly being updated in the main loop, so I ended up with tens of thousands of lines of values in project.json. I suspect this is causing some overflow the next time the software tries to reload the project (I am using Mindstorms Education EV3 Classroom).

All I did was the following:

  1. Make a copy of your corrupt [project].lmsp as a backup

  2. Rename [project].lmsp to [project].lmsp.zip

  3. Extract [project].lmsp.zip

  4. Rename scratch.sb3 to scratch.sb3.zip

  5. Extract scratch.sb3.zip

  6. Open project.json in a JSON-friendly editor that will format the JSON into readable format.

  7. See if you see really bloated variables with lots of data in it. If you do, delete all those rows of data and save the file. Note there might be several variables that need "cleaning up".

  8. Replace the project.json in scratch.sb3.zip with the "cleaned up" project.json.

  9. Rename scratch.sb3.zip back to scratch.sb3

  10. Replace scratch.sb3 in [project].lmsp.zip with the newer scratch.sb3

  11. Rename [project].lmsp.zip back to [project].lmsp

  12. Try to open the project again

Hope this works for you too. I suppose the moral of the story is: since the Lego software does not have an in-app debugger, don't run the program using the "Run" button in the Mindstorms software, just use the software to download, and then run the program from the EV3 directly. If this doesn't work, disconnect the USB cable when you run your program.

Cheers, TechnicAddict

2

I have created a small Lego App Tool kit to fix the problem, until LEGO service team does -> https://legoapptools.azurewebsites.net

2

How to get an image of a corrupted Spike Prime .llsp file or a corrupted Ev3 Classroom .lmsp file.

If you suddenly get the dreaded message of “Heads up! Could not open project” don’t lose hope, there is a way - unfortunately it will still require redoing the code.

This method shows you have to get an image of your entire code so that you can copy from it:

  1. Make a copy of your corrupted file. Just in case.
  2. Rename your file and change the file extension to .zip
  3. Click yes on the pop up that warns you about changing the name
  4. Open the zipped folder (you can extract the files but it isn’t necessary)
  5. Open the .svg file in a browser (Google Chrome, Firefox, Microsoft Edge)
  6. Open a new spike prime project and copy your program from your image OR use the ‘Windows Snipping Tool’ or ‘Snip & Sketch’ tool to take a screen grab of your program then you can save it as a jpeg and use it later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.