pyzillow import error
I did a pip install pyzillow and then to run a test, I did:
from pyzillow.pyzillow import ZilloWrapper, GetDeepSearchResults
and I get:
ImportError: cannot import name ZilloWrapper
Can anyone tell me what is wrong?
Seems to be a typo. It should be ZillowWrapper instead of ZilloWrapper. The following code works
from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults print(dir(ZillowWrapper))
Oops! :-( Thanks for seeing that. Just shows that no matter how long I can stare at a line , I can still do that.
I followed the example in https://pypi.python.org/pypi/pyzillow/0.5.5 under "Usage of the GetDeepSearchResults API". If I pass it a correct address it works fine. If I pass it an incorrect (or non-existent address), Pythonista crashes. I tested on a Mac and what it should return is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pyzillow/pyzillow.py", line 31, in get_deep_search_results
return self.get_data(url, params)
File "//anaconda/lib/python2.7/site-packages/pyzillow/pyzillow.py", line 82, in get_data
Does the faulthandler record any errors?
If you are using the py2.7 interpreter, in some recent versions sys.exit results in an app crash, without any faults logged. you might try first importing sys, then monkey patching
exitto be a no op. Some scripts are intended to be run from the command line so use sys.exit to indicate errors.
So sorry, but is there a faulthandler log? Also, not sure how to do what you suggest.
@ihf The current betas for Pythonista 3 automatically log Objective-C exceptions, but this is unlikely to help here, since pyzillow probably doesn't use Objective-C APIs.
To get some info about "normal" crashes not related to Objective-C, you can add my faulthandler code to your
pythonista_startup.pyfile. Once you've done that, you need to restart Pythonista so the faulthandler is loaded. Then run the crashing code again. When you restart Pythonista after the crash, there should be a red message in the console telling you the name of the crash log it wrote. You can find that log in the
faultlogfolder in Pythonista's file list. You can copy and post the contents of that here.
By the way, if you are using Pythonista 2, the faultlog might not appear. If the crashing script is running in Python 2 under Pythonista 3, the log will be a bit more useful, but won't show in what line of Python code the crash happened. (This is because the
faulthandlermodule only exists in Python 3.)
@dgelessus The script is running with Python 2.7 using the beta of Pythonista 3 (interpreter set to 2.7). Are your instructions still valid?
Yes, in that case everything should work, and the faultlog should have some useful information in it after the crash.
I downloaded your python_startup.py script, restarted pythonista, and re-ran the crashing script and id not see any red message in console nor any faultlog folder. Do I need to do anything to enable the startup script?
I tried running the startup script and it created the faultlog folder but if I then restart pythonista and run the offending script, nothing is added to the folder. I presume that the startup script is not being run?
The startup script is a built-in Pythonista feature. When you start Pythonista, it looks for a script called
pythonista_startup.pyin your main Pythonista folder, and runs it if there is one. You don't have to run the startup script by hand. I'm guessing you don't have a
pythonista_startup.pyyet, so you can simply create one and paste the faulthandler code inside. Then restart Pythonista and the startup script should run automatically.
I tried again and the zillow script fails but there is no fault log written.
Hm, that means that the app terminated "expectedly". As @JonB said, the Python 2 interpreter currently has a bug that makes
sys.exitquit the entire app. Try running this code in the interactive prompt to "disarm"
>>> import sys >>> sys.exit = lambda *args: print("sys.exit", *args)
Then you can run your script again and see if pyzillow calls
The print in the lambda gives a syntax error. I tried without parens but that's not it. can you modify that for Python 2.7?
Not sure if this is correct but I changed it to:
sys.exit = lambda *args: sys.stdout.write("sys.exit", *args)
but the offending script still just exits.