microblog
microblog copied to clipboard
Error running first example in Chapter 22
I'm running under macOS 10.14.6. In Chapter 22 when I tried the example under Executing Tasks I'd get the error:
+[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
I found this answer on Stack Overflow in reply to someone having the same issue. Instead of adding OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES to my .bash_profile, I did what this comment suggested and changed my command line to OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES rq worker microblog-tasks. After this change the example worked as expected.
It might be worth adding a note regarding this for users running macOS >= High Sierra. Thanks.
@SSteve Can you post the version information that appears before the prompt when you start a Python interpreter? I don't recall ever seeing this when using homebrew releases of Python.
This is with my Microblog venv activated:
$ python
Python 3.9.7 (default, Sep 3 2021, 12:36:14)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
It looks like I have a newer clang compiler than yours, and I don't recall ever seeing this problem:
Python 3.9.6 (default, Jun 29 2021, 06:20:32)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
I wonder if this happens only on High Sierra? I'm on Catalina.
This is on a MacBook Pro running Mojave 10.14.6. I don't have any machines running Catalina but I have an Intel iMac and M1 iMac both running Big Sur. I'll try on both of those.
I tried on both the Big Sur iMacs. The problem didn't happen on either of them. I tried on another iMac running Mojave and it did exhibit the error. So maybe it's just a range of macOS versions. I'll leave it up to you whether or not you think that's worthy of mention. I was able to figure out a solution fairly quickly, but I have decades of experience on the Unix command line. A beginner might have more trouble.