python g.V('test_red1').valueMap().toList()
works fine but when I pass true to request ids and labels I get this error. Anything I am missing?
g.V('test_red1').valueMap(True).toList()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/environment/merchantGraph/gremlin_python/process/traversal.py", line 52, in toList
return list(iter(self))
File "/home/ec2-user/environment/merchantGraph/gremlin_python/process/traversal.py", line 43, in __next__
...
Am I missing something. I am using AWS Neptune ...
I am adding extra import statements
and traceback
import time
import requests
import json
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import boto3
from os import environ
graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection(environ['gremlinNeptuneConnection'],'g'))
# this works
g.V('test_red1').valueMap().toList()
# this fails
g.V('test_red1').valueMap(True).toList()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/environment/merchantGraph/gremlin_python/process/traversal.py", line 52, in toList
return list(iter(self))
....
File "/home/ec2-user/environment/merchantGraph/gremlin_python/structure/io/graphsonV3d0.py", line 455, in objectify
new_dict[reader.toObject(l[x])] = reader.toObject(l[x + 1])
TypeError: unhashable type: 'dict'
My guess is that you are running into trouble with this recently reported bug with valueMap(true):
https://issues.apache.org/jira/browse/TINKERPOP-1860
it is patched and will be fixed with release of 3.3.2. Until then you will have to work around the issue as there really is no fix short of reverting to GraphSON 2.0 (which comes with it's own set of downsides). One workaround would be to project() your results:
gremlin> g.V().project('props','id','label').
......1> by(valueMap()).
......2> by(id).
......3> by(label)
==>[props:[name:[marko],age:[29]],id:1,label:person]
==>[props:[name:[vadas],age:[27]],id:2,label:person]
==>[props:[name:[lop],lang:[java]],id:3,label:software]
==>[props:[name:[josh],age:[32]],id:4,label:person]
==>[props:[name:[ripple],lang:[java]],id:5,label:software]
==>[props:[name:[peter],age:[35]],id:6,label:person]
Related
I'm trying to build my application, after installing flask_login0.4.1 and configuring it
i come across this error
Traceback (most recent call last):
File "C:\Users\Catalyst\Desktop\Python\chatAp\application.py", line 2, in <module>
from wtform_fields import *
File "C:\Users\Catalyst\Desktop\Python\chatAp\wtform_fields.py", line 6, in <module>
from models import User
File "C:\Users\Catalyst\Desktop\Python\chatAp\models.py", line 2, in <module>
from flask_login import UserMixin
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\__init__.py", line 16, in <module>
from .login_manager import LoginManager
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\login_manager.py", line 24, in <module>
from .utils import (_get_user, login_url as make_login_url, _create_identifier,
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\utils.py", line 13, in <module>
from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\werkzeug\security.py)
based on answers on stackoverflow I have downgraded werkzeug to 2.0.0 but i got other error
Traceback (most recent call last):
File "C:\Users\Catalyst\Desktop\Python\chatAp\application.py", line 1, in <module>
from flask import Flask, render_template,redirect,url_for
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\__init__.py", line 4, in <module>
from . import json as json
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\json\__init__.py", line 8, in <module>
from ..globals import current_app
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\globals.py", line 56, in <module>
app_ctx: "AppContext" = LocalProxy( # type: ignore[assignment]
TypeError: LocalProxy.__init__() got an unexpected keyword argument 'unbound_message'
what other alternatives solutions I can use
I'm using flask 2.2.2
Try
Werkzeug <= 2.1.2
flask == 2.1.2
Both of these have to be compatible. Let me know if you can work it out. the above version worked for me.
Modulo_velas is the websocket loop module
this is the import and what i need to do:
#import
from pip import main
from kucoin_futures.client import Market
from kucoin_futures.client import Trade
from kucoin_futures import Modulo_velas as mvelas
print(mvelas.info_velas)
but this are all errors it gave me
Traceback (most recent call last):
File "c:\Users\javier\AppData\Local\Programs\Python\Python310\Lib\site-packages\kucoin_futures\MyScript2.py", line 5, in <module>
from kucoin_futures import Modulo_velas as mvelas
File "C:\Users\javier\AppData\Local\Programs\Python\Python310\lib\site-packages\kucoin_futures\Modulo_velas.py", line 71, in <module>
asyncio.run(main())
File "C:\Users\javier\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 37, in run
raise ValueError("a coroutine was expected, got {!r}".format(main))
ValueError: a coroutine was expected, got None
PS C:\Users\javier\AppData\Local\Programs\Python\Python310\Lib\site-packages\kucoin_futures>
I have a directory tree as follows:
main.py
dir1
sub1.py
sub2.py
In main.py:
import dir1.sub1
In dir1/sub1.py:
def f1() -> None:
print("f1")
import dir1.sub2
dir1.sub2.f2()
In dir1/sub2.py:
import dir1.sub1
def f2() -> None:
dir1.sub1.f1()
print("f2")
When I run main.py, I get the following error message:
Traceback (most recent call last):
File "...\main.py", line 1, in <module>
import dir1.sub1
File "...\dir1\sub1.py", line 7, in <module>
dir1.sub2.f2()
File "...\dir1\sub2.py", line 5, in f2
dir1.sub1.f1()
AttributeError: module 'dir1' has no attribute 'sub1'. Did you mean: 'sub2'?
(Where the ... at the beginning of the file path is my working directory.)
If I change main.py to
import dir1.sub2
I get a slightly different error message:
Traceback (most recent call last):
File "...\main.py", line 1, in <module>
import dir1.sub2
File "...\dir1\sub2.py", line 1, in <module>
import dir1.sub1
File "...\dir1\sub1.py", line 7, in <module>
dir1.sub2.f2()
AttributeError: module 'dir1' has no attribute 'sub2'
If I move sub1.py and sub2.py to the same directory as main.py and re‐direct imports as necessary, I get the expected output of
f1
f2
Why does this happen, and how can I make it not happen?
You need to use absolute import because Python 3 only supports that. In Python 2 your method will work. So for example if you have import dir1.sub2 change it to from dir1 import sub2. See here.
Note: I've tested it with your setup and it works.
I have an error when running the following in python
Runtime error
Traceback (most recent call last):
File "", line 6, in
File "C:\Python27\ArcGIS10.3\Lib\rpy2\robjects__init__.py", line 55, in
conversion.ri2py = default_ri2py
NameError: name 'conversion' is not defined
this is my script init.py
import rpy2.rinterface as rinterface
import rpy2.rlike.container as rlc
import rpy2.robjects.conversion
conversion.ri2py = default_ri2py
Variable simply not defined. Use the snippet below to define it.
import rpy2.robjects as robjects
robjects.conversion.ri2py = default_ri2py
http://rpy.sourceforge.net/rpy2/doc-2.1/html/robjects_convert.html
System : XP, work with python 2.7
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import json
File "C:\Python27\ArcGIS10.1\lib\json\__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7, in <module>
from json import scanner
ImportError: cannot import name scanner
Anyone can explain me how to manage this error please ???
this morning I haven't got this problem, but this afternoon my script won't work ((
I think this is caused by relative import path,
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7,
from json import scanner
it's trying to import scanner from
C:\Python27\ArcGIS10.1\lib\json