Skip to content
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

Getting a python error. #7

Open
SyRaza opened this issue Dec 5, 2022 · 12 comments
Open

Getting a python error. #7

SyRaza opened this issue Dec 5, 2022 · 12 comments

Comments

@SyRaza
Copy link

SyRaza commented Dec 5, 2022

I have no idea what this means but this is the error I'm getting. I'm on blender 3.3.1

Python: Traceback (most recent call last):
  File "C:\Users\Sy\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\jremesh-tools-main\jrt_remesh_op.py", line 74, in execute
    bpy.ops.export_scene.obj(filepath=orig,
  File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.export_scene.obj" error, could not be found

@bekmeh
Copy link

bekmeh commented Mar 24, 2023

I had the same error, and resolved it by enabling the plugin called "Import-Export: Wavefront OBJ format (legacy)"

@jakub-bak
Copy link

I had the same error, and resolved it by enabling the plugin called "Import-Export: Wavefront OBJ format (legacy)"

That resolves the issue indeed, worth mentioning in the DOCS as some users disabled that legacy importer for startup time savings.

@dfsadfsfsa
Copy link

Ive just had the same error using Blender 4.0.
Wavefront OBJ Import/Export is built in to Blender as of v3.3 hence no option to install addon.

@ZackHaronOriginal
Copy link

I'm getting the same error has anyone found a solution to this?

@Stefanizam
Copy link

Any solutions for blender 4.0 ?

@natahnd
Copy link

natahnd commented Dec 22, 2023

For blender 3.3 and 4.0, the OBJ Import/Export is now built into the system, so the API calls bpy.ops.export_scene.obj and bpy.ops.import_scene.obj no longer exist. I dug into the blender API changes and found the new functions for OBJ Import/Export and implemented those but I'm not entirely sure it is the correct fix, as some of the arguments from the original functions aren't in the new functions.

However, for someone else to test and verify if they would like, these are the changes I made inside the failing file:

  • jremesh-tools-main\jrt_remesh_op.py

On line 73, I changed the OBJ export command from:

# Export original object
bpy.ops.export_scene.obj(filepath=orig,
                            use_selection=True,
                            use_mesh_modifiers=True,
                            use_edges=True,
                            use_smooth_groups=False,
                            use_smooth_groups_bitflags=False,
                            use_normals=True,
                            use_uvs=True)

to

# Export original object
bpy.ops.wm.obj_export(filepath=orig,
                            check_existing=False,
                            export_selected_objects=True,
                            apply_modifiers=True,
                            export_smooth_groups=False,
                            smooth_group_bitflags=False,
                            export_normals=True,
                            export_uv=True)

On line 96, I changed the OBJ Import command from:

# Import remeshed object
bpy.ops.import_scene.obj(filepath=output,
                             use_smooth_groups=False)
                             use_image_search=False)

to

# Import remeshed object
bpy.ops.wm.obj_import(filepath=output,
                             use_split_objects=False)

If someone else could verify if these are the correct changes then would be as appreciated as this is the first time using this plugin for me in Blender, so I'm not sure if the results are correct or not, and I haven't installed the older versions to verify.
Cheers

@ddkro
Copy link

ddkro commented Dec 24, 2023

If someone else could verify if these are the correct changes then would be as appreciated as this is the first time using this plugin for me in Blender, so I'm not sure if the results are correct or not, and I haven't installed the older versions to verify. Cheers

4.0, it's not working

@CiPH3R-NFS
Copy link

@natahnd i ran your fix and got this error

image

@arrafi-musabbir
Copy link

Turns out bpy.ops.import_scene.obj was removed at bpy>=4 which is the latest blender-api for python, hence the error. In bpy>4 you have to use bpy.ops.wm.obj_import(filepath='')

I just downgraded to bpy==3.60 and it worked for me:

pip install bpy=3.6.0

@jayanam
Copy link
Owner

jayanam commented Jan 14, 2024 via email

@arrafi-musabbir
Copy link

that would be great, thank you!

@natahnd
Copy link

natahnd commented Jan 15, 2024

@natahnd i ran your fix and got this error

image

The error you're reporting suggests that the changes haven't been applied in your Blender correctly. This likely requires a restart of Blender if you changed the python script whilst it was open. The reason I can tell its not updated is it's saying:

"calling operator bpy.ops.export_scene.obj error" whereas the new function name, if updated correctly is bpy.ops.wm.obj_export.

That said I would wait for the official update as indicated in the above comments :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests