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
"TypeError: 'ObjCInstance' object is not callable" on macOS High Sierra #243
Comments
@elgertam Thanks for the report. As you've noted, this is almost certainly a manifestation of the same problem as #154, which was in turned caused by beeware/rubicon-objc#40. The problem is caused by subtle changes that Cocoa introduces between versions. Quoting @dgelessus from the Rubicon ticket:
When Sierra came out, In this case, it looks like High Sierra has turned |
I might have suggested this before - to prevent this issue from reappearing every time a new macOS version comes out, should we by default require calling all methods explicitly, even if they are declared as Objective-C properties? That way the behavior would be forward-compatible. The downside is that it would require a |
@dgelessus I can see what you're proposing, but IMHO the approach we've got here is more idiomatic - both in Python and objective C. Yes, it means some headaches every time a new macOS or iOS release comes out, but they're relatively easy bugs to fix, once they're identified. |
So locally I have fixed the NSApplication.sharedApplication() and NSWindow.mainWindow() issues. Not sure I corrected them in the correct place. Did a search and they were fixed in a test file in rubicon so I corrected them in toga/cocoa source tree. Now I am getting this error. I have interrogated left_table, and indeed it does not have an "insert" method. So any suggestions? |
Ignore my comment - this is the Toga issue section. I thought I was on the Rubicon repo, sorry. |
This has been corrected with Rubicon 0.2.10. |
I'm afraid the problem persists even after upgrading to rubicon-objc 0.2.10
Python version I'm happy to provide more useful information if you point me in a direction |
@NewNork It looks like you're using a Toga version that doesn't have the fix for High Sierra. The fix was added in c66745e, but as far as I can tell there hasn't yet been a Toga release that includes this fix. You can try installing Toga directly from the repo, using |
Hi @dgelessus Just to confirm, I have the same error, then read all the comments, and update the toga package as you mention ( here is what I do: created virtualenv:
installed toga for the first time:
Run toga for the first time:
check the installed package's versions in venv:
Here I saw your fix, and applied:
run again toga-demo:
here is the packages versions installed right now:
I missed something? HTH |
@jfunez Unfortunately, the instructions @dgelessus gave won't work - the Toga repository contains a number of sub-packages, and there's no way to install the sub-packages directly from git. If you look at your To install the development version of Toga, you need to run:
|
You could install them both directly via pip:
It probably makes more sense to clone it like @freakboy3742 said, however. |
I followed your instructions of @freakboy3742, but now I'm having this error when running the demo:
I also executed the test and everything is fine... |
@freakboy3742 Cheers mate. That worked. Hopefully they push the changes soon. |
@jfunez As you might guess when you install a version of code direct from a Git repository, you're going to find bugs sometimes :-) We're in the middle of a huge refactor, and there are still bugs in some areas of the code (the toga-demo is just one example). You will probably have more luck looking in the examples directory of the Toga repository - those examples are more likely to be up to date. |
Hi @freakboy3742
Thanks to everyone who helped me! |
@jfunez How should I install cocoa==0.3.0.dev1 as I get the error
|
@tourdownunder
|
thanks. i worked out i could use pip install git+https://github.com/pybee/toga.git#subdirectory:/tree/master/src/cocoa though then i had another issue running the app. I might try with a new virtual machine or uninstalling the old version first. |
I am trying but I am receiving the following error, How can I fix that, which commit in current development version I need to use? |
Checkout out 5ffd722 worked for me @promentol |
On High Sierra, I used: On my MacBook running Sierra, 0.2.15 worked |
Fresh pip install on macOS mojave still has this error. This works though:
|
@mlewis1973 @poke1024 This bug will likely re-emerge with every new macOS release; it has to do with the way that Objective C can change a function into a readonly property in a way that is unambiguous to the Objective C language spec, but is different to the interface that we use to access the property. If you get this error, we need to know which API call failed. The fix is trivial - once we know which API has changed. For example, in the move from Snow Leopard to Mavericks, the The stack trace you receive will reference the API call that failed - that's what we need to know. If you're feeling especially adventurous, you can try submitting a PR yourself, adding the |
In High Sierra (macOS 10.13), I am unable to use Toga or Toga-demo due to a
TypeError
. I was able to duplicate this on a fresh install of High Sierra in a VM; when I installed Toga and Toga-demo on a fresh install of Sierra (10.12), Toga and Toga-demo worked with no issues.This has similar symptoms as issue #154, but downgrading Rubicon has not solved the problem.
Details
Python Installation
Virtualenv
First Attempt
Downgrade Rubicon
Rubicon-objc==0.2.7
Rubicon-objc==0.2.6
Rubicon-objc==0.2.4
The text was updated successfully, but these errors were encountered: