Giter Club home page Giter Club logo

Comments (10)

yadayada avatar yadayada commented on August 19, 2024

Which operating system are you using? I suspected you were using Windows and tested the script in a Win 8.1 VM, but I didn't encounter this error.

Can you please open your terminal or command line, open a python3 interpreter and type in

import sys
sys.getdefaultencoding()

and tell me what the output is?

You may also try replacing the above mentioned line with
print(u'\n'.join(tree))

from acd_cli.

jurecotic avatar jurecotic commented on August 19, 2024

The defaultencoding gives me utf-8. I'v tried this on 2 Ubuntu 14.04s and it happens on both. And I've also changed the line with the one you suggested, but no difference.

I've also tried on OSX, which gives me a different error (this one happens when running sync command):

Traceback (most recent call last):
  File "./acd_cli.py", line 216, in <module>
    main()
  File "./acd_cli.py", line 110, in main
    sync_node_list()
  File "./acd_cli.py", line 28, in sync_node_list
    sync.insert_files(files)
  File "/Users/jure/acd_cli/cache/sync.py", line 107, in insert_files
    for db_file in db.session.query(db.File):
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2440, in __iter__
    self.session._autoflush()
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 1264, in _autoflush
    self.flush()
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 1985, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2103, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 182, in reraise
    raise value
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2067, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute
    rec.execute(self)
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 526, in execute
    uow
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 46, in save_obj
    uowtransaction)
  File "/usr/local/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 171, in _organize_states_for_save
    state_str(existing)))
sqlalchemy.orm.exc.FlushError: New instance <File at 0x110eba358> with identity key (<class 'cache.db.Node'>, ('NklHY0bAT2-w3I98bgMYXg',)) conflicts with persistent instance <File at 0x110ebae48>

This one updates the folders, but not the files.

I didn't try on windows yet, I can do it tomorrow.

from acd_cli.

yadayada avatar yadayada commented on August 19, 2024

I will try to reproduce the error on Ubuntu 14.04 later.

The syncing problem when updating nodes might be gone with the new version that I just pushed. If not, you can use the clear-cache action to fully clear the cache prior to syncing to eliminate this.

from acd_cli.

jurecotic avatar jurecotic commented on August 19, 2024

Ok, I can confirm, that the error is fixed on OSX, but it still happens on Ubuntu.

from acd_cli.

yadayada avatar yadayada commented on August 19, 2024

Unfortunately, I was not able to reproduce this behaviour with an Ubuntu 14.04 live CD.

Could you please replace the tree_action method in acd_cli.py, run it again and post the log

def tree_action(args):
    import traceback
    tree = selection.node_list(trash=args.include_trash)
    for node in tree:
        try:
            print(node)
        except UnicodeError:
            print(traceback.format_exc())

You might additionally want to have a look at the output of
python3 -c "import json; from acd import oauth, metadata; oauth.get_data(); from pprint import pprint; pprint(metadata.get_node_list())" | grep name

and
echo "from cache import db\nnodes = db.session.query(db.Node).all()\nfor node in nodes:\n print(node)" | python3

and maybe also inspect the node names in the sqlite file nodes.db with sqlitebrowser.

from acd_cli.

jurecotic avatar jurecotic commented on August 19, 2024

Yeah, I was starting to suspect this. The errors occur in folders which have the following letters in the filename: ČŠŽčšž

Other than that, it works fine now.

from acd_cli.

jurecotic avatar jurecotic commented on August 19, 2024

Different problem on raspberrypi (latest Raspbian). When I do the Oauth stuff and paste the url I got from Amazon I get this:

Traceback (most recent call last):
  File "./acd_cli.py", line 416, in <module>
    main()
  File "./acd_cli.py", line 393, in main
    oauth.get_data()
  File "/home/ssitcm/acd_cli/acd/oauth.py", line 71, in get_data
    conn_data['token'] = authenticate()
  File "/home/ssitcm/acd_cli/acd/oauth.py", line 102, in authenticate
    r = response.json()
TypeError: 'dict' object is not callable

Really sorry for all my problems that I'm bugging you with (I'm a QA :)) and thanks for all the great work!

from acd_cli.

yadayada avatar yadayada commented on August 19, 2024

It seems your python-3 requests is outdated on your Raspberry Pi. Try to update to a newer version using pip (should be pip-3.2 on Raspbian). The requests library is used for virtually all Amazon API calls.

PS: There is nothing wrong with posting bug reports; but please open another issue next time, because this is not related to the Unicode problem.

from acd_cli.

grostim avatar grostim commented on August 19, 2024

Thanks yadada : I had the same issue (python3-requests outdated on wheezy).
A pip update solved the problem.

from acd_cli.

sasotepina avatar sasotepina commented on August 19, 2024

I get the same error on some machines. Not on all. (Only tried winXP and win7)

adding:

import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

to acd_cli.py solved the problem for me.

from acd_cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.