• hecate

    Exactly! Lovely!

    I will have to look into this in more detail but if I understand this correctly, return [i for i in result if result[i]] if result else None is what makes it possible to deselect?

    I find it a bit confusing that in the table_view_source example http://omz-software.com/pythonista/docs/ios/ui.html#tableview there is a method called tableview_did_deselect but I couldn't see that it was ever being called..

    Thank you kindly!

    posted in Pythonista read more
  • hecate

    That was a great resource for examples, thank you!
    By multi-selection I mean that you can add and remove check-marks on several rows in the table, I couldn't that these examples adressed that... Or am I missing something?

    posted in Pythonista read more
  • hecate

    I realize this was written quite a long time ago, but I tried to use the code in this example and I struggle to understand how I can have both multiple select and deselect.

    By changing the row
    self.currentRow = row # needed for the test above
    self.currentRow = selected = tableview.selected_rows
    I manage to get to the multi-select-part, not fancy nor smart, but from there I am currently at loss.

    Anything someone could suggest?

    posted in Pythonista read more
  • hecate

    Thank you!!
    I actually wrote an answer along "I used pip install darkskyand lalala", the second I clicked [Submit] I realized I have been writing darksky instead of darkskylib... installing the ****** wrong library. 😳 😫 🙁

    The library: https://github.com/lukaskubis/darkskylib
    It's not my own, and it actually doesn't say how to install it in the readme. I have just assumed..

    So I found the reason, I thought..! On the ipad air 2, that had a clean install of pythonista...

    • I installed stash, restarted app.
    • pip install darkskylib, restarted app.
    • pip install requests, restarted app.
    • Ran the script: "Cannot find module for chardet.

    Which I thought was strange but I realized I didn't update stash this time around. So I did selfupdate -f bennr01:wheelfix. Tried again, same thing.

    • I removed all the files I could find for darkskylib.
    • I restarted pythonista.
    • Ran pip install darkskylib again, it said it was already installed.

    Did a full reinstall of the pythonista. New round.

    • Install stash. restart app.
    • Update stash, restart app.
    • Install requests, restart app.
    • Install darkskylib:
    [~/Documents]$ pip install darkskylib
    <class 'ModuleNotFoundError'>: No module named 'chardet'
    [~/Documents]$ pip install chardet
    <class 'ModuleNotFoundError'>: No module named 'chardet'

    posted in Pythonista read more
  • hecate

    @bennr01 said:

    Do not worry about these folders. They are meant for extensions and are empty by default.


    I just tested this example on both py2 and py3 and it seems to work

    Wow. I cannot get it to work. :/

    Have you tried restarting pythonista (double tap home, the force-quit the app and start again)?

    I have restarted the app countless of times, exactly that way. Last try of installing Plotly, Pythonista couldn't reopen again, it crashed while loading. But hey, I didn't have to restarting it?

    Same as above (btw, import works fine for me, but i have not tested actual functionality).

    Wow again. I will have to give this another go!

    BTW, you should avoid from module import *-style imports, as they may lead to import-related problems. A better import would be from darksky.core import *.

    I changed this part of the code, restarted again and again but it still won't run. I tried to remove darksky from Python Modules/site-packages-3 where I removed the darksky-folder. I did about 10 restarts of the app and then tried to reinstall through StaSh; "Error: Package is already installed"
    I did a reinstall of pythonista but I don't feel like trying to get this Plotly to work anymore. I would be so happy if the scripts I had could just work as they used too..

    Is there a core.py-file in site-packages-3/darksky/? If there is, then you are probably experiencing some of the CWD-related problems mentioned above.

    Yep there was before I reinstalled it all over again. The change to from darksky.core import * didn't make any difference unfortunatly. And thank you and @JonB for explaining how the sys.path works!

    I can confirm that the no module named 'core' error exists depending on the way you import/launch __init__.py You should either try it with from darksky.core import * instead or try to install and run with py2 (py2 has some different import behaviors and from darkskye import forecast works fine). Also, restart after any changes to files in a site-packages* directory, or your change will not take any effect.

    I tried installing darksky with StaSh running python 2.7. It was installed. Restarted the app a couple of times. Ran the script with python 2.7, I get an error with the syntax, fair enough, though it doesn't print the traceback, I get an empty console. Regardless if I use from darksky import forecast or from darksky.core install * I get the same result.

    I guess that's as far as I can manage to get with this.. can I use a js-based graph-tool in Pythonista? If you have any suggestions for this I will gladly listen.

    Thank you again @bennr01 and @JonB for all your help!!

    posted in Pythonista read more
  • hecate


    import six
    print (sys.path)

    Gave this response:

    >>> import six
    >>> print(six.__file__)
    >>> print (sys.path)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    NameError: name 'sys' is not defined

    In site-packages-3/darksky/ there is a core.py and init.py.

    When I run versionin StaSh:

    StaSh v0.7.1
    Pythonista 3.2 (320000)
    iOS 12.1.2 (64-bit iPhone8,4)
    Python 3.6.1
    root: ~/Documents/site-packages/stash
    core.py: 2019-01-06 15:13:31

    I did upgrade per instructions of @bennr01 : selfupdate -f bennr01:wheelfix

    DarkSky worked when I installed this before, without the wheelfix-upgrade.

    posted in Pythonista read more
  • hecate

    Hi! maybe this qustion wasn't meant for me but I would love it to work in either case. :)

    posted in Pythonista read more
  • hecate


    Thank you kindly for your detailed and very helpful (and very fast!!) answer! I have more busy days now that vacation is over..

    I did a reinstall of both Pythonista and StaSh
    On my iphone this far, and updated per your instructions to get the fixed version. It doesn't seem to work still, and I wonder if there could be something with my code. I thought maybe it would be easier to find the problem if you have the same as me.

    import plotly 
    plotly.tools.set_credentials_file(username='[username]', api_key='[token]')
    import plotly.plotly as py
    from plotly.graph_objs import *
    data = Data([ Scatter(x=[1, 2], y=[3, 4]) ])
    plot_url = py.plot(data, filename='my plot')

    I'ts an example I found in a tutorial and I have replaced username and token for my own when I run it.

    This generated the following traceback:

    Traceback (most recent call last):
      File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/Temperature/plotly_entropia.py", line 1, in <module>
        import plotly
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/__init__.py", line 31, in <module>
        from plotly import (plotly, dashboard_objs, graph_objs, grid_objs, tools,
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/plotly/__init__.py", line 10, in <module>
        from . plotly import (
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/plotly/plotly.py", line 31, in <module>
        from plotly.api import v1, v2
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v1/__init__.py", line 3, in <module>
        from plotly.api.v1.clientresp import clientresp
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v1/clientresp.py", line 9, in <module>
        from plotly.api.v1.utils import request
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v1/utils.py", line 9, in <module>
        from plotly.api.v2.utils import should_retry
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v2/__init__.py", line 3, in <module>
        from plotly.api.v2 import (dash_apps, dashboards, files, folders, grids,
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v2/dash_apps.py", line 6, in <module>
        from plotly.api.v2.utils import build_url, request
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/plotly/api/v2/utils.py", line 127, in <module>
        stop_max_delay=180000, retry_on_exception=should_retry)
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/retrying.py", line 47, in wrap
    AttributeError: module 'six' has no attribute 'wraps

    If I run my darksky-app, (that I for sure can have broken myself!) it doesn't seem to get 'core'?

    The traceback

    **the Traceback (most recent call last):
      File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/weather_bagarmossen.py", line 4, in <module>
        from darksky import forecast
      File "/private/var/mobile/Containers/Shared/AppGroup/B45A435E-6A06-4C49-A432-C693B398B81F/Pythonista3/Documents/site-packages-3/darksky/__init__.py", line 1, in <module>
        from core import *
    ModuleNotFoundError: No module named 'core'

    The folders
    On the phone I still get a fsi, man, patches in stash_extensions that are empty... binis also empty.

    I seem to be running the last version of stash in either case :)
    I will try this on the ipads asap and come back with the results!

    posted in Pythonista read more
  • hecate

    Hi everyone!

    I have tried to install Plotly in Pythonista and I keep getting "cannot import name"-errors.

    In a final try I made a fresh install of Phytonista 3 and gave it a new go!
    Same procedure on iphone 6SE (12.1.2), ipad mini 4 (12.1.1) and ipad air 2 (12.1.1).


    • Pythonista + StaSh: different folder-structure on 12.1.2 vs 12.1.1.

    • Pythonista + StaSh + Plotly: same folder-structure for 12.1.2 and 12.1.1.

    • Empty local folders (/bin /fsi /man /patches). Is that normal?

    • PIP: I can upgrade on one ipad but the other. --upgrade is an unrecognized argument.

    • Same error on all installations for line 1 in script: import plotly

    Everything crashes. 😿

    (I have managed to install qhue (https://github.com/quentinsf/qhue)[https://github.com/quentinsf/qhue] with StaSh, and use it, without any problems. )

    Installing Stash

    1. In Console:
      import requests as r; exec(r.get('https://bit.ly/get-stash').text)
    2. Restarted Pythonista
    3. Ran the file launch_stash.py
    4. Restarted Pythonista
    5. Ran the file launch_stash.py again. I get a shell.

    The folders on iPhone

    Is this how the folder-structure should be built? With a folder for stash_extensions with 4 empty folders? They remain empty, even after I have installed plotly.

        |-- This iPhone
        |-- [Examples]
        |-- [stash_extensions]
             |-- [bin] - empty
             |-- [fsi] - empty
             |-- [man] - empty
             |-- [patches] - empty
    |-- ICloud
    |-- Python Modules
        |-- Standard Library 2..
        |-- Standard Library 3..
        |-- [site-packages] (empty)
        |-- [site-packages-2] (empty)
        |-- [site-packages-3] (empty)
    |-- File Templates
        |-- Readme.md

    Installing plotly

    1. Ran the pip install plotly command in the shell. Took half forever.
    Got a warning right in the beginning saying "cannot find dependencies".. this is the result:

    Running handler 'console_scripts installer'...
    No entry_points.txt found, skipping.
    Cleaning up...
    Package installed: plotly

    [site-packages-3] now have several folders. It seems they are placed in root, there is no folder specific to plotly.

    As a plot-twist: The iPads don't get the empty folders inside [This iPad] when installing StaSh. Instead the folders appeared after I installed plotly. They also remain empty.

    I get the same error on the ipads as the iPhone when running the same script.
    I tried from both iCloud and This iPhone/iPad.

    2. I run a script get stuck on line 1.

    import plotly.

    cannot import name 'exceptions'
    plotly.py <module> (Line 30)

    Print Traceback

    Traceback (most recent call last):
    File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/Temperature/plotly_entropia.py", line 1, in <module>
    import plotly
    File "/private/var/mobile/Containers/Shared/AppGroup/63784CB9-E25E-4FFB-A7F4-D38A7B74A24B/Pythonista3/Documents/site-packages-3/plotly/__init__.py", line 10, in <module>
    from . plotly import (
    File "/private/var/mobile/Containers/Shared/AppGroup/63784CB9-E25E-4FFB-A7F4-D38A7B74A24B/Pythonista3/Documents/site-packages-3/plotly/plotly.py", line 30, in <module>
    from plotly import exceptions, files, session, tools, utils
    ImportError: cannot import name 'exceptions'

    Not working.

    Going bananas

    1. But I read that an update could help!
    plotly.py issue 104

    However - as the mess that I am - I did an upgrade of StaSh and not of plotly.

    selfupgrade -f , on iphone, made Pythonista crash.
    And as it keeps crashing I will probably have to start over from scratch there...

    2 Instead! I move to the ipad air 2!

    pip install plotly --upgrade
    As stated on https://plot.ly/python/getting-started/, did not work.

    pip install --upgrade plotly
    >> No download available for upgrade: 0.0.1..

    3. The last straw: change an url in /bin/
    From topic/4733/stash-install:

    The PyPi API was changed. The new link is 'https://pypi.org/pypi/{}/json'. Thus, the simplest way to fix this is to find the pip.py (~/Modules/site-packages/stash/bin/pip.py) and change the old link(http://pypi.python.org/pypi/{}/json) to 'https://pypi.org/pypi/{}/json'

    I tried that and restarted the app.
    Now also Pythonista on ipad air 2 is crashing...

    4. Trying out the upgrade of step 8 on the iPad mini 4

    Either way I formatted it:

    >> usage: pip.py [-h] [--verbose] [-6] sub-command ...
    >> pip.py: error: unrecognized arguments: --upgrade

    I need to take a walk now.

    Any help would be greatly appreciated! 💟

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!