Skip to content
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

Make blessed dependency optional #32

Closed
Kraymer opened this issue Oct 27, 2015 · 14 comments
Closed

Make blessed dependency optional #32

Kraymer opened this issue Oct 27, 2015 · 14 comments

Comments

@Kraymer
Copy link
Owner

Kraymer commented Oct 27, 2015

qifqif should work in degraded mode (no colors, no fullscreen ) when blessed is not available, as it is the case on Windows.

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 27, 2015

I took a stab at it.

@flywire Can you checkout the windows branch and tell me how it works for you?

@flywire
Copy link

flywire commented Oct 28, 2015

On Wed, Oct 28, 2015 at 9:35 AM, Fabrice Laporte notifications@github.com
wrote:

... @flywire https://github.com/flywire Can you checkout the windows
branch https://github.com/Kraymer/qifqif/tree/windows and tell me how
it works for you? ...

  1. Good news! Might take me 48 hours if I have problems.
  2. How do I setup ~/.qifqif.json file? I haven't used json before and it
    looks a bit confusing. Is spacing important? Do I have to create a file in
    the same format as: config.json
    https://github.com/Kraymer/qifqif/blob/windows/test/rsrc/config.json?
  3. What is ~/.qifqif.json marked character? I expected ~/qifqif.json

Regards

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 28, 2015

Yes, same format as config.json.
You're not expected to enter the json content manually, although you can.

  1. Classic way consist to let qifqif build your json file iteratively along the different executions on .qif files. You enter a pair category/match per transaction and qifqif takes care of writing a consolidated valid json. With time qifqif will interrupt less and less to query you for a match as the json file is growing.

  2. Another approach, if you know already all your category/match pairs, is to write your config file a priori : running qifqif will result in qifqif never stopping on a transaction as you've already entered all the matching data.
    If you go with that option, you're in charge of writing a valid json (https://jsonformatter.curiousconcept.com/ may help) like

    {
        "Category 1": [
            "First match",
            "Second match"
        ],
        "Category 2": [
            "Third match"
        ]
    }
    

I would recommend going with option 1 as being efficient in the way matchings are entered and stored has been a top priority during qifqif development. You can benefit from the auto-completion and don't have to worry about json formatting + qifqif will reject a match that is not found in the transaction.
Additional reason is that as you're the first Windows user I'm aware of, it would be cool if you could test the full qifqif experience 🌠 , not just the .qif writing part.

What is ~/.qifqif.json marked character? I expected ~/qifqif.json

Having conf files names starting with a dot and located in the Home directory (aka ~) of the user is a unix convention. Yes, current default path definition probably doesn't work well on Windows, please open an issue if it creates the file in a weird place or don't create it at all.
As a workaround, use the c flag (qifqif -c mypath/myfile.json) to specify an explicit path for the config file. The file doesn't have to exist, it will be created by qifqif on writing.

Good luck 🍀

@flywire
Copy link

flywire commented Oct 29, 2015

I reformatted and sorted the list I sent you On Wed, Oct 28, 2015 at 9:35
AM two ways in libre calc and merged manually. The attached file should do
me for a start. I still need to use gnucash more to know exactly what my
categories will be called but I will update them by spreadsheet and rerun
qifqif on the downloaded files and import to gnucash again.

I will test the full funtionality of qifqif.py under windows (ie generate
json file) later.

Regards

On Wed, Oct 28, 2015 at 5:07 PM, Fabrice Laporte notifications@github.com
wrote:

...
Another approach, if you know already all your category/match pairs, is to
write your config file a priori : ...

@flywire
Copy link

flywire commented Oct 30, 2015

Can you confirm the correct way to install the branch and where the python
files should reside compared to my csv files?

PATH=C:\ProgramData\Oracle\Java\javapath;C:\Python27;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program
Files\GDAL;C:\Program Files\Common Files\Seagate\SnapAPI\

csv in F:\gnutest

Regards

On Wed, Oct 28, 2015 at 12:37 PM, flywire flywire0@gmail.com wrote:

On Wed, Oct 28, 2015 at 9:35 AM, Fabrice Laporte <notifications@github.com

wrote:

... @flywire https://github.com/flywire Can you checkout the windows
branch https://github.com/Kraymer/qifqif/tree/windows and tell me how
it works for you? ...

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 30, 2015

Can you confirm the correct way to install the branch

git clone https://github.com/Kraymer/qifqif/
cd qifqif
git checkout windows
python setup.py install

then

qifqif YOUR_FILE.qif

or qifqif -h to display help

where you're cloning the branch on your hard drive is irrelevant. I don't know what csv files you're talking about.

@flywire
Copy link

flywire commented Oct 30, 2015

I meant qif not csv.

qifqif is not running for me yet.

F:\Max>git clone https://github.com/Kraymer/qifqif/

'git' is not recognized as an internal or external command,
operable program or batch file.

I uninstalled qifqif, navigated to
https://github.com/Kraymer/qifqif/tree/windows, downloaded zip, unzipped,
pip install qifqif

