Giter VIP home page Giter VIP logo

Comments (8)

danodonovan avatar danodonovan commented on August 12, 2024 3

@victoriastuart I believe this PR #60 should correct that issue (it uses io to safely handle the file opening for python 2 and 3).

from cycli.

nicolewhite avatar nicolewhite commented on August 12, 2024

Hmm what OS are you on?

from cycli.

rajfal avatar rajfal commented on August 12, 2024

Hi Nicole,
I have enjoyed the cypher side of Cycli

However, I am experiencing exactly the same problem as above but with both -f and --filename flags
Can't get cypher queries processed from a file
My OS is Ubuntu 5.4.0-6ubuntu1~16.04.5

TypeError: a bytes-like object is required, not 'str'

THank you for your help

from cycli.

nicolewhite avatar nicolewhite commented on August 12, 2024

What version of Python are you on?

from cycli.

rajfal avatar rajfal commented on August 12, 2024

Python 3.6.0 :: Anaconda 4.3.0 (64-bit)

from cycli.

victoriastuart avatar victoriastuart commented on August 12, 2024

Arch Linux x86_64; Python 2.7; Python 3.5; Cycli 0.7.6

I also just encountered this issue with Cycli v.0.7.6 (pip install ...) operating in a Python 3.5 venv.

`TypeError: a bytes-like object is required, not 'str'`
(py35) [victoria@victoria ~]$ cycli -P 7474 -u victoria -p <my_password> -f glycolysis2.cypher

Traceback (most recent call last):
  File "/home/victoria/anaconda2/envs/py35/bin/cycli", line 11, in <module>
    sys.exit(run())
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/cycli/main.py", line 284, in run
    cycli.run()
  File "/home/victoria/anaconda2/envs/py35/lib/python3.5/site-packages/cycli/main.py", line 72, in run
    queries = queries.split(";")[:-1]

TypeError: a bytes-like object is required, not 'str'

(py35) [victoria@victoria ~]$

from cycli.

victoriastuart avatar victoriastuart commented on August 12, 2024

@nicolewhite, @danodonovan: this is great, thank you!!

For referencing this issue, here is how I updated my Cycli install (git clone this repo | make | make install | pip uninstall / install cycli | test execute cypher file):

[victoria@victoria apps]$ pwd
    /mnt/Vancouver/apps

[victoria@victoria apps]$ git clone https://github.com/nicolewhite/cycli

[victoria@victoria apps]$ cd cycli

## Update repo, after Nicole's 2018-04-05 merge commit
## https://github.com/nicolewhite/cycli/pull/60

[victoria@victoria cycli]$ git pull
    ...

[victoria@victoria cycli]$ p3                                                                                                              
    [Anaconda Python 3.5 venv (source activate py35)]

[victoria@victoria cycli]$ p3
    [Anaconda Python 3.5 venv (source activate py35)]

(py35) [victoria@victoria cycli]$ pwd
  /mnt/Vancouver/apps/cycli

(py35) [victoria@victoria cycli]$ pip uninstall cycli
    Uninstalling cycli-0.7.6:
    ...

(py35) [victoria@victoria cycli]$ make
    ...

(py35) [victoria@victoria cycli]$ py.test tests
    ...
    ================= 82 passed in 0.33 seconds ================================

(py35) [victoria@victoria cycli]$ make clean
    rm -rf build dist cycli.egg-info

(py35) [victoria@victoria cycli]$ pip install cycli
    ...

(py35) [victoria@victoria cycli]$ cycli -P 7474 -u victoria -p <password_obfuscated_here>
 ______     __  __     ______     __         __    
/\  ___\   /\ \_\ \   /\  ___\   /\ \       /\ \   
\ \ \____  \ \____ \  \ \ \____  \ \ \____  \ \ \  
 \ \_____\  \/\_____\  \ \_____\  \ \_____\  \ \_\ 
  \/_____/   \/_____/   \/_____/   \/_____/   \/_/ 
Cycli version: 0.7.6
Neo4j version: 3.3.4
Bug reports: https://github.com/nicolewhite/cycli/issues

> quit
Goodbye!

(py35) [victoria@victoria cycli]$ cycli -P 7474 -u victoria -p <password_obfuscated_here> -f /mnt/Vancouver/Programming/data/metabolism/glycolysis.cypher

> LOAD CSV WITH HEADERS FROM "file:/mnt/Vancouver/Programming/data/metabolism/pg2neo4j/glycolysis_bioentities.csv" AS row
MERGE (n:Glycolysis {name:row.name})
  // RETURN n, labels(n), n.name;
270 ms
...

(py35) [victoria@victoria cycli]$

from cycli.

fraewn avatar fraewn commented on August 12, 2024

Hi there, I'm still having the same issue under windows with neo4j 3.5.5. did neither work with -f nor with --filename. i was trying to open a cyp file
Also btw needed to change/add an encoding after this error occured to get the program to work at all: SyntaxError: Non-UTF-8 code starting with '\xfc' in file cycli-script.py (after entering "cycli -u ")
great program tho! thx

from cycli.

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.