bon soir a tous
j'aimerais avoir votre aide svp et merci d'avance
je voudrais appeller une fonction phyton à partir d'un boutton realisé avec Tkinter(dans phyton) mais je recois le message suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Traceback (most recent call last):
  File "E:\DR\logiciel_as\menu_principal.py", line 53, in <module>
    bouton=Button(fenetre,text=" Lancer l analyse des sentiments",command=analyse(sujet0))
  File "E:\DR\logiciel_as\menu_principal.py", line 23, in analyse
    public_tweets = api.search(sujet)
  File "D:\Python27\lib\site-packages\tweepy\binder.py", line 250, in _call
    return method.execute()
  File "D:\Python27\lib\site-packages\tweepy\binder.py", line 234, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
TweepError: [{u'message': u'Query parameters are missing.', u'code': 25}]
je vous informe que la fonction contient:
application twitter
textblob
tweepy

et le programme contient un label et un boutton creés les deux par Tkinter

la fonction est dand le meme fichier que le programme

vioci le code source:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def analyse(sujet):
      # Etape 1 - Authentification
 
      consumer_key= '3oulEPMdfgdfgp2qll3tKqbJbFt7gZ1'
      consumer_secret= 'svlOy9rmRXuNCoY8YNGNKNNaacpdfK8q5IWKBItZW6wB'
 
      access_token='444880545-rYcdk9otw7nfApmvsghp2345O2t9IE8'
      access_token_secret='ejud9WEeagfdggddf8TUqAIQqRY4NaJcO'
 
      auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
      auth.set_access_token(access_token, access_token_secret)
 
      api = tweepy.API(auth)
 
      #Etape 2 - Retrouver les tweet 
 
      public_tweets = api.search(sujet)
      n_pol_neg=0
      n_pol_nul=0
      n_pol_pos=0
 
      #Etape 3 afficher et analyser les sentiments sur les tweets
 
      for tweet in public_tweets:
           print(tweet.text)
           analysis = TextBlob(tweet.text)
           print(analysis.sentiment)
           if analysis.sentiment.polarity<0:
              n_pol_neg=n_pol_neg+1
           if analysis.sentiment.polarity==0:
              n_pol_nul=n_pol_nul+1
           if analysis.sentiment.polarity>0:
              n_pol_pos=n_pol_pos+1
           print('--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------')
      print("Le résumé des tweets est:")
      print("nombre pol neg=",n_pol_neg)
      print("nombre_pol_nul=",n_pol_nul)
      print("nombre_pol_pos=",n_pol_pos)
 
fenetre=Tk()
fenetre.title("logiciel d analyse des sentiments")
fenetre.geometry("1280x800")
message=Label(fenetre,text="Saisir le sujet sur le quel s effectuée l analyse",fg="blue")
message.grid(row=0,column=0)
text = StringVar(fenetre)
sujet0 = Entry(fenetre, textvariable=text).grid(row=0,column=100)
bouton=Button(fenetre,text=" Lancer l analyse des sentiments",command=analyse(sujet0))
bouton.grid(row=1,column=0)
fenetre.mainloop()