When I type 'qifqif' a notepad++ session starts with qifqif.py. I have
notepad++ as the default application to open .py files.


I tried again:


    F:\Max\qifqif-windows>pip install qifqif
    Collecting qifqif
      Using cached qifqif-0.4.1.tar.gz
    Requirement already satisfied (use --upgrade to upgrade): blessed in
    c:\python27
    \lib\site-packages (from qifqif)
    Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in
    c:\pytho
    n27\lib\site-packages (from blessed->qifqif)
    Requirement already satisfied (use --upgrade to upgrade): wcwidth>=0.1.4 in
    c:\p
    ython27\lib\site-packages (from blessed->qifqif)
    Installing collected packages: qifqif
      Running setup.py install for qifqif
    Successfully installed qifqif-0.4.1    

    F:\Max\qifqif-windows>cd ..    

    F:\Max>qifqif
    Traceback (most recent call last):
      File "C:\Python27\Scripts\qifqif-script.py", line 9, in <module>
        load_entry_point('qifqif==0.4.1', 'console_scripts', 'qifqif')()
      File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 552,
    in l
    oad_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line
    2672, in
    load_entry_point
        return ep.load()
      File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line
    2345, in
    load
        return self.resolve()
      File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line
    2351, in
    resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "C:\Python27\lib\site-packages\qifqif\__init__.py", line 18, in
    <module>
        from blessed import Terminal
      File "C:\Python27\lib\site-packages\blessed\__init__.py", line 10, in
    <module>    

        from blessed.terminal import Terminal
      File "C:\Python27\lib\site-packages\blessed\terminal.py", line 8, in
    <module>
        import curses
      File "C:\Python27\lib\curses\__init__.py", line 15, in <module>
        from _curses import *
    ImportError: No module named _curses    

    F:\Max>


Regards


On Sat, Oct 31, 2015 at 12:10 AM, Fabrice Laporte <notifications@github.com>
wrote:

> Can you confirm the correct way to install the branch
>
> git clone https://github.com/Kraymer/qifqif/
> cd qifqif
> git checkout windows
> python setup.py install
>
> then
>
> qifqif YOUR_FILE.qifqif
>
> or qifqif -h to display help
>
> where you're cloning the branch on your hard drive is irrelevant. I don't
> know what csv files you're talking about.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Kraymer/qifqif/issues/32#issuecomment-152519580>.
>

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 30, 2015

It's normal that you have this _curses related error since you're trying to install the official release when you do pip install qifqif

I uninstalled qifqif, navigated to
https://github.com/Kraymer/qifqif/tree/windows, downloaded zip, unzipped,
pip install qifqif

Retry that but do a python setup.py install at the end instead of pip install qifqif

@flywire
Copy link

flywire commented Oct 30, 2015

F:\Max\qifqif-windows>python setup.py install
Traceback (most recent call last):
File "setup.py", line 71, in
with open(version_py, 'r') as fh:
IOError: [Errno 2] No such file or directory: 'version.py'

On Sat, Oct 31, 2015 at 10:27 AM, Fabrice Laporte notifications@github.com
wrote:

...

I uninstalled qifqif, navigated to
https://github.com/Kraymer/qifqif/tree/windows, downloaded zip, unzipped,
pip install qifqif

Retry that but do a python setup.py install at the end instead of pip
install qifqif


Reply to this email directly or view it on GitHub
#32 (comment).

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 30, 2015

oups, sorry for that

git pull origin
python setup.py install

@flywire
Copy link

flywire commented Oct 31, 2015

I copied version.py across manually and 'python setup.py install'

F:\Max>qifqif -h

Traceback (most recent call last):

File "C:\Python27\Scripts\qifqif-script.py", line 9, in

load_entry_point('qifqif==0.4.1', 'console_scripts', 'qifqif')()

File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line

552, in l

oad_entry_point

return get_distribution(dist).load_entry_point(group, name)

File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line

2672, in

load_entry_point

return ep.load()

File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line

2345, in

load

return self.resolve()

File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line

2351, in

resolve

module = __import__(self.module_name, fromlist=['__name__'], level=0)

File "build\bdist.win32\egg\qifqif__init__.py", line 24, in

File "build\bdist.win32\egg\qifqif\ui.py", line 9, in

ImportError: No module named readline

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 31, 2015

When you have this message in python it means you must install the module

=> pip install readline

@flywire
Copy link

flywire commented Oct 31, 2015

F:\Max>pip install readline
Collecting readline
Downloading readline-6.2.4.1.tar.gz (2.3MB)
100% |################################| 2.3MB 136kB/s
Complete output from command python setup.py egg_info:
error: this module is not meant to work on Windows

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in
c:\users\fearle~1
\appdata\local\temp\pip-build-euh9qs\readline

@Kraymer
Copy link
Owner Author

Kraymer commented Oct 31, 2015

Pip install pyreadline

should make it. Sorry for the hassle

@Kraymer Kraymer closed this as completed Nov 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants