• ihf

    Not running GnuCash, just piecash which is an interface to the GnuCash SQLite dB. Will try with Python 3. Since pip does not run under Python 3, what is the best way to install piecash? Just move things from site packages 2 to 3?

    posted in Pythonista read more
  • ihf

    I did a pip install piecash (it's a python interface to GnuCash) . I had to add a couple of dependencies using pip that showed up when I did import piecash. Now I get the following:

    import piecash
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/site-packages-2/piecash/init.py", line 15, in <module>
    from .core import (
    File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/site-packages-2/piecash/core/init.py", line 1, in <module>
    from .session import create_book, open_book, Version
    File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/site-packages-2/piecash/core/session.py", line 11, in <module>
    from piecash.core import factories
    ImportError: cannot import name factories```

    posted in Pythonista read more
  • ihf

    Sorry if this has already been covered but when I run stash under version 3.6 and then use PIP I get:

    [~/Documents]$ pip install piecash
    <class 'ImportError'>: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
    [~/Documents]$

    posted in Pythonista read more
  • ihf

    It would appear that the version of Matplotlib in Pythonista is 1.4.0 and the current version is 3.1.1. Is it possible to install the newest version in site packages or must this upgrade be done by omz?

    posted in Pythonista read more
  • ihf

    (I don't know why my previous posting resulted in 2 empty posts which I cannot delete)

    Here is another simple example that either crashes Pythonista or gives an error (undoubtedly due to my coding):

    import matplotlib.pyplot as plt
    
    # Pie chart, where the slices will be ordered and plotted counter-clockwise:
    labels = ['a', 'b', 'c']
    sizes = [.3, .4, .2], 
    explode = (0, 0, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')
    
    fig1, ax1 = plt.subplots()
    ax1.bar(height=sizes, labels=labels, autopct='%1.1f%%',
           shadow=True, startangle=90)
    ax1.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
    
    plt.show()```
    
    This crashes 2.7 and gives this traceback for 3.5:
    
    Traceback (most recent call last):
     File "/private/var/mobile/Containers/Shared/AppGroup/4F06F35D-865B-4115-B827-BA053B3731EF/Pythonista3/Documents/matplotlib-piechart-example.py", line 10, in <module>
       shadow=True, startangle=90)
    TypeError: bar() missing 1 required positional argument: 'left'

    posted in Pythonista read more
  • ihf

    I am trying to plot some data from an SQLITE db and I am having a problem with the data conversion:

    import sqlite3
    import time
    import datetime
    
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.dates as mdates
    
    conn = sqlite3.connect('acurite.sqlite')
    c = conn.cursor()
    
    sql = "SELECT * FROM acuriteHx"
    graphArray = []
    
    for row in c.execute(sql):
       startingInfo = str(row).replace(')','').replace('(','').replace('u\'','').replace("'","")
       splitInfo = startingInfo.split(',')
       graphArrayAppend = splitInfo[0] + ',' + splitInfo[2]
       graphArray.append(graphArrayAppend)
    #print(graphArray)
    datestamp, value = np.loadtxt(graphArray,delimiter=',', unpack=True,
                                 converters={ 0: mdates.datestr2num('%Y-%m-%d %H:%M:%S')})
    
    fig = plt.figure()
    
    rect = fig.patch
    
    sax1 = fig.add_subplot(1,1,1, axisbg='white')
    plt.plot_date(x=datestamp, y=value, fmt='b-', label = 'value', linewidth=2)
    plt.show()   ```
    
    When run with Python2.7 it crashes Pythonista and when run with Python3 it gives:
    
    Traceback (most recent call last):
     File "/private/var/mobile/Containers/Shared/AppGroup/4F06F35D-865B-4115-B827-BA053B3731EF/Pythonista3/Documents/sqliteplot.py", line 22, in <module>
       converters={ 0: mdates.datestr2num('%Y-%m-%d %H:%M:%S')})
     File "/var/containers/Bundle/Application/D78A900B-1E3B-4075-9CAB-F95408B28CD2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/dates.py", line 283, in datestr2num
       dt = dateutil.parser.parse(d, default=default)
     File "/var/containers/Bundle/Application/D78A900B-1E3B-4075-9CAB-F95408B28CD2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/dateutil/parser.py", line 749, in parse
       return DEFAULTPARSER.parse(timestr, **kwargs)
     File "/var/containers/Bundle/Application/D78A900B-1E3B-4075-9CAB-F95408B28CD2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/dateutil/parser.py", line 311, in parse
       res, skipped_tokens = self._parse(timestr, **kwargs)
    TypeError: 'NoneType' object is not iterable

    posted in Pythonista read more
  • ihf

    [~/Documents]$ version
    StaSh v0.7.2
    Pythonista 3.3 (330013)
    iOS 12.3.1 (64-bit iPad6,4)
    Python 2.7.12
    root: ~/Documents/site-packages/stash
    core.py: 2019-05-26 16:33:08
    SELFUPDATE_TARGET: master
    BIN_PATH:
    ~/Documents/bin
    ~/Documents/stash_extensions/bin
    ~/Documents/site-packages/stash/bin
    [~/Documents]$

    posted in Pythonista read more
  • ihf

    I tried again to remove and reinstall the latest version of pytube but it just returns with no download or error message. I guess it should be removed from the stash distribution.

    posted in Pythonista read more
  • ihf

    @mikael That returns with no error and no download.

    posted in Pythonista read more
  • ihf

    I was trying to install the latest version v9.5.0 of pytube thinking that might work better than the v8.0.2. I started stash and did a pip uninstall pytube followed by a pip install pytube and then restarted stash. Now when I try to use the pytube command it just returns. Even pytube -version produces no output. Thoughts?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!