Questions tagged [python-3.3]

For issues that are specific to Python 3.3. Use the more generic [python] and [python-3.x] tags where possible.

Filter by
Sorted by
Tagged with
0 votes
0 answers
50 views

What's a tidy way to save all my workflow python packages for later, such that they all have their own setup.py file?

Python package directories seem overly cumbersome to me, I can't just have 1 self contained folder that is the package, if I want to distribute or locally install a suite of my packages. If I read the ...
0 votes
0 answers
35 views

If Python Packaging is implicit since 3.3, why does my interpreter not treat all subdirectories as packages?

I am barely understanding Python packages. If packaging is implicit since 3.3, why does this directory structure: outer_dir/ outside_main.py package_example/ module_main.py ...
-1 votes
1 answer
54 views

Using custom-build C-API Python 3.3.5 module [closed]

I am trying to import a C-API Python module for a game (Assetto Corsa) that uses Python 3.3.5 as scripting extension. I am using MSVC 10.0 as described here for building the extension which works fine....
0 votes
0 answers
32 views

How to use super() in this complex multiple inheritance situation?

I'm writing a library that provides subclasses of each of two existing base classes with extra functionality. Rather than explain the arrangement in words, here's a diagram: And minimal code: class ...
  • 13.9k
1 vote
1 answer
67 views

Create zipfile with directory entries in Python

For a unit test, I need a zipfile that contains directory entries. In a pinch, I could create one manually and keep it in the repo in binary form, but I'd rather create it dynamically as part of the ...
  • 13.9k
1 vote
0 answers
57 views

UnicodeDecodeError in `re.Pattern.search()`

I've received a bug report for a library I wrote. The symptom is that the search method of a compiled Pattern is raising UnicodeDecodeError. The Python re library docs do not mention ...
  • 13.9k
2 votes
0 answers
1k views

Ignore MyPy “is not valid as a type” error

I'm maintaining a Python 3.3 library. I've updated MyPy, and now I'm getting the “is not valid as a type” error. The offending code is in the enum package, which I've vendored. In mypi.ini, I ignore ...
  • 13.9k
1 vote
2 answers
68 views

Reading a text file and showing only part of it some of it in python

So I'm creating a code in python 3.3 where you have to guess a song with only the first letter of the song and artist so I formatted my text file like this: Domo23-Tyler The Creator Happy hour-The ...
0 votes
1 answer
35 views

python 3 remove all new lines marks from string

I wrote this code to remove all new lines from a string' yet it prints the value with \n I still get this output: 4762-9539\n' how can I remove all the \n from this string? #!/usr/bin/python3 ...
0 votes
1 answer
344 views

I would like to create empty directory folders in a file path based on values in the list

I have my list listnumbers='1.0,5.0,6.0,7.0,9.0,10.0' I have my filepath filepath=r'C:\ArcGIS\Projects\Name' I also have a for loop that attempts to take the values from listnumbers for line in ...
  • 1,025
0 votes
0 answers
98 views

Image histogram without ready function

I'm new to MATLAB.I want to extract a histogram of an image clc close all clear all picture=imread('space.jpg'); subplot(2,3,1);imshow(picture); subplot(2,3,2);imhist(picture(:,:,1));title('red ...
0 votes
2 answers
52 views

Iterating over all the values and finding the key for the value

I need iterate over the dictionary and find keys of certain values. The dictionary is as follows : z1 = {9376: 172, 1: 168, 2: 179, 3: 2, 132: 9740, 145: 179, 137: 185, 135: 1, 142: 13528, 113: 158, ...
1 vote
1 answer
329 views

Custom Popen.communicate method gives wrong output

Let's start by considering this code: proc_stdin.py import sys if __name__ == '__main__': for i, line in enumerate(sys.stdin): sys.stdout.write(line) test.py import subprocess def ...
  • 10.2k
-2 votes
2 answers
179 views

How do I print 1st place, 2nd place, etc. up to 5th place?

I have a program that reads the top 5 (or all scores and usernames if there are less than 5 people on the leaderboard of a .csv file, called leaderboard2.csv. However, in the python shell it says ...
  • 21
0 votes
1 answer
152 views

1)Why is there an "invalid syntax" (line highlighted in code)? 2) After the error is solved, why is only the if statement read by python?

I'm writing a 2 player dice game where two 6-sided dice are randomly rolled. If the sum of the dice are even, + 10 to the total of the two dice thrown. If the sum of the dice are odd, -5 from the ...
-2 votes
3 answers
80 views

How do I create this loop? [duplicate]

