When trying to import some objects from my server (debian) on another machine (mac), I get this error:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module OFS.ObjectManager, line 620, in manage_importObject
Module OFS.ObjectManager, line 638, in _importObjectFromFile
Module ZODB.ExportImport, line 92, in importFile
Module transaction._transaction, line 260, in savepoint
Module transaction._transaction, line 257, in savepoint
Module transaction._transaction, line 690, in __init__
Module ZODB.Connection, line 1123, in savepoint
Module ZODB.Connection, line 587, in _commit
Module ZODB.ExportImport, line 176, in _importDuringCommit
AttributeError: 'module' object has no attribute '_dt_reconstructor'
The Zope and Python versions are exactly the same (Zope 2.13.19 and Python 2.7.3) on both machines. Re-importing on the same machine works fine.
I tracked down the object causing the problem, it is an instance of one of my custom classes. My problem is that I don't know where to look to fix the error.
One of the base classes of this class uses DateTime, but that does not cause any problems with the other classes that inherit from this base class.
Check your DateTime egg versions.
DateTime 2.12.7 added the function _dt_reconstructor, and you'll need to use at least that release in the 2.12.x series, or use version 3.0.1 or newer in the 3.0.x series to be able to unpickle DateTime instances again.
The 3.0.x series uses a much more efficient internal structure, leading to significant memory savings. However, 3.0.x DateTime code can read 2.x series pickles, but once you move to 3.x you cannot go back to 2.x as the format is not backwards compatible.
Related
I'm new to using gdal/libspatialite/rasterio/sumo and all the family of library and packages that is related to geographical, time and space. But I was just wondering what's this error here? Does anyone have experience with this error before? Have you seen it before? And if so have you been able to resolve it? And if so, what were the things you did to resolve it. I'm stuck with this for almost days now and idk what else to do. I'm running this on Python 3.9.6 on a MacOS Big Sur. I'm confused whether the problem is either one of these packages (or a combination of).
It's really annoying how it doesn't work here but works perfectly fine in my old computer that runs in MacOS Catalina with Python 3.9.0. Thank you in advance for your time.
File "/opt/homebrew/lib/python3.9/site-packages/contextily/__init__.py", line 7, in <module>
from .place import Place, plot_map
File "/opt/homebrew/lib/python3.9/site-packages/contextily/place.py", line 7, in <module>
from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom
File "/opt/homebrew/lib/python3.9/site-packages/contextily/tile.py", line 16, in <module>
import rasterio as rio
File "/opt/homebrew/lib/python3.9/site-packages/rasterio/__init__.py", line 9, in <module>
from rasterio._base import gdal_version
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/rasterio/_base.cpython-39-darwin.so, 2): Symbol not found: _GEOSArea
Referenced from: /opt/homebrew/opt/libspatialite/lib/libspatialite.7.dylib
Expected in: flat namespace
I am new to programming on python and i am trying to create an application which uses pyMTP to communicate to an MTP device. However im getting this error and cant figure out the fix for it.
$ python c:/Users/Atul/Desktop/mtp.py
None
Traceback (most recent call last):
File "c:/Users/Atul/Desktop/mtp.py", line 2, in <module>
import pymtp
File "C:\Users\Atul\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymtp.py", line 42, in <module>
_libmtp = ctypes.CDLL(_module_path)
File "C:\Users\Atul\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
Think it is not a program, but a library, you have to import. Like once in python, import mtp (or import pymtp, i don't know anymore). Please be aware pymtp is about 5 years old and does only run on python 2. I have been working on a python 3 version but it's not really complete because i found testing MTP software is extremely time consuming because the mtp interface is very, very slow at startup. I suggest to look at gMTP to transfer you files.
Using rest API, I am connecting Redmine with Python Script and Populating the data in the ODOO.
In Redmine assigned_to value in issue is empty i.e NULL, while Reading those value.
Traceback (most recent call last):
File "/home/vignesh/PycharmProjects/vignesh/vigred.py", line 23, in <module>
redmine_asssigned_to = id.assigned_to
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 424, in __getattr__
return super(Issue, self).__getattr__(item)
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 193, in __getattr__
return self._action_if_attribute_absent()
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 294, in _action_if_attribute_absent
raise ResourceAttrError
redmine.exceptions.ResourceAttrError: Resource doesn't have the requested attribute
Short answer: Use getattr(id, 'assigned_to', None) instead of id.assigned_to.
Long answer: Python-Redmine raises ResourceAttrError if you're trying to access an attribute that doesn't exist. The problem here is that assigned_to may or may not exist on the resource object depending on if it is set in Redmine or not, also Python-Redmine doesn't hardcode any attributes inside itself, i.e. it gets them dynamically from Redmine, that is why you have this problem.
I'm trying to call on a custom python script within another script. Everything works fine if I run the script standalone outside of ArcGIS, but if I try to make it a custom tool with parameters, it gives me the following error:
Traceback (most recent call last):
File "C:\Users\jamil.harvich\Documents\ArcGIS\Python_Scripts\Working\IP_Anno\Script\Script_Part1.py", line 80, in <module>
arcpy.ConcatenateRowValues_AA(lyr[0] + '_Intersect', 'SHORT_DESC', 'NAME', lyr[2], '-')
File "C:\Users\jamil.harvich\Documents\ArcGIS\Python_Scripts\Working\IP_Anno\ConcatenateRowValues101.tbx", line 54, in ConcatenateRowValues
/jVXV+BHwwJ5+Gfgv/wnbP8A+NV2Eo+ZTjHPQ9qlR60cIvojBSkupxw+Avwvz/yTTwX/AOE7Z/8A
AttributeError: Object: Tool or environment <ConcatenateRowValues_AA> not found
Failed to execute (Script).
Thanks. I hope the question is clear. If you need me to specify anything, just ask.
Before calling it, in your script you should import the Toolbox that contains your tool "ConcatenateRowValues_AA", with the command:
arcpy.ImportToolbox(TOOLBOX_PATH)
where TOOLBOX_PATH is the absolute path to your .tbx file.
When I assign a new sharing permission level to any user,
I get this error
It seems that any folder or user produces this error. There are some users with sharing permissions already, which means this used to work before. I'm not sure what happened from then until now that changed this.
Have any of you encountered this problem before?
Error log :
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 14, in folder_localrole_edit
- <FSPythonScript at /intranet/folder_localrole_edit used for /intranet/service-areas/management-services>
- Line 14
Module <string>, line 4, in _facade
Module Products.Hotfix_20070320, line 68, in _curried
Module Products.CMFCore.MembershipTool, line 437, in setLocalRoles
Module Products.Archetypes.CatalogMultiplex, line 70, in reindexObjectSecurity
Module Products.ZCatalog.CatalogBrains, line 52, in _unrestrictedGetObject
Module OFS.Traversable, line 187, in unrestrictedTraverse
- __traceback_info__: (['mailer', 'formfolder.2009-03-22.3253705634', 'FormFolder', 'portal_factory'], 'one-melville-brand-update-2009-1')
Module Products.Five.traversable, line 126, in __bobo_traverse__
AttributeError: one-melville-brand-update-2009-1
It seems like your portal_catalog tool is inconsistent.
This means you have catalog entries (brain), with no real content (Archetype object).
You can solve this by "Clear and Rebuild" your catalog.
http://localhost:8080/${PATH_TO_PLONE}/portal_catalog/manage_catalogAdvanced -> Clear and rebuilt.
This action can take long time, depending on how many content you have.
Short explanation what seems to happen in your case:
After changing the local roles on a specific object, Plone tries to reindex the security relevant portal catalog indexes on the object itself and on all subobjects. While reindexing the subcontent it tries to get some data of a inexistent object (AttributeError while traversal).
With a fresh catalog you can avoid such errors.