Fichier CGI Python créé sous Windows

Notez qu'il a fallu beaucoup de temps pour déplacer le fichier Python CGI que j'essayais dans l'environnement local de Windows vers Mac OS X. En supposant un fichier CGI appelé upload.py dans le dossier cgi-bin.

URL de référence: http://d.hatena.ne.jp/yoshiya_na/20110521/1305978743

(1) Vérifiez / modifiez l'autorisation du fichier CGI

cd cgi-bin
ls -lF
chmod 755 upload.py #Peut être exécuté par tous les utilisateurs, mais ne peut être écrit par personne d'autre que le propriétaire

(2) Vérifiez le code de saut de ligne Unix, Mac OS X: LF Mac OS (jusqu'à la version 9): CR Windows: CR-LF Correspondre.

nkf -Lu --overwrite upload.py

Remplacez le fichier d'origine et définissez le code de saut de ligne sur LF.

Ou, si vous pensez supprimer CR d'un fichier créé sous Windows (référence: http://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory)

with open('upload.py', 'rb+') as f:
    content = f.read()
    f.seek(0)
    f.write(content.replace(b'\r', b''))
    f.truncate()

Recommended Posts

Fichier CGI Python créé sous Windows
Python sur Windows
python basic ② sous windows
Activer Python virtualenv sous Windows
Exécutez Openpose sur Python (Windows)
Installer watchdog sur Windows + Python 3.3
Développement Python + Kivy sous Windows
Sphinx-autobuild (0.5.2) sous Windows7, Python 3.5.1, Sphinx 1.3.5
Installation de Python la plus rapide sous Windows
Créer un environnement Python sur Windows
Exécutez le CGI de Python sur CORESERVER
Construire un environnement Python avec Windows
J'ai exécuté python sur Windows
[Python] [Chainer] [Windows] Installer Chainer sous Windows
Utiliser Python sur Windows (PyCharm)
Mémo de construction de l'environnement Python sur Windows 10
Python 3.6 sous Windows ... et vers Xamarin.
Installation de Kivy sur Windows10 64 bits Python3.5
Conseils sur l'entrée / la sortie de fichier Python
Construction de l'environnement Anaconda Python sous Windows 10
installation de python2.7 dans un environnement Windows 32 bits
Installez xgboost (version python) sur Windows
Installez Python sur Windows + pip + virtualenv
Installez Pytorch sur Blender 2.90 python sous Windows
Lier Modelica et Python sous Windows
Installation de Kivy-Designer sur Windows10 64 bits Python3.5
Mecab / Cabocha / KNP sur Python + Windows
Installer l'environnement de développement Python sur Windows 10
Premiers pas avec Python 3.8 sous Windows
Reproduire la recherche à une touche avec Python 3.7.3. (Windows 10)
Énumération de fichiers japonais avec le système Python2 sous Windows (contre-mesure du problème 5C)
Remarques sur l'utilisation d'OpenCV avec Windows10 Python 3.8.3.
Exécutez le servo avec Python sur ESP32 (Windows)
Environnement de création de module d'extension Python 2.7, 3.4, 3.5 sous Windows
[Kivy] Comment installer Kivy sur Windows [Python]
Créer un serveur CGI fonctionnant sur Python 3 sur Docker
Virtualenv ne fonctionne pas sur Python 3.5 (Windows)
Création d'un environnement Ubuntu, Python, OpenCV sur Docker
Utiliser sans installer python 2.x sous Windows
Fichier python de script
twitter avec python3
Installation de Python (Windows)
Traitement de fichiers Python
python sur mac
Python sur Windbg
Je ne peux pas créer de projet avec Python3.5 (Windows) + django1.7.1.
Installez et exécutez Python3.5 + NumPy + SciPy sur Windows 10
Mettez MicroPython sur Windows pour exécuter ESP32 sur Python
Installez Python3, numpy, pandas, matplotlib, etc. sous Windows
Créez simplement un environnement d'exécution Python 3 sous Windows
Remarques sur l'installation de Python3 et l'utilisation de pip sous Windows7
Développer des applications Windows avec Python 3 + Tkinter (fichier exe)
Fichier d'exécution GUI (WxPython) (pyInstaller) [Windows] dans Python3
[Python] Comment installer OpenCV sur Anaconda [Windows]
[Note] Installation de Python 3.6 + α sur Windows et RHEL
Installation de TensorFlow sur Windows Easy pour les débutants en Python
Installez la version ZIP Python et pip sur Windows 10