I don't get it working :(
What I did so far:
installed:
-tortoisehg-2.1.3-hg-1.9.2-x86.msi
-python-2.7.2.msi
-mercurial-1.9.2-x86.msi
My PATH Variable contains: D:\Program Files\TortoiseHg\;D:\Python27;
Created D:\MercurialWeb\ and set it up in IIS to run a test python cgi script.
In copied the templates directory from tortoiseHg to that web dir and extracted the library zip, too.
My hgweb.cgi looks like this:
#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories
# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"
# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)
hgweb.config
[paths]
MySourceCode = D:\MercurialRepos\**
[web]
style = monoblue
But if I open the Site I get this:
<type 'exceptions.ImportError'>: No module named mercurial
args = ('No module named mercurial',)
message = 'No module named mercurial'
There are a number of different blogs about setting up Mercurial on Windows Server, and most of them specify a specific Mercurial version ( the hightest I've seen is 1.7 ).
See if this blog helps : http://hyperionchaos.net/blog
Related
I am using VS Code using Python 3.9.1.
I have setup a venv called env. Folder structure is:
env
- Include
- Lib
- requests
- Scripts
- pyvenv.cfg
- scrape.py
In my script, scrape.py I have:
import requests
URL = "https://etherscan.io/token/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d"
page = requests.get(URL)
print(page.text)
I get the following error:
Import "requests" could not be resolved from source Pylance(reportMIssingModuleSource)
I have installed requests as you can see from the directory structure. A pip list gives the following which also shows requests is installed:
Use the command select python interpreter, setting it to your venv.
Make sure you Activate your venv in the console.
I think it'll add the string (venv) to your prompt. After running activate, pip and python now
There's additional guides here:
https://code.visualstudio.com/docs/python/environments#_where-the-extension-looks-for-environments
Had a problem of how to install Install NLTK python modules under Python 3.7.1 for SQL 2017 ( CU22 ), but had no direct internet access ( i.e. offline ).
So how to do this?
Here is a method that appears to work OK :
(1) Go to https://github.com/nltk/nltk_data/archive/refs/heads/gh-pages.zip & download zip file (600 MB).
(2) Dig down into the zip file, and find the required packages located at :
nltk_data-gh-pages.zip\nltk_data-gh-pages\packages\
(3) Create a directory either
C:\ntlk_data ( this is a default search path for nltk )
or -
D:\Program Files\Microsoft SQL Server\MSSQL14.<instance_name>\PYTHON_SERVICES.3.7\nltk_data
(4) For the package/s, copy the .zip file, its .XML file and then also extract the .zip file so it is an uncompressed directory.
For example punkt module, final form should look like this :
c:\nltk_data\tokenizers\punkt.zip
c:\nltk_data\tokenizers\punkt\<and_sub_dirs_and_files>
c:\nltk_data\tokenizers\punkt.xml
(5) Run TSQL code to confirm it can see the punkt module :
EXECUTE sp_execute_external_script
#language = N'Python',
#script =N'
import nltk
x = nltk.data.find("tokenizers/punkt")
print(x)
'
You should get an output similar to this if it can see the punkt modules on disk :
STDOUT message(s) from external script:
Express Edition will continue to be enforced.
C:\nltk_data\tokenizers\punkt\PY3
HTH someone!
I am trying to run my Flask application with an Apache server using mod_wsgi, and it has been a bumpy road, to say the least.
It has been suggested that I should try to run my app's .wsgi file using Python to make sure it is working.
This is the contents of the file:
#!/usr/bin/python
activate_this = '/var/www/Giveaway/Giveaway/venv/bin/activate_this.py'
with open(activate_this) as f:
code = compile(f.read(), "somefile.py", 'exec')
exec(code)
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/Giveaways/")
from Giveaways import application
application.secret_key = 'Add your secret key'
However, when I run it, I get this error:
ImportError: No module named 'zlib'
And no, I am not using some homebrewed version of Python - I installed Python 3 via apt-get.
Thanks for any help.
does the contents of somefile.py include the gzip package? in which case you may have to install gzip package via pip or similar
I have a little problem with cx_freeze and hoping one of you can help me. I have searched trough this wonderfull forum but I can't find the answer.
I have used cx_freeze before with python 3.3 and ktinker and that worked flawless.
Now I made a little tool with a bit more complex gui and tried Glade.
Building the gui with Glade works perfect for me and on Linux and Windows 7 the application I have made works fine (in python interpreter).
When I run python setup.py bdist_msi I don't see any faults but when I try to run the exe in windows I get this error window:
(I can't post images jet)
The last 4 lines are:
_load_backward_compatible
File "ExtentionLoader_gi_gi.py", line 22, in <module
File "ExtentionLoader_gi_gi.py", line 14, in_bootstrap_
ImportError: DLL load failed: The specified module could not be found
I don't use any plugins, exotic imports so the dll's I have to load are only the dll's for Gobject. The setup file I have made from an example on this forum. For my ktinker app I did not have to import any dll.
Finally the question: Is there a list of dll's somewhere that tells me what dll's I have to add?
And is there something wrong with my setup.py?
The code is nothing special but if you want to check it: https://github.com/EddenBeer/CodeGenerator
The imports in Python:
import csv import sys import datetime
from gi.repository import Gtk
Installed on Windows 7:
Python-3.4.2
cx_Freeze-4.3.3.win32-py3.4
pygi-aio-3.14.0_rev6-setup
Setup.py:
import os, site, sys
from cx_Freeze import setup, Executable
## Get the site-package folder, not everybody will install
## Python into C:\PythonXX
site_dir = site.getsitepackages()[1]
include_dll_path = os.path.join(site_dir, "gnome")
## Collect the list of missing dll when cx_freeze builds the app
missing_dll = ['libgtk-3-0.dll',
'libgdk-3-0.dll',
'libatk-1.0-0.dll',
'libcairo-gobject-2.dll',
'libgdk_pixbuf-2.0-0.dll',
'libjpeg-8.dll',
'libpango-1.0-0.dll',
'libpangocairo-1.0-0.dll',
'libpangoft2-1.0-0.dll',
'libpangowin32-1.0-0.dll',
'libgnutls-26.dll',
'libgcrypt-11.dll',
'libp11-kit-0.dll'
]
## We also need to add the glade folder, cx_freeze will walk
## into it and copy all the necessary files
glade_folder = 'glade'
## We need to add all the libraries too (for themes, etc..)
gtk_libs = ['etc', 'lib', 'share']
## Create the list of includes as cx_freeze likes
include_files = []
for dll in missing_dll:
include_files.append((os.path.join(include_dll_path, dll), dll))
## Let's add glade folder and files
include_files.append((glade_folder, glade_folder))
## Let's add gtk libraries folders and files
for lib in gtk_libs:
include_files.append((os.path.join(include_dll_path, lib), lib))
base = None
## Lets not open the console while running the app
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable("CodeGenerator.py",
base=base
)
]
buildOptions = dict(
compressed = False,
includes = ["gi", "csv", "datetime",],
packages = ["gi"],
include_files = include_files
)
setup(
name = "Code Generator",
author = "Ed den Beer",
version = "1.0",
description = "Generating copy instructions for RsLogix5000 out of a list with tags in a CSV file",
options = dict(build_exe = buildOptions),
executables = executables
)
My problem is solved.
Looking for an answer if found a utility called ListDlls.exe.
In this link is explaned how to use it:
https://bitbucket.org/anthony_tuininga/cx_freeze/issue/92/pygi-and-cx_freeze-error
I have one application developed in python 3.2, which has inbuilt modules(ex: Tkinter, matplotlib, openpyxl), user defined modules & classes(ex: draw_graph, generate_report), icon files, log file, .csv, .docx etc. I am running this application from script(ex: testapplication.py)
I have setup file as
import sys
from cx_Freeze import setup, Executable
exe = Executable(
script=r"C:\Python32\testapplication.py",
base="Win32GUI",
)
setup(
name = "TESTApp",
version = "0.1",
description = "An example",
executables = [exe]
)
Now I want to create a exe file of this application. can anyone please suggest me a way to do this?
So this is what you need to do. For starters, change script=r"C:\Python32\testapplication.py" to script=r"testapplication.py"
Then, put ALL the files to need to convert into C/python32 including the setup file. Then what you wan to do is get your command line up, and type the following commands: (assuming that you're cx_freeze file is named setup.py):
cd
cd python32
python setup.py build
And then you should have a build folder in that directory containing the exe file.