We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,664 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Exec args

I'm trying to use the exec command in python to try to get a function to call on different dictionaries and functions as needs change without making my program bigger than it needs to be. Unfortunately I keep getting this error:

File "Game Files\Intro.py", line 214, in Anim
exec compile('%slegs = ImageTk.PhotoImage(Sprite%s["legs0"])'%(name,name), '<string>', 'exec') in Anim
TypeError: exec: arg 2 must be a dictionary or None

are the args 'compile' and 'in Anim', or is there something else I'm missing?

2
Contributors
1
Reply
19 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
Thropian
Junior Poster
102 posts since Oct 2010
Reputation Points: 13
Solved Threads: 2
Skill Endorsements: 0

It means

exec mycode in mydictionary
Gribouillis
Posting Maven
Moderator
3,101 posts since Jul 2008
Reputation Points: 1,130
Solved Threads: 761
Skill Endorsements: 11
Question Answered as of 1 Year Ago by Gribouillis

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0567 seconds using 2.66MB