How do I create this loop where if welcome is not equal to "yes" or "no", it repeats the question (if they have an account), but if welcome is equal to "yes" or "no", they create an account (for "no") ...
  • 21
0 votes
2 answers
66 views

Why is the correct answer printing both score = 3 and score = 1?

When you enter the correct answer ("Bad Guy"), it prints score = 3 and score = 1 at the same time? How do I prevent this so after getting it right in one attempt, it displays (and saves) score = 3, ...
  • 21
5 votes
0 answers
539 views

Make a memoryview read-only in Python pre-3.8

Python 3.8 added the memoryview.toreadonly() method. But is there a way to make a read-only memoryview in previous version of python -- specifically Python 3.5 and 3.3? For a little bit more ...
1 vote
1 answer
146 views

Have error when try to use xgoogle library in code

Have error with xgoogle library When I tried to use this code: from xgoogle.search import GoogleSearch, SearchError try: gs = GoogleSearch("quick") gs.results_per_page = 50 results = gs....
-4 votes
1 answer
84 views

How to fix this code to do with correct answers on a quiz

I'm working on my NEA assessment and I can't seem to fix this bit of code here. The code provides the artist name (in this case BTS) and the first initial of a song (F for Fire). When I type Fire, it ...
1 vote
0 answers
90 views

Monitor existing pipe in-place

I'm running a script within a Python 3.3 runtime. This runtime uses several UNIX pipes (not named pipes) to communicate with its parent process. I would like to intercept and inspect the traffic sent ...
  • 13.9k
-1 votes
4 answers
157 views

Allow the user to input the list position of the word to RETURN to 2nd and 3rd element from the list

