I have a copier which has 4 tray (casette) at least.
For example, QPrinterInfo.availablePrinterNames() returns the names of copiers.
Like this, is there a way for getting the imformation of paper tray?
I can see this imformation with QPrintDialog, it seemes the copier offers this gui but Qt doesn't.
(translation)
default(auto)
auto,
tray1,
tray2,
tray3,
tray4,
LCT,
manual feed
I found out QPrinter.supportedPaperSources().
The result is as follows:
PySide6.QtPrintSupport.QPrinter.PaperSource.Auto
PySide6.QtPrintSupport.QPrinter.PaperSource(257)
PySide6.QtPrintSupport.QPrinter.PaperSource(258)
PySide6.QtPrintSupport.QPrinter.PaperSource(259)
PySide6.QtPrintSupport.QPrinter.PaperSource(260)
PySide6.QtPrintSupport.QPrinter.PaperSource(1000)
PySide6.QtPrintSupport.QPrinter.PaperSource.Manual
Probably 1000 is LCT. 257, 258, 259, 260 are tray1, tray2, tray3, tray4.
There doesn't seem to be enough explanation of what is 1000, 257, 258, 259, 260...
Related
I'm trying to train AllenNLPs coreference model on a 16GB GPU, using this config file: https://github.com/allenai/allennlp-models/blob/main/training_config/coref/coref_spanbert_large.jsonnet
I created train, test, and dev files using this script: https://github.com/allenai/allennlp/blob/master/scripts/compile_coref_data.sh
I got CUDA out of memory almost instantly, so I tried changing "spans_per_word" and "max_antecedents" to lower values. With spans_per_words set to 0.1 instead of 0.4, I could run a bit longer but not nearly a full epoch. Is a 16GB GPU not enough? Or are there other parameters I could try changing?
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/allennlp/bin/allennlp", line 8, in
sys.exit(run())
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/main.py", line 34, in run
main(prog="allennlp")
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/init.py", line 119, in main
args.func(args)
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/train.py", line 119, in train_model_from_args
file_friendly_logging=args.file_friendly_logging,
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/train.py", line 178, in train_model_from_file
file_friendly_logging=file_friendly_logging,
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/train.py", line 242, in train_model
file_friendly_logging=file_friendly_logging,
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/train.py", line 466, in _train_worker
metrics = train_loop.run()
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/commands/train.py", line 528, in run
return self.trainer.train()
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/training/trainer.py", line 740, in train
metrics, epoch = self._try_train()
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/training/trainer.py", line 772, in _try_train
train_metrics = self._train_epoch(epoch)
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/allennlp/training/trainer.py", line 523, in _train_epoch
loss.backward()
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/torch/tensor.py", line 245, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "/home/ubuntu/anaconda3/envs/allennlp/lib/python3.7/site-packages/torch/autograd/init.py", line 147, in backward
allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag
RuntimeError: CUDA out of memory. Tried to allocate 1.33 GiB (GPU 0; 14.76 GiB total capacity; 11.69 GiB already allocated; 639.75 MiB free; 13.09 GiB reserved in total by PyTorch)
16GB is on the low end for that model.
When this model receives a lot of text, it will split the text into multiple shorter sequences of 512 word pieces each, and run them all at the same time. That way you end up with a lot of sequences in memory at the same time even when the batch size is 1.
Try setting max_sentence to a lower value (default is 110), and see if that works.
I am attempting to zexp import a site from what should have been the same Plone version and addon packages. However, when I do so I get
Module ZPublisher.Publish, line 60, 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
ImportError: No module named MyOldPackage.Content
This is an old Archetypes class that has since been migrated to a replacement in Dexterity. I thought I had removed all references but apparently something got missed. I get that I have to remove all objects that use this class but there's the rub - how do I find which objects use them?
I thought I had found something in the CMFEditions tools but that might be a red herring. Trying to export portal_historiesstorage yields the same error so I thought perhaps some old versions of past content were stuck there. Deleted shadow storage and rebuilt it, so it's now blank (ZMI page confirms this). But I'm still getting the error when trying to import just this tool - how is it still trying to reference this class? This is why I think it might be a red herring and it's inheriting something from the portal object, but I'm having a rough time trying to find where this class is referenced.
edit:
It looks like I have something bad in zvc_repo - I'm not sure the difference in what shadow storage and this are supposed to do. Here's a proposed script. Can anyone with better CMFEditions or ZopeVersionControl comment on how this sounds?
tool = portal.portal_historiesstorage
from ZODB.broken import PersistentBroken
bad_repo_ids = set()
for sequence in tool.zvc_repo._histories:
for version in tool.zvc_repo[sequence]._versions:
obj = tool.zvc_repo[sequence].getVersionById(version)._data._object.object
if isinstance(obj, PersistentBroken):
bad_repo_ids.add(sequence)
for bid in bad_repo_ids:
del tool.zvc_repo._histories[bid]
I have started to see this on old 3.3.x instance:
'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x1153346c>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 163, in _eval
Module Products.PageTemplates.Expressions, line 125, in render
Module Products.Archetypes.ClassGen, line 56, in generatedAccessor
Module wicked.fieldevent, line 29, in render
Module zope.event, line 23, in notify
Module zope.component.event, line 26, in dispatch
Module zope.component._api, line 130, in subscribers
Module zope.component.registry, line 290, in subscribers
Module zope.interface.adapter, line 583, in subscribers
Module wicked.fieldevent, line 16, in notifyFieldEvent
Module zope.component._api, line 101, in getMultiAdapter
Module zope.component._api, line 114, in queryMultiAdapter
Module zope.component.registry, line 206, in queryMultiAdapter
Module zope.interface.adapter, line 530, in queryMultiAdapter
Module wicked.fieldevent.meta, line 78, in field_value
Module Products.Archetypes.Field, line 1394, in get
Module Products.Archetypes.BaseUnit, line 100, in transform
Module Products.PortalTransforms.TransformEngine, line 181, in convertTo
Module Products.PortalTransforms.chain, line 51, in convert
Module Products.PortalTransforms.Transform, line 192, in convert
Module plone.outputfilters.transforms.html_to_plone_outputfilters_html, line 47, in convert
Module plone.outputfilters, line 6, in apply_filters
Module plone.outputfilters.filters.resolveuid_and_caption, line 103, in __call__
Module sgmllib, line 95, in feed
Module sgmllib, line 129, in goahead
Module sgmllib, line 283, in parse_starttag
Module sgmllib, line 314, in finish_starttag
Module plone.outputfilters.filters.resolveuid_and_caption, line 349, in unknown_starttag
TypeError: <lambda>() got an unexpected keyword argument 'quote'
It apparently some kind of compatibility problem with Plone 3.3.x and plone.outputfilters which could be solved with proper pindowns. However I am not sure what components are involved and thus what's Known Good Set to fix this.
I'd like to get a temporary solution for this before getting all sites migrated, as old stuff should not just break down if you leave it unattended :(
Also the latest security fix might be involved.
I too have a few old 3.3.5 sites and just started seeing this error. Pinning plone.outputfilters to version 1.6 seems to fix it so far. I.e., in buildout.cfg
[versions]
...
plone.outputfilters = 1.6
I bet you are using TinyMCE, this pulls p.outputfilters.
As with the Plone-3-series the default editor is Kupu, this changement can be the cause and apparently has been fixed in the Plone-core: https://dev.plone.org/ticket/9938
Quoting David Glick:
"For historical reasons, these transformations are implemented in both kupu and TinyMCE. This has been a maintenance problem, as bugfixes for these features in one of the packages usually don't get ported to the other."
You'll have to apply a patch according to these changements, I suppose.
Also this changement could be relevant as this topic concerns both, the core and the third-party-editor code:
https://github.com/plone/plone.outputfilters/commit/e5067c8ef1894d1017d6bc81c5969112676840d5#plone/outputfilters/filters/resolveuid_and_caption.py
Using the current unreleased dev-branch of p.outputfilters (1.9 by time of writing) could help, too.
Recently we noticed that some (published) folders in our Plone 3.3.5 site are no longer visible in the navigation and folder listing views. While trying to set a new effective date (it's set in the past, so that is not the problem) on them i get a KeyError:
Traceback (innermost last):
Module ZPublisher.Publish, line 125, in publish
Module Zope2.App.startup, line 238, in commit
Module transaction._manager, line 96, in commit
Module transaction._transaction, line 389, in commit
Module transaction._transaction, line 445, in _callBeforeCommitHooks
Module collective.indexing.transactions, line 57, in before_commit
Module collective.indexing.queue, line 149, in process
Module collective.indexing.indexer, line 89, in unindex
Module collective.indexing.indexer, line 71, in unindex
Module Products.CMFSquidTool.queue, line 160, in unindexObject
Module Products.CMFSquidTool.patch, line 24, in call
Module Products.Archetypes.CatalogMultiplex, line 49, in unindexObject
Module Products.CMFPlone.CatalogTool, line 445, in uncatalog_object
Module Products.CacheSetup.patch, line 109, in uncatalog_object
Module Products.CacheSetup.patch_utils, line 6, in call
Module Products.ZCatalog.ZCatalog, line 569, in uncatalog_object
Module Products.ZCatalog.Catalog, line 390, in uncatalogObject
Module Products.PluginIndexes.DateRangeIndex.DateRangeIndex, line 192, in unindex_object
Module Products.PluginIndexes.DateRangeIndex.DateRangeIndex, line 391, in _removeForwardIndexEntry
KeyError: -1666126693
In some cases other operations also triggers the same errors.
The parent folder in which this is happening was recently cut and pasted to its current location in the site, maybe that's got something to do with it.
Help much appreciated, thanks !
Try to rebuild the catalog, it can help, it seems there are some orphan objects in the catalog.
I have a handler that adds a Member to a Group. The last line in this handler causes an error:
TypeError: Can't pickle objects in acquisition wrappers.
> /home/mnieber/.buildout/eggs/ZODB3-3.10.3-py2.6-linux-i686.egg/ZODB/serialize.py(431)_dump()
430 self._p.dump(classmeta)
--> 431 self._p.dump(state)
432 self._file.truncate()
In the pdb debugger I can see that indeed Plone is trying to pickle a value that is an Acquisition wrapper:
ipdb> state
((((<PloneUser 'newuser#usecm.com'>, ('Default_Group',), 'maarten#usecm.com', ('PAS',)),),),)
ipdb> type(state[0][0][0][0])
<type 'Acquisition.ImplicitAcquisitionWrapper'>
However, I cannot see which object is being pickled, and therefore I have no idea which part of my code needs fixing. My question is: how should I go about debugging this error? I have tried looking at all the stack frames, but none of them reveal which object is being serialized.
The handler is this one (run_insecure is a decorator that I use to temporarily install a new security manager that avoids a NotAuthorized error when adding the new member):
#adapter(IPrincipalCreatedEvent)
#run_insecure
def userCreatedHandler(event):
portal_groups = getToolByName(getSite(), "portal_groups")
membersGroup = portal_groups.getGroupById('Default_Group')
membersGroup.addMember(event.principal)
The full error is this one:
Traceback (innermost last):
Module ZPublisher.Publish, line 134, in publish
Module Zope2.App.startup, line 301, in commit
Module transaction._manager, line 89, in commit
Module transaction._transaction, line 329, in commit
Module transaction._transaction, line 443, in _commitResources
Module ZODB.Connection, line 567, in commit
Module ZODB.Connection, line 623, in _commit
Module ZODB.Connection, line 658, in _store_objects
Module ZODB.serialize, line 422, in serialize
Module ZODB.serialize, line 431, in _dump
TypeError: Can't pickle objects in acquisition wrappers.
> /home/mnieber/.buildout/eggs/ZODB3-3.10.3-py2.6-linux-i686.egg/ZODB/serialize.py(431)_dump()
430 self._p.dump(classmeta)
--> 431 self._p.dump(state)
432 self._file.truncate()
I got this kind of problem with pickle, and solved by debugging like you did.
Pickle (used to store objects in ZODB) is trying to serialize your PloneUser, and raising this acquisition wrapper error.
In my case, I was wrapping the portal_workflow object into another class, and had to inherit it from pickle.Pickler, and override __getstate__ method to solve my problem.
This method is called by pickle in order to serialize your object. If you override this method, and return your object.__dict__ without this PloneUser, than this error would not be raised.
This question (although with not your exact problem) have more info about what I'm trying to say.
Nice you could solve your problem.