Python multiprocessing error - NotADirectoryError #93980
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#93980
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Mac OS Monterey 12.0.1
Graphics card: None
Blender Version
Broken: 3.0.0
Worked: I haven't tried other versions
Short description of error
When scripting with python and using multiprocessing, the Child process crashes with a strange error.
Exact steps for others to reproduce the error
Currently getting an error with multiprocessing, this is the code:
print(title)
print('module name:', name)
if hasattr(os, 'getppid'): # only available on Unix
print('parent process:', os.getppid())
print('process id:', os.getpid())
info('function f')
print('hello', name)
info('main line')
p = Process(target=f, args=('bob',))
p.start()
p.join()
print("done")
main()
This is the output when using Blenders Python:
Expected output (This is what I get when I don't use Blenders Python [Python 3.9.0]):
It seems like the child that gets created from multiprocessing just crashes. Anyone have any ideas?
Added subscriber: @struny
Added subscriber: @chemicalcrux
The problem is that it's trying to run a script with the name of the Text object in blender. So, if the Text object is called "Text", it tries to run a script called "Text" (which does not exist).
In my case, I'm running a copy of Blender I built, and it appears to be trying to find the script in the
D:/
directory.FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Text'
If I save the text file as "test.py", then rename the Text object to "test.py", the script works correctly...but that's pretty much just a coincidence.
@chemicalcrux
For me it seems like by default it is looking in my
.blend
file (NotADirectoryError: [Errno 20] Not a directory: '~/Documents/Blender/webcam.blend/test.py'
) to find the python script, and I am not sure why. I already have my text block namedtest.py
.I was able to find a work around:
If you modify the
__file__
variable and point it directly to where the python script is located, it seems to work.file = '../../~/Documents/Blender/testing/test.py'
...
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Not getting this error on Linux (tried 3.0 and master).
Looks like this has been discussed before [on Windows at that time] https://blender.stackexchange.com/questions/8530/how-to-get-python-multiprocessing-module-working-on-windows
So the
__file__
trick is probably the recommended workaround, will doubt this is considered a bug, will let #python_api decide though.Added subscriber: @Jindrich-Cech
This bug is persistent up to Blender 3.2.0 (Alpha). MacOS Blender Text editor provides bad script file path to modules (in my case /Users/jindra/Projects/Blender/gps.blend/gps.py instead of /Users/jindra/Documents/gps.py). If I run the same commands in Blender Python console - works OK. Everything is clear from added pictures...