I need someone to help me code this WITHOUT using external libraries panda imports exceptions counters lineList = [['Cat', 'c', 1, x],['Cat', 'a', 2, x],['Cat', 't', 3, x],['Bat', 'b', 1, 3],['Bat', '...
user avatar
4 votes
1 answer
139 views

Why is yield from native coroutines valid syntax

PEP-380 introduces the yield from syntax and says: yield from <expr> where is an expression evaluating to an iterable, from which an iterator is extracted. So the following are legal and make ...
-1 votes
1 answer
6k views

How to install pip for python 3.3 on Windows?

I have to install python 3.3.5 particularly to use the api for OriginPro. However, when I try to install pip installation manager by downloading the get-pip.py and run it in python from cmd prompt, I ...
0 votes
0 answers
44 views

Catch FileNotFoundError on imp.reload if the module itself cannot be found

I'm working on a dynamic module reloading system (for modules outside my control). It's possible that when we try to reload a module, the module's file has been removed. I would like to catch and ...
  • 13.9k
1 vote
3 answers
8k views

How to fix Google colab import errors on statsmodels logsumexp and factorial

Am getting import errors in google collab Jupyter notebook on statsmodels packages such as logsumexp and factorial. Please suggest. from scipy.misc import logsumexp from scipy.misc import factorial ...
2 votes
5 answers
10k views

In python, how do I update the balance when I withdraw money then deposit money?

I am creating an ATM using python code, and I need to create deposit and withdraw functions that behave just like an ATM would. Separately, the deposit and withdraw functions work. However, when I ...
2 votes
1 answer
496 views

Is there a method to implement mutex on Python 3.3?

I'm setting up an IPC method on python script and want to implement mutex synchronization method. How i can do to implement it ? I found this library but it's deprecated since 2.6 :'( => https://docs....
0 votes
2 answers
1k views

Empty Input line raises an error in Python 3.3

I'm new at Python and trying some exercises I found on-line. The one I'm busy with requires an text input first, folowed by an ineteger input. I get stuck on the integer input which raises an error. I'...
2 votes
1 answer
307 views

Send `exec()` output to another stream without redirecting stdout

I'm writing a Sublime Text plugin that provides multiple Python shells accessible via UNIX sockets. Each shell should act as a standalone REPL running on its own thread. (It is undesirable for these ...
  • 13.9k
8 votes
3 answers
1k views

Determine a file's path(s) relative to a directory, including symlinks

I have a directory with thousands of descendants (at least 1,000, probably no more than 20,000). Given a file path (which is guaranteed to exist), I want to know where that file can be found inside ...
  • 13.9k
0 votes
4 answers
2k views

How do I allow my program to add the sum of even numbers between two numbers entered by the user? USING PYTHON

I have to include a function in my code and so I wrote the code below but I do not know how to add all the even numbers between the two numbers entered by the user. It prints the even numbers only, it ...
5 votes
3 answers
866 views

Pass extra optional arguments to callbacks without breaking existing callbacks

I have an API method that accepts a callback. The callback expects one argument. I would like this method to pass a second argument to callbacks that accept it. However, I must maintain compatibility ...
  • 13.9k
0 votes
1 answer
269 views

run exe file from python with input and saving the output

I want to run an exe file from python with input and saving the output without printing it, does someone know how can I do it?
0 votes
0 answers
91 views

Fix EOF error when taking list as input and checking if sorted?

Here is my code: lstInput = input('Type here: ') lst = list(lstInput) def is_sorted(lst): if len(lst) == 1: return True else: for x in range(len(lst)): if lst[x] &...
-2 votes
1 answer
1k views

Python tkinter Make a return value from a function appear in a text box

I'm trying to get a value from a function and i want to put the returned value to a text box on my GUI. Label(master, text="Enter your message :").grid(column = 0, row = 0) Label(master, text="...
  • 1
0 votes
4 answers
732 views

How can I output a string excluding ALL whitespaces? [duplicate]

Basically, I'm trying to do a code in Python where a user inputs a sentence. However, I need my code to remove ALL whitespaces (e.g. tabs, space, index, etc.) and print it out. This is what I have ...
  • 15
2 votes
2 answers
3k views

Python program for word count, average word length, word frequency and frequency of words starting with letters of the alphabet

Need to write a Python program that analyzes a file and counts: The number of words The average length of a word How many times each word occurs How many words start with each letter of the alphabet ...
0 votes
1 answer
450 views

How do you decode QByteArray sent by QTcpServer using python socket module?

Consider this code: client.py import socket import json s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect(('127.0.0.1', 8000)) s.send(json.dumps({'text': 'hello world'})....
  • 10.2k
0 votes
2 answers
680 views

How to install pip for python3.3 alongside default python

I downloaded and installed python3.3 from the website and followed the instructions in the readme file. I can run python3.3 from commandline, but when I try to install a package with pip, it will ...
  • 776
-1 votes
2 answers
74 views

File writing in Python 3.3

Can anyone give me advice on writing in files. This is in python 3.3. This error message just keeps on popping up. Traceback (most recent call last):Line 28, in file.write(name_1,"and",name_2,"...
0 votes
1 answer
250 views

Python Coverity Complexity Print

I am using Coverity created by Synopsys, consisting primarily of static code analysis and dynamic code analysis tools. I am currently running this against my code and as a result it generates a .xml ...
0 votes
1 answer
1k views

Import a module relative to a file path

I'm working on a macro engine that transforms YAML files. These YAML files contain paths to Python modules that I am importing using importlib. I would like for end users to be able to specify ...
  • 13.9k
-6 votes
1 answer
196 views

Python, split user input twice. At pair and space

I'm a Python beginner and would like to know how to split a user input at pair and at space and add it to a list. E.g: user = input('A1 KW') user.split(" " ) # split on space Then I'd like to ...
-1 votes
1 answer
774 views

Import WinShell command not working in Python 3.3

I am using the following command for clearing the Recycle Bin in Python 3.3 using JetBrains Pycharm 5.0.1 IDE. import winshell winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=...
  • 1
0 votes
1 answer
54 views

How do i make this program re-run from the beginning after the input "yes"

print("1, Rice") print("2, Amala") print("3, Semolina") print("4, Chicken") Mainchoice=int(input("Select a number of choice:")) if(Mainchoice==1): print("1, Rice and Beans with meat/fish.") ...
0 votes
1 answer
244 views

Python error object() takes no parameters after upgrading python2.7 to python3.4

bashhostlist.py from __future__ import print_function import subprocess import sys import logging class Singleton(object): """ Creating a single object that will work for all the plugin ...
0 votes
2 answers
148 views

How to map a recursive structure?

I'm trying to figure out how to map a recursive structure containing both dictionaries and lists, so far I've got this: import collections def rec_walk(l): for v in l: if isinstance(v, ...
  • 10.2k
0 votes
1 answer
186 views

While Loop CSV File Login - Loops 3 times, unsure why

import csv def login(): global student student = [] file = open("student.csv","r") data = csv.reader(file) UsernameVerified = False PasswordVerified = False ...
2 votes
2 answers
45k views

How to install pyodbc for Python 3.5 or 3.3 on windows 7

I need to install pyodbc to use with python 3.5 or python 3.3 on Windows 7. when I use pip I get the error saying: "could not find a version that satisfies the requirement pyodbc (from versions:) No ...
  • 21

1
2 3 4 5
23