Bonjour
Program00.py
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 # coding: utf-8 ''' Created on 23 mars 2018 @author: ''' import csv import sqlite3 import sys import csv import os import encodings from collections import namedtuple from src.Explorateur import * if __name__ == '__main__': encodage ="utf-8" csv.register_dialect('excel-fr', ExcelFr()) nom_fichier_path_in = explorateur_window (".//") # Recherche via explorateur if os.path.isfile(nom_fichier_path_in): # Ouverture du fichier destination nom_fichier_in = os.path.basename(nom_fichier_path_in) # Retourne le nom du fichier nom_fichier_path = os.path.dirname(nom_fichier_path_in) # Retourne le répertoire complet list_nf = os.path.split(nom_fichier_path_in) # Fractionne le chemin d'acc�s. Retourne un tuple BaseSQL =nom_fichier_path_in else: rep = explorateur_dir('/') if rep=='': print ("Pas de répertoire") exit(1) else: print ("vous avez choisi le repertoire : "+ rep)
Explorateur.py
DossierPython sur eclipse organisé
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 # coding: utf-8 import tkinter from tkinter.filedialog import askopenfilename '''Created on 21 aout 2017 @author: ''' def explorateur_window(repertoireinit): """ Explorateur Windows """ #root = tkinter.Tk() filename = tkinter.filedialog.askopenfilename( initialdir=repertoireinit, title="Choisir votre fichier", filetypes=( ("Fichier .txt", "*.txt"), ("Tous type de fichier","*.*") ) ) return filename pass def explorateur_dir(repertoireinit): """ Explorateur Windows """ print ("demande rep") rep = tkinter.filedialog.askdirectory(initialdir=repertoireinit, title='Choisissez un repertoire') if len(rep) == 0: print("Aucun choix de répertoire -Annulation") return str(rep) pass
depuis le dossier du projet
dans /src
Explorateur.py
dans src\FIchier_Vm\src
Program00.py
le programme fonctionne mais eclipse râle --> undefined explorateur_dir sur la ligne " rep = explorateur_dir('/') "
Quelqu'un une idee ?
Partager