Git Product home page Git Product logo

Comments (6)

rybodiddly avatar rybodiddly commented on June 16, 2024

Few things. Confused why your directory structure for your venv is saying both Kijiji-Repost-Headless and Kijiji-Reposter in the error? The headless project is ArthurG's Project and has nothing to do with this project.

At the bottom of your error message it's saying it can't find the schedules.json file which should be located in the static folder. So make sure that file exists in the proper directory. Otherwise, could be something to do with file or directory referencing in your venv? Basically, the home.html file is calling the template filter checkschedule in server.py:

@app.template_filter('checkSchedule')
def checkSchedule(adID):
	with open('static/schedules.json', 'r') as f:
		data = json.load(f)

So when the function attempts to open static/schedules.json, it's returning None and causing the error.

When you say "post" data, are you trying to post an ad? If there were any api errors or issues, they would be parsed and printed to the console.

from kijiji-reposter.

hitman3r44 avatar hitman3r44 commented on June 16, 2024

Sorry, I was trying to run both projects, for your project "Kijiji-Reposter" I got some relative paths problem I think. I tried to replace the path to absolute path like: "os.path.dirname(os.path.abspath(file))"

Replacing this path errors will go, yet not tested fully, in posting methods got some errors mostly os related permission and path related. Once I tested full functionality I will send you full reports.

Thanks anyway for your time and I am new in python, so for any kind of silly questions you have to excuse me.

Ref link: https://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/

from kijiji-reposter.

rybodiddly avatar rybodiddly commented on June 16, 2024

No Worries. Python should be interpreting the file references as being from within the immediate directory and shouldn't require OS path calls. Has been tested across multiple platforms successfully (windows, mac, linux). My guess is your venv setup. Personally, I use a combination of pyenv and poetry to manage my virtual environments on mac. No activation / deactivation required, and just cleaner. Requires a bit of $PATH setup for your terminal, but I found it to be a little easier to work with once you get it going. Poetry Setup Guide (Might require some changes, as it's a little dated)

An example of my working .zshrc after successful setup:

#SDKROOT
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

#pyenv
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

# Created by `userpath` on 2019-11-01 14:14:03
export PATH="$PATH:/Users/rybodiddly/.local/bin"

# poetry
export PATH="$HOME/.poetry/bin:$PATH"

# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true

#Required for LZO installation with pip / poetry
#export C_INCLUDE_PATH=$(brew --cellar lzo)/2.10/include/lzo:$(brew --cellar lzo)/2.10/include/:$(brew --cellar lzfse)/1.0/include/
#export LIBRARY_PATH=/usr/local/lib

# commands to override pip restriction above.
# use `gpip` or `gpip3` to force installation of
# a package in the global python environment
# Never do this! It is just an escape hatch.
gpip(){
   PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
gpip3(){
   PIP_REQUIRE_VIRTUALENV="" pip3 "$@"
}

from kijiji-reposter.

hitman3r44 avatar hitman3r44 commented on June 16, 2024

Thanks let me try to setup venv as you said

from kijiji-reposter.

rybodiddly avatar rybodiddly commented on June 16, 2024

Went through and set relative paths for you. See if this solves your issue. Makes more sense then you uprooting your current environment setup. If it works, I'll merge it to the master branch to incorporate a wider range of compatibility. Seems to work for me, but don't have time to test it thoroughly.

server.zip

from kijiji-reposter.

rybodiddly avatar rybodiddly commented on June 16, 2024

This issue is being closed. absolute path support has been merged into the master branch and should be resolved.

from kijiji-reposter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.