Open wanghaisheng opened 11 months ago
@ronny-rentner
new=UltraDict()
for key in json.loads(df.to_json()).keys():
new[key] =json.loads(df.to_json())[key]
this one works but what if this one is a nested dict, i dont know how to do
new=UltraDict() new=json.loads(df.to_json())
this one wont work either
@wanghaisheng Please share the exception details including stack trace, exception message, etc.
with my code showing above, what all i get is wohhha data
Well, your code above is not enough to debug the problem as you are catching the exception. What happens if you don't catch the exception?
Can you send a full example that I can run myself? I don't have your json string.
this code is exact code
json str is here. at first I am not aware of ultradict and dict is not the same type .since I print two object and it look like the same
==4== {'1': {'captions_certification': 0, 'categories': '', 'comments_ratings_policy': 1, 'extraheading': '', 'first_comment': '', 'heading': '3333', 'is_age_restriction': False, 'is_allow_embedding': True, 'is_automatic_chapters': True, 'is_featured_place': True, 'is_monetization_allowed': True, 'is_not_for_kid': True, 'is_paid_promotion': False, 'is_publish_to_subscriptions_feed_notify': True, 'is_show_howmany_likes': True, 'license_type': 0, 'release_date': '', 'release_date_hour': '10:15', 'shorts_remixing_type': 0, 'subheading': '2222', 'subtitles': '', 'tags': '', 'thumbnail_bg_image_path': '', 'thumbnail_local_path': [], 'video_description': '', 'video_filename': '1.mp4', 'video_film_date': '', 'video_film_location': '', 'video_language': '', 'video_local_path': '/Users/wenke/github/tiktoka-studio-uploader-app/tests/videos/1.mp4', 'video_title': '1'}}
you can ignore ==2 and set it as you like
I've tried it and it works for me:
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from UltraDict import UltraDict
>>> ultra = UltraDict()
>>> d = dict({'1': {'captions_certification': 0, 'categories': '', 'comments_ratings_policy': 1, 'extraheading': '', 'first_comment': '', 'heading': '3333', 'is_age_restriction': False, 'is_allow_embedding': True, 'is_automatic_chapters': True, 'is_featured_place': True, 'is_monetization_allowed': True, 'is_not_for_kid': True, 'is_paid_promotion': False, 'is_publish_to_subscriptions_feed_notify': True, 'is_show_howmany_likes': True, 'license_type': 0, 'release_date': '', 'release_date_hour': '10:15', 'shorts_remixing_type': 0, 'subheading': '2222', 'subtitles': '', 'tags': '', 'thumbnail_bg_image_path': '', 'thumbnail_local_path': [], 'video_description': '', 'video_filename': '1.mp4', 'video_film_date': '', 'video_film_location': '', 'video_language': '', 'video_local_path': '/Users/wenke/github/tiktoka-studio-uploader-app/tests/videos/1.mp4', 'video_title': '1'}})
>>> ultra['d'] = d
>>> ultra
{'d': {'1': {'captions_certification': 0, 'categories': '', 'comments_ratings_policy': 1, 'extraheading': '', 'first_comment': '', 'heading': '3333', 'is_age_restriction': False, 'is_allow_embedding': True, 'is_automatic_chapters': True, 'is_featured_place': True, 'is_monetization_allowed': True, 'is_not_for_kid': True, 'is_paid_promotion': False, 'is_publish_to_subscriptions_feed_notify': True, 'is_show_howmany_likes': True, 'license_type': 0, 'release_date': '', 'release_date_hour': '10:15', 'shorts_remixing_type': 0, 'subheading': '2222', 'subtitles': '', 'tags': '', 'thumbnail_bg_image_path': '', 'thumbnail_local_path': [], 'video_description': '', 'video_filename': '1.mp4', 'video_film_date': '', 'video_film_location': '', 'video_language': '', 'video_local_path': '/Users/wenke/github/tiktoka-studio-uploader-app/tests/videos/1.mp4', 'video_title': '1'}}}
as you see in my code ultra[folder]['videos']=json.loads(df.to_json())
json.loads(df.to_json()) is {'1': {'captions_certification': 0, 'categories': '', 'comments_ratings_policy': 1, 'extraheading': '', 'first_comment': '', 'heading': '3333', 'is_age_restriction': False, 'is_allow_embedding': True, 'is_automatic_chapters': True, 'is_featured_place': True, 'is_monetization_allowed': True, 'is_not_for_kid': True, 'is_paid_promotion': False, 'is_publish_to_subscriptions_feed_notify': True, 'is_show_howmany_likes': True, 'license_type': 0, 'release_date': '', 'release_date_hour': '10:15', 'shorts_remixing_type': 0, 'subheading': '2222', 'subtitles': '', 'tags': '', 'thumbnail_bg_image_path': '', 'thumbnail_local_path': [], 'video_description': '', 'video_filename': '1.mp4', 'video_film_date': '', 'video_film_location': '', 'video_language': '', 'video_local_path': '/Users/wenke/github/tiktoka-studio-uploader-app/tests/videos/1.mp4', 'video_title': '1'}}
not your
dict({'1': {'captions_certification': 0, 'categories': '', 'comments_ratings_policy': 1, 'extraheading': '', 'first_comment': '', 'heading': '3333', 'is_age_restriction': False, 'is_allow_embedding': True, 'is_automatic_chapters': True, 'is_featured_place': True, 'is_monetization_allowed': True, 'is_not_for_kid': True, 'is_paid_promotion': False, 'is_publish_to_subscriptions_feed_notify': True, 'is_show_howmany_likes': True, 'license_type': 0, 'release_date': '', 'release_date_hour': '10:15', 'shorts_remixing_type': 0, 'subheading': '2222', 'subtitles': '', 'tags': '', 'thumbnail_bg_image_path': '', 'thumbnail_local_path': [], 'video_description': '', 'video_filename': '1.mp4', 'video_film_date': '', 'video_film_location': '', 'video_language': '', 'video_local_path': '/Users/wenke/github/tiktoka-studio-uploader-app/tests/videos/1.mp4', 'video_title': '1'}})
Well, as far as I know, json.loads()
returns a dict, so those are the same.
You've shown this in your own example:
print('==3==',type(json.loads(df.to_json())))
==3== <class 'dict'>
I will try to provide a minimal example for you
@ronny-rentner
Well, as far as I know,
json.loads()
returns a dict, so those are the same.You've shown this in your own example:
print('==3==',type(json.loads(df.to_json())))
==3== <class 'dict'>
here is the minimal code you can run,you will see the error
Traceback (most recent call last):
File "D:\Programs\anaconda\lib\site-packages\UltraDict\UltraDict.py", line 841, in __setitem__
item = UltraDict(item,
File "D:\Programs\anaconda\lib\site-packages\UltraDict\UltraDict.py", line 488, in __init__
super().__init__(*args, **kwargs)
File "D:\Programs\anaconda\lib\collections\__init__.py", line 1046, in __init__
self.update(dict)
File "D:\Programs\anaconda\lib\site-packages\UltraDict\UltraDict.py", line 815, in update
self[k] = v
File "D:\Programs\anaconda\lib\site-packages\UltraDict\UltraDict.py", line 849, in __setitem__
if item.name not in self.recurse_register.data:
AttributeError: data
from UltraDict import UltraDict
ultra = UltraDict(shared_lock=True,recurse=True)
ultra['videos']={'1': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
new2={'2': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
ultra['videos']=new2
print(ultra['videos'])
new3={'3': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
method=1
if method==1:
ultra['videos']=new3
print(ultra['videos'])
else:
for filename,video in new3.items():
# print('debug',filename,video)
ultra['videos'][filename]= video
print(ultra['videos'])
from UltraDict import UltraDict
ultra = UltraDict(shared_lock=True,recurse=True)
ultra['empty']={}
new={'1': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
new2={'2': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
new3={'3': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
ultra['new']=new
def t0(key):
#overwrite with same dict
ultra[key]=new
def t1(key):
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
print('same key diff field',ultra[key])
def t11(key):
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
print('same key diff field',ultra[key])
def t12(key):
# make it a empty one at first
ultra[key]=dict({})
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
print('same key diff field',ultra[key])
def t2(key):
#overwrite with diff key
ultra[key]=new2
print(ultra[key])
def method1(key):
ultra[key]=new3
print(ultra[key])
def method2(key):
for filename,video in new3.items(key):
# print('debug',filename,video)
ultra[key][filename]= video
print(ultra[key])
print('m2 pass')
for key in ['empty','new']:
print(f'start to deal {key}')
for func in [t0,t1,t11,t12,t2,method1,method2]:
try:
func(key)
print(f'{func} ok')
except :
print(f'{func} failed')
Thanks, I can reproduce the issue now and will provide a bug fix.
make a little update for your reproduce
@ronny-rentner anything update
I've committed a fix now. Please try if it works for you.
You've changed your example a couple of times. In your last example you're doing:
except :
print(f'{func} failed')
This is bad because it hides the error. You should better do:
import traceback
...
except :
print(f'{func} failed')
traceback.print_exc()
This will print something like:
File "/home/ronny/Projects/py/UltraDict/./error2.py", line 44, in method2
for filename,video in new3.items(key):
^^^^^^^^^^^^^^^
TypeError: dict.items() takes no arguments (1 given)
So in this case, the problem is that you've provided an argument to the items() function which does not accept one.
thanks for teaching me . learned a great trick
start to deal empty <function t0 at 0x7f88859acaf0> ok <function t1 at 0x7f88859acb80> ok <function t11 at 0x7f88859acc10> ok <function t12 at 0x7f88859acca0> ok <function t2 at 0x7f88859acd30> ok <function method1 at 0x7f88859acdc0> ok <function method2 at 0x7f88859ace50> ok start to deal new <function t0 at 0x7f88859acaf0> ok <function t1 at 0x7f88859acb80> ok <function t11 at 0x7f88859acc10> ok <function t12 at 0x7f88859acca0> ok <function t2 at 0x7f88859acd30> ok <function method1 at 0x7f88859acdc0> ok <function method2 at 0x7f88859ace50> ok
it do works now
from UltraDict import UltraDict
import traceback,platform
ultra = UltraDict(recurse=True)
if platform.system()=='Windows':
ultra = UltraDict(shared_lock=True,recurse=True)
ultra['empty']={}
new={'1': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
new2={'2': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
new3={'3': {'video_local_path': 'D:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 222, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': 'xxxxxx'}}
ultra['new']=new
def t0(key):
#overwrite with same dict
ultra[key]=new
def t1(key):
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
# print('same key diff field',ultra[key])
def t11(key):
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
# print('same key diff field',ultra[key])
def t12(key):
# make it a empty one at first
ultra[key]=dict({})
#overwrite with same key diff field
ultra[key]={'1': {'video_local_path': 'C:/Download/audio-visual/saas/tiktoka/tiktoka-studio-uploader-genius/tests/videos/vertical\\1.mp4', 'video_filename': '1.mp4', 'video_title': 1, 'heading': None, 'subheading': None, 'extraheading': None, 'video_description': None, 'thumbnail_bg_image_path': None, 'thumbnail_local_path': '[]', 'release_date': None, 'release_date_hour': '10:15', 'is_not_for_kid': True, 'categories': None, 'comments_ratings_policy': 1, 'is_age_restriction': False, 'is_paid_promotion': False, 'is_automatic_chapters': True, 'is_featured_place': True, 'video_language': None, 'captions_certification': 0, 'video_film_date': None, 'video_film_location': None, 'license_type': 0, 'is_allow_embedding': True, 'is_publish_to_subscriptions_feed_notify': True, 'shorts_remixing_type': 0, 'is_show_howmany_likes': True, 'is_monetization_allowed': True, 'first_comment': None, 'subtitles': None, 'tags': None}}
# print('same key diff field',ultra[key])
def t2(key):
#overwrite with diff key
ultra[key]=new2
# print(ultra[key])
def method1(key):
ultra[key]=new3
# print(ultra[key])
def method2(key):
for filename,video in new3.items():
# print('debug',filename,video)
ultra[key][filename]= video
# print(ultra[key])
# print('m2 pass')
for key in ['empty','new']:
print(f'start to deal {key}')
for func in [t0,t1,t11,t12,t2,method1,method2]:
try:
func(key)
print(f'{func} ok')
except :
print(f'{func} failed')
traceback.print_exc()
@ronny-rentner can you pack a new release to pypi
code is