This happens while replacing temp view using below code block
latest_data.createOrReplaceGlobalTempView("e_test")
ideally this command should replace the view if e_test already exists instead it is throwing
"Recursive view `global_temp`.`e_test` detected (cycle: `global_temp`.`e_test` -> `global_temp`.`e_test`)" error..
Can someone help me with this
codeblock
It works with 3.0.1 but looks like the latest version has a bug
Related
Here You can see a Colab code. I basically try to run those codes but I get this error.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-16-1b48c937269f> in <module>()
----> 1 macrodemos.ARMA()
3 frames
/usr/local/lib/python3.7/dist-packages/dash/_utils.py in __setitem__(self, key, val)
156
157 # pylint: disable=inconsistent-return-statements
--> 158 def first(self, *names):
159 for name in names:
160 value = self.get(name)
AttributeError: ('Read-only: can only be set in the Dash constructor or during init_app()', 'requests_pathname_prefix')
I have no idea about this actually and I am not an expert. Could you please explain the problem? and a solution if you have any. Thanks
It appears there is some issue with the latest version of the package.
Using the following version of the packages appears to work well.
Notebook with changes, for your convenience:
https://colab.research.google.com/drive/1WyPr2p2nXmrNhjqJXl7hKaHtOocP731S?usp=sharing
Explanation:
While installing the packages, simple use:
!pip install macrodemos --upgrade
!pip install -q dash==1.19.0
This will replace the version of dash used to an older one that works, Here is a screenshot for your reference:
Screenshot 1
I am a newbie and I appreciate your feedback about whether this is helpful or not.
Thanks in advance. :)
I was able to fix this error by following the recommendations in the error message pasted here for reference,
AttributeError: ('Read-only: can only be set in the Dash constructor or during init_app()', 'requests_pathname_prefix')
The solution is to only set the Dash config when you first initialize the app application instead of using app.config.update according to the new version of Dash.
So instead of something like this which is trying to update a read-only variable,
app.config.update({
'requests_pathname_prefix': '/dash/' # wrong, will cause read-only error
})
You could do,
app = dash.Dash(
:
requests_pathname_prefix='/dash/')
Which sets those variables when it originally was defined so there will be no read-only error.
This answer might not fully address the original poster's concerns because after looking at the Colab notebook, the library of concern is macrodemos which needs to be updated to be compatible with the newest version of Dash.
I have an issue in executing the Calculate field command in Python (ArcPy). I couldn't find any related resources or helpful descriptions regarding this. I hope somebody could help me with this.
inFeatures = r"H:\Python Projects\PycharmProjects\ArcPy\Test_Output\Trial_out.gdb\Trail_Data_A.shp"
arcpy.CalculateField_management(inFeatures, 'ObjArt_Ken', '!AttArt_Ken!'.split('_')[0])
arcpy.CalculateField_management(inFeatures, 'Wert', '!AttArt_Ken!'.split('_')[-1])
The error i am getting when I run the command is
arcgisscripting.ExecuteError: Error during execution. Parameters are invalid.
ERROR 000989: The CalculateField tool cannot use VB expressions for services.
Error while executing (CalculateField).
I am using ArcGIS Pro 2.8 and Python 2.7
I found a working output for the above mentioned question
inTable = r'H:\Python Projects\PycharmProjects\ArcPy\Test_Output\Trial_out.gdb\Trail_Data_A.shp'
func_1 = "'!AttArt_Ken!'.split('_')[0]"
field_1 = "ObjArt_Ken"
func_2 = "'!AttArt_Ken!'.split('_')[1]"
field_2 = "Wert"
arcpy.AddField_management(inTable, field_1, "TEXT".encode('utf-8'))
arcpy.CalculateField_management(inTable, field_1, func_1, "PYTHON_9.3")
arcpy.AddField_management(inTable, field_2, "TEXT".encode('utf-8'))
arcpy.CalculateField_management(inTable, field_2, func_2, "PYTHON_9.3")
But a problem still exists such that the output (After split function) is like
|ObjArt_Ken|Wert|
|:---|:---|
|u"31001|1001"|
I still couldn't figure out a way to remove the unicode or the '"' symbol from the desired output
Since I can't comment yet, I will have to use an Answer to make several comments
You need to clarify, "I am using ArcGIS Pro 2.8 and Python 2.7." ArcGIS Pro has always come bundled with Python 3.x, and ArcGIS Desktop/ArcMap has always been bundled with Python 2.x. It is not possible to use ArcGIS Pro and Python 2.7. Given the error message, it appears you are running some version of ArcMap and Python 2.7.
The original error message, as you seemed to have figured out, was telling you exactly what wasn't working originally. Since you didn't pass expression_type to Calculate Field and you are using some version of ArcMap that defaults to VB, the function was interpreting your expression as VB code and erring because "CalculateField tool cannot use VB expressions for services."
Looking at the newer code, I am not sure why you are encoding field_type. Although I tested it and it works, it is unnecessary and confusing to someone looking at the code.
Unless you provide some samples of what the AttArt_Ken field contains, people can't really comment on the output you are seeing.
I am a Python newbie currently looking into Crash Course Ai #5 How to Make an AI read your handwriting (LAB).
Running Step 1.2 gives me *NameError: name 'extract_training_samples' is not defined.
Tried so far: 1) updated pip version to 20.0.2 and installed emnist python package
2) tried an additional line of code: from emnist import extract_training_samples but got a ModuleNotFound error.
Feedback appreciated!
OK, very simple solution!
You just forgot the "s".
I find myself running into that problem all the time when coding. Whenever I run into a Name Error, the first thing I do is check my spelling!
your code:
x, y = extract_training_sample('letters')
the code on the website:
extract_training_samples('letters')
Cheers,
I am using TableauServerClient to update the owner of a report on Tableau server. Here is my simple code:
Try:
single_workbook = server.workbooks.get_by_id(workbook_id) #default ownerid of fsg_tableaureporting
single_workbook.owner_id = ownerid
if (server.workbooks.update(single_workbook)):
print('Workbook owner has been updated successfully')
else:
print('Workbook owner could not be updated. Please try again. Exiting..')
except Exception as e:
print('Exceptions occured while changing the owner.')
print(e)
I get the exception at the statement server.workbooks.update(single_workbook).
Anyone have any suggestions?
Python: 3.7.3
TSC: 0.8.1
Tableau server: 2019.1.3 (20191.19.0417.1429) 64-bit Windows
I just encountered the same issue. Looking at logs (C:\Tableau Server\data\tabsvc\logs\vizportal\vizportal-0.log for Windows), I see the error:
Caused by: com.sun.istack.internal.SAXParseException2; lineNumber: 1; columnNumber: 238; unexpected element (uri:"", local:"dataAccelerationConfig"). Expected elements are <{}owner>,<{}site>,<{}project>,<{}connections>,<{}connectionCredentials>,<{}views>,<{}tags>
The error specifically happens at generating the XML here:
https://github.com/tableau/server-client-python/blob/188be71e0fbe9d87ac36628af21d2f63af32d020/tableauserverclient/server/endpoint/workbooks_endpoint.py#L103
Upon checking whats happening in that request, I see its adding a section in xml for data_acceleration_config which I think is a new feature starting in very recent versions, 2019.4 maybe:
https://github.com/tableau/server-client-python/blob/188be71e0fbe9d87ac36628af21d2f63af32d020/tableauserverclient/server/request_factory.py#L485
Unfortunately the API doesnt handle this properly, yet! I am trying to tweak my code to not generate that xml element; will update again if I get to a solution.
I'm using tableauserverclient version 0.12 and have face the similar issues; However when I downgrade to version 0.10, I didn't encounter this issue when update workbook project.
I am trying in the absolute simplest way I can think of to create a node in my neo4j database using py2neo. Here is an example:
from py2neo import Graph, Node
db = Graph()
node = Node('band', name='The Yeah Yeah Yeahs')
db.create(node)
With this (and every variation thereof), I get the following error:
neo4j.exceptions.CypherSyntaxError: Variable `$x` not defined (line 1, column 8 (offset: 7))
"UNWIND $x AS data CREATE (_:band) SET _ = data RETURN id(_)"
I've tried every permutation of this that I can think of and I still can't see anything in my code that might be causing a syntax error. This appears to be some kind of internal mechanism for generating a cypher query in order to create the node, but even with the complete stack trace I haven't been able to track down where this error might be coming from or what might be causing it.
I am using a virtual environment that uses Python 3.7.2 and py2neo 4.1.3.
Any thoughts or insights would be hugely appreciated. Thanks very much in advance.
Which version of Neo4j are you using? The $x replaced the older {x} syntax and the error message implies that $x isn't recognised. If this isn't a recent version, please try upgrading your database and try again.