Home Website Youtube GitHub

Problem with import geo custom step in maya 2024

Hi,

I’m trying to execute a pre custom step downloaded from the github and I´m having this error:

The step:C:/Users/ivant/Documents/Mgear/Build/scripts/pre/import_geo.py has failed. Continue with next step?

An exception of type IndentationError occurred. 

Traceback (most recent call last):
  File "C:\mgear4-master\release\scripts\mgear\shifter\guide.py", line 1352, in runStep
    customStep = imp.load_source(fileName, runPath)
  File "C:\Program Files\Autodesk\Maya2024\Python\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 719, in _load 
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1017, in get_code
  File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:/Users/ivant/Documents/Mgear/Build/scripts/pre/import_geo.py", line 41
    pm.importFile(os.path.join(path, "assets", "geo.ma"))
IndentationError: unexpected indent

I searched in the forum but I haven’t found a solution.

The script is as follows:

import os
import mgear.shifter.custom_step as cstp
import pymel.core as pm


class CustomShifterStep(cstp.customShifterMainStep):
    def __init__(self):
        self.name = "import_geo"


    def run(self, stepDict):
        """Run method.

            i.e:  stepDict["mgearRun"].global_ctl  gets the global_ctl from
                    shifter rig on post step
            i.e:  stepDict["otherCustomStepName"].ctlMesh  gets the ctlMesh
                    from a previous custom step called "otherCustomStepName"
        Arguments:
            stepDict (dict): Dictionary containing the objects from
                the previous steps

        Returns:
            None: None
        """
        self.import_geometry()

        try:
            pm.select("guide")
        except:
            pass


    def import_geometry(self):
        path =  "\\".join(os.path.abspath(
            os.path.dirname(__file__)).split("\\")[:-2])

        pm.importFile(os.path.join(path, "assets", "geo.ma"))

What can I do to resolve this and being able to import geo?

Thank you in advance.

When you paste code in this forum, please put it between triple backticks, like this:

```
Your code here
```

Then it will format properly, and we can see the problem. The error is an indentation error on line 41. So go to line 41 of import_geo.py and make sure your indentation is correct.

What says that? Please paste the full, actual, exact error you are getting, rather than paraphrasing it.

Sorry, I’m totally new with this. I fixed my initial post with correct formating.

As I said, I downloaded the import geo custom step from mgear github sample data. I didn’t modified anything. I tried indenting in different ways but found no solution.

Thanks again for